consensus-shipyard / consensuslab

The go-to place for scalable decentralised consensus research
64 stars 3 forks source link

Study Block-STM, FEVM internals and understand Yann’s code #209

Closed sergefdrv closed 1 year ago

sergefdrv commented 1 year ago

Notes about Block-STM:

sergefdrv commented 1 year ago

Notes about Block-STM implementation in Diem:

sergefdrv commented 1 year ago

Notes about Block-STM implementation in Aptos:

sergefdrv commented 1 year ago

Notes about FMV/FEVM:

/// DAG-CBOR tuple-encoded.
pub struct State {
    /// The EVM contract bytecode
    pub bytecode: Cid,
    /// The EVM contract bytecode hash keccak256(bytecode)
    pub bytecode_hash: [u8; 20],
    /// The EVM contract state dictionary.
    pub contract_state: Cid,
    /// The EVM nonce used to track how many times CREATE or
    /// CREATE2 have been called.
    pub nonce: u64,
    /// Possibly a tombstone if this actor has been self-destructed.
    pub tombstone: Option<Tombstone>
}

EVM storage (state dictionary, u256 => u256 map) is backed by a Filecoin HAMT with special optimizations to be more mechanically sympathetic to EVM read and write patterns. SLOAD and SSTORE opcodes map to reads and writes, respectively, on this HAMT, and ultimately to ipld syscalls.