-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Change LLL opcode generated by "panic" to INVALID #2350
Conversation
I think this is fine. For users' faults LLL programmers can use |
After reviewing #1589, I'll just note that In LLL there isn't really a meaningful distinction between implicit and explicit throws, as the compiler doesn't autogenerate very much. If the programmer wishes to distinguish between failure modes, this is what I suggest,
|
I had a similar change in April, but realised it should be just moved to the standard macros section as it is possible to issue the "invalid opcode". This was not the case when
|
Sure, that's Edit: it turns out it's not quite the same for the programmer:
No problem with this approach in principle. |
@axic shall we go for a macro even if that would be a breaking change (from |
I do not fully understand the above. Why is it different? It shouldn't be different. |
Consider compiling the following.
To compile using the macro version (3.) the source needs to be expressed differently, as follows.
This doesn't compile with the current version (1.). Hence "breaking". I don't know if there is something funky that can be done with the macro to make the syntax consistent with the previous implementation (1.). In any case, maybe it's time to drop the |
@benjaminion if you have the macro implementation already, can you share this? I want to try. |
The code actually should be However, I think it should work without parameter list too in an ideal case. |
It turns out to be a parser error:
|
@axic if you haven't, I start adding support for macros with zero arguments. |
On top of #2375, |
Can you please rebase (now that #2375 is merged)? |
EIP-141 ethereum/EIPs#141 has preserved 0xfe as an invalid opcode for aborting EVM execution. The EVM assembler supports this via the INVALID opcode. The LLL "panic" expression used to generate a jump to an invalid location in order to abort EVM execution. This change brings "panic" into line with EIP-141 by generating the INVALID opcode instead.
Have updated the macro and rebased. In summary,
|
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.
Looks good to me.
EIP-141 ethereum/EIPs#141 has preserved 0xfe as an invalid opcode for aborting EVM execution. The EVM assembler supports this via the INVALID opcode.
The LLL "panic" expression used to generate a jump to an invalid location in order to abort EVM execution. This change brings "panic" into line with EIP-141 by generating the INVALID opcode instead.