Content pfp
Content
@
https://opensea.io/collection/dev-21
0 reply
0 recast
2 reactions

ustas.eth pfp
ustas.eth
@ustas
The new @ethereum system smart contracts to be introduced in Pectra are insanely good for understanding how the low-level EVM works! Loaded with comments and pseudocode in the EIPs, you can see how the stack and opcodes function very clearly. 🧵👇
1 reply
0 recast
1 reaction

ustas.eth pfp
ustas.eth
@ustas
As an example, you can see the Withdrawal code here: https://github.com/lightclient/sys-asm/blob/main/src/withdrawals/main.eas It implements EIP-7002, which gives validators the ability to request a withdrawal on the consensus layer directly from the execution layer. https://eips.ethereum.org/EIPS/eip-7002 The contract is written in geas, an assembler language for EVM with just a couple of features to make development easier, such as labels for variables or jump destinations. https://github.com/fjl/geas In the EIP, you can see that pseudocode is provided for a more high-level understanding. Compare it to the opcodes and you'll quickly grasp the assembly code.
1 reply
0 recast
1 reaction

ustas.eth pfp
ustas.eth
@ustas
Near the assembly, you can find helpful comments that indicate what the stack memory currently holds. Observe the changes after each opcode. For example, the following code will push a constant onto the stack, then push and load the storage slot for the excess value. The constant is first shifted deeper into the stack by the slot, then `SLOAD` "consumes" the slot and replaces it with the value it contains. See https://www.evm.codes/ to get a reference with an example on each opcode. Good luck 🍀
0 reply
0 recast
0 reaction