-
Notifications
You must be signed in to change notification settings - Fork 82
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
feat: use zksync-error for halt and revert errors #571
base: main
Are you sure you want to change the base?
Conversation
Not sure how to handle linting checks for |
Normally the generated code must have all the related |
@sayon can you add that to the library please 🙏 |
Sure, I am currently cleaning the generator and will make it produce a warning-free code. |
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.
Overall I think it's a great effort and I like what I see a lot
@@ -410,27 +409,23 @@ impl InMemoryNode { | |||
.take() | |||
.unwrap_or_default(); | |||
|
|||
// TODO: I dont think we need to log any of this. The success and errors are |
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.
Agreed
"identifier_encoding": "anvil", | ||
"components": [ | ||
{ | ||
"component_name": "Halt", |
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.
Something we need to figure out about hierarchy: I guess these errors would be the same for the main node.
How do we avoid duplication? Should the domain be EraVM
maybe? Although then it becomes a bit less clear how to share the error definitions between anvil-zksync and core. Hmm..
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.
Yes, very much so agree. Unfortunately cannot use EraVM here as its already defined in the error definitions.
It would be nice to have conformity, a written standard / policy perhaps, that keeps error code component naming conventional?
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.
We can define another piece of error hierarchy related to eravm and wrap these errors as a field or one of anvil errors. It would however require to simulateneously change eravm code, or writing an adapter here. I will produce an example to illustrate wrapping
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.
I was thinking more about changing the error schema as it evolves. Writing adapters makes it even more complex.
OTOH once these errors are battle-tested, we can move them to EraVM scope and deprecate them here.
Note: This is branched off from #555 to initiate discussion on defining halt / revert errors and how we would prefer them displayed to users.
Once
zksync-error
repo is made public and #555 is updated / merged, and feedback is provided for error definitions / display I will prepare this PR to be merged.The following
etc/resources/anvil.json
json file outlines the errors that could be hit based on the errors defined here. To make it easier to review and have discussion please refer to this Notion page where the json schema and display are also present for easier dialogue. Feedback would be appreciated, especially as many error cases I am unfamiliar with so assistance in properly defining cause / fixes would be helpful.cc: @sayon @itegulov @popzxc
What 💻
zksync-error
to define Halt and Revert errors to be displayed to usersCallErrorTracer
Logging and Update Revert/Halt Handling #436 and [FEAT] Integrateerror-codegen
for insightful and actionable debugging #537Why ✋
Evidence 📷
Include screenshots, screen recordings, or
console
output here demonstrating that your changes work as intendedPrevious errors shown
Note: We print gas estimation details implying its a gas issue even though this error is the account having insufficient funds.
Defined structured errors shown
Note: same error.