Skip to content

Commit

Permalink
Update realgu.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengruiGu authored Feb 12, 2025
1 parent a86c850 commit 5b726c3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions realgu.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,32 @@ func stf(parent types.Block, block types.Block, state state.StateDB) (state.Stat
```
问题: what exactly does a 'state' contains? what are the tries?

### 2024.02.12
Ethereum state is stored in four different modified merkle patricia tries (MMPTs):
- Transaction Trie
- Receipt Trie
- World State Trie
- Account State Trie

计算机组成课flashback:

1 word = 32 bytes, 1 byte = 8 digits = 2 digits in hexadecimal

The EVM stack has a maximum size of 1024 items. PUSH -> PUSH -> ADD
Also there's a program counter and JUMP. But where is compare and jump insn like bne, bge, blt?
And there's an available gas counter.


EVM memory is a byte array of 2<sup>256</sup> (or practically infinite) bytes . All locations in memory are well-defined initially as zero.
MSTORE takes two values from the stack: an address offset and a 32-byte value. It then writes the value to memory at the specified offset.

In EVM, memory is dynamically allocated in multiples of 1 word “pages”. Gas is charged for the number of pages expanded.
MSIZE: number of words/pages allocated

Storage can only be accessed via the code of its associated account. External accounts don't have code and therefore cannot access their own storage.

SSTORE takes two values from the stack: a storage slot and a 32-byte value. It then writes the value to storage of the account. So an account have associated storage



<!-- Content_END -->

0 comments on commit 5b726c3

Please sign in to comment.