-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARC-64: AVM Run Time Errors based on program source map #305
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I correct in saying that this ARC is only being proposed to formalize what currently exists in Algokit? If so, then I question whether it's worth creating an ARC when we will have a better formal standard with ARC56. If the goal is to have an ARC that can also be used going forward, then I would have more comments to make.
- No opcode budget required to rise errors; | ||
- No program size consumed by error messages. | ||
|
||
### CONS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another con here is that using the PC will be unreliable for contracts that have template variables. Integer or dynamic byteslice template variable values will change the PC. This is why ARC56 proposes using disassembled TEAL lines in the event template variables. Regardless of the width of the template variable values, the disassembled TEAL will always be the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our side conversation about this you said the steps required to make use of this (from front-end perspective) are:
- Get pc=XXX error
- Pass bytecode to /dissassemble to get TEAL
- Pass TEAL from 2 to /compile?sourcemap=true
- Lookup the PC XXX and see what line it corresponds with
- Find the object in the source map with disassembledTeal that matches the line given in step 4
Given a front-end will just get a pc=xxx error (that it has to parse out), for it to have to do all that (assuming the node its connecting to even allows the disassemble/compile endpoints!) just to get the error message associated with that PC is extremely onerous. I think it kills the whole thing imo.
Short of dynamic strings, I think the template variables being variable sized is a fixable issue. Instead of having templates do pushint, pushbytes etc at every reference, perhaps have them initialized at start into scratch storage from fixed size values, ie: btoi(0x0000000000000001) for a templated int 1 - and then reference that scratch slot late for the constant reference?
@joe-p the scope of this ARC is twofold:
|
I think this ARC is missing some context then. It's not really clear what the source map standard actually is. Is the standard being proposed the
I suppose it's not really clear to me why someone would want this when in any scenario you'd still need to provide special artifacts from the compiler to clients. |
This! The proposed spec is not really for the program "client", it is rather for the program itself. It is a formalization of what the TEAL (either handwritten or generated by a compiler) should look like if it wants to conform to this AMV run time error messages conventions. It really says nothing about the auxiliary App Spec (which is what ARC-56 is solving for). |
Withdrawn in favour of the #258 approach to AVM errors based on source map. |
This ARC formalizes the conventions, already in use, to rise AVM run time errors based on Program Counter Source Map.