You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
The example given for the Jump Labels section in Huff By Examples, is causing stack underflow error on the mstore opcode under the success label. You can try it out here quickly.
It seems to me that 0x00 mstore part is unnecessary as the following line simply returns the "Hello, World!" string already stored in the memory (with some weird characters in the beginning cause of the padded zeroes which could be fixed with 0x0d 0x13 return).
Also, the comments representing the state of the stack seem a bit off.
Following is how I think the example should have been:
#definemacroMAIN()=takes(0)returns(0){// Store "Hello, World!" in memory0x48656c6c6f2c20576f726c6421// ["Hello, World!"]0x00mstore// [ ]// Jump to success label, skipping the revert statementsuccess// [success_label_pc]jump// [ ]// Revert if this point is reached0x000x00revert// Labels are defined within macros or functions, and are designated// by a word followed by a colon. Note that while it may appear as if// labels are scoped code blocks due to the indentation, they are simply// destinations to jump to in the bytecode. If operations exist below a label,// they will be executed unless the program counter is altered or execution is// halted by a `revert`, `return`, `stop`, or `selfdestruct` opcode.
success:
0x0d0x13return}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The example given for the Jump Labels section in Huff By Examples, is causing
stack underflow
error on themstore
opcode under thesuccess
label. You can try it out here quickly.It seems to me that
0x00 mstore
part is unnecessary as the following line simply returns the "Hello, World!" string already stored in the memory (with some weird characters in the beginning cause of the padded zeroes which could be fixed with0x0d 0x13 return
).Also, the comments representing the state of the stack seem a bit off.
Following is how I think the example should have been:
The text was updated successfully, but these errors were encountered: