yes, but having a separate tool would be
yes, but having a separate tool would be a better solution than what we have right now
24 Replies
let's talk
can delete it after discussion
what do you consider a separate "Ergoscript debugger" repo
?
just the code that ilya built in a separate repo instead of buried deep inside one of spectrum labs. Anyone looking to debug their ergoscript failing can clone the repo, create a class for their ergoscript, paste the transaction json and run the debugger
i cloned the code, but didn't try. Does it work with any transaction?
it looks like it's built for spectrum context
out of the box
seems like it should, you provide a validator class with the pasted ergoscript in it and the transaction json. then it fetches the input utxoxs from a node and you tell it to debug a certain input using your validator class
but no idea how dependent this all is on spectrum code

it's worth pursuing on another day
i don't have much hope for this tool
If you are proficient in scala, you don't really need it.
If you are not proficient in scala, it's not very useful, because you can't write code around it.
Yes it would be "better" to have it as a tool for any transaction, but i don't see who could be interested in building one. And i don't see using it much, as i have pretty high velocity prototyping in js.
Imho it's only worth persuing if it can be compiled as executable, where you put a transaction and ergoscript in, and get debug info out.
This way, python, js, ... anyone could include it in their dev process.
true, I usually just end up commenting conditions until I hit the culprit and then it is usually easy to deduce what is wrong. Big benefit with this setup though is that it can debug a transaction that occured "in the wild", which can be a bit annoying to do otherwise (mimic conditions in a test case)
i do similar, commenting things and building transactions like a retarded monkey, only working wuth the true/false evaluation of the script.
but this approach is not effective anymore, after i start dealing with numbers and calculations
i need an interpreter, not an evaluator
i not sure though i need a stepper
It would improve the dev experience a lot
yes, 100%
but i am claiming that if i don't have a stepper, but instead i get a value dump, it's good enough.
i am sure i can build some kind of vscode extension that would run the ErgoScript for a specific tx, and display the calculated values like intellij does.
yeah that would be a hug improvement already
But for this i would need an executable or a jar, where i put tx in (+ any meta data that is required), and get the state out.
i have another retarded idea, that i might try
... something like, inject code into my ergoscript, that will take all
val foobar and put them into some register output...
so if you have
hmm, not sure I follow 😄
then i would write values and names into OUTPUT(0).R4 = (
("a", 1),
("b", 2),
("c", 3),
).
But to build the tx you need to calculate those values in off chain code
that's true, which transaction attributes can change with constant transaction id?
only spendingProof?
Maybe something can be build with a custom
sigma-rust version
i refuse to deal with scala for 2 reasons:
- for ever compile time
- no way to compile to OS executables
long compile time -> separation compiler from linter
-> devX garbage
with sigma-rust i fear optimization comes before evaluation, so the "debug" values you declare get optimized away, and you don't get any evaluation for them.
------
So the current state of ErgoScript tooling is this:
A) you know what you are doing ->
write ErgoScript as a string.
B) you don't know what you are doing ->
learn Scala or GTFO
@Luivatra do you agree?
@MGpai do you have the same impression?it used to be a lot worse when I first entered 3 years ago
you can kinda get by without dealing with scala but it will be harder (without knowing scala) for complex contracts fs
kinda agree
Its actually why I made ErgPy since I didnt want to deal with scala
but I couldnt do complex ergoscript stuff without me needing to add like a million more functions to ergpy each time
so I just sucked it up
please give me a quick feedback on this idea:
sigma-rust (that compiles to everything). should expose additional data on transaction signing.
For each intput i am expecting a map with pairs of
[valueName, serializedValue] for each
val declared in ErgoScript.
Example
For that you would need to provide ErgoScript for each input.
@MGpai do you think that would greatly improve ErgoScript dev experience?
what i could do is add those values interactively to the playground.

this would be a great addition to unit tests, you could write your assertions in any language.
Maybe this can be more of a debugging thing?
I dont fully get it
legit just doing exactly what aiken does
you are probably right, these half measures only solve a specific subset of problems. it needs to be addressed as a whole