diff --git a/.gitignore b/.gitignore index e43b0f98..9daa8247 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .DS_Store +node_modules diff --git a/learn_evm/README.md b/learn_evm/README.md index 894dbd55..8c8c577c 100644 --- a/learn_evm/README.md +++ b/learn_evm/README.md @@ -1,12 +1,12 @@ # Learn EVM -List of EVM technical knowledge +List of EVM Technical Knowledge - [EVM Opcode Reference](evm_opcodes.md): Reference and notes for each of the EVM opcodes - [Transaction Tracing](tracing.md): Helper scripts and guidance for generating and navigating transaction traces -- [Arithmetic Checks](./arithmetic-checks.md): A guide to performing arithmetic checks in the EVM +- [Arithmetic Checks](./arithmetic-checks.md): Guide to performing arithmetic checks in the EVM - [Yellow Paper Guidance](yellow-paper.md): Symbol reference for more easily reading the Ethereum yellow paper -- [Forks <> EIPs](eips_forks.md): Summarize the EIPs included in each fork - - [Forks <> CIPs](cips_forks.md): Summarize the CIPs and EIPs included in each Celo fork _(EVM-compatible chain)_ - - [Upgrades <> TIPs](tips_upgrades.md): Summarize the TIPs included in each TRON upgrade _(EVM-compatible chain)_ - - [Forks <> BEPs](beps_forks.md): Summarize the BEPs included in each BSC fork _(EVM-compatible chain)_ +- [Forks <> EIPs](eips_forks.md): Summarizes the EIPs included in each fork + - [Forks <> CIPs](cips_forks.md): Summarizes the CIPs and EIPs included in each Celo fork _(EVM-compatible chain)_ + - [Upgrades <> TIPs](tips_upgrades.md): Summarizes the TIPs included in each TRON upgrade _(EVM-compatible chain)_ + - [Forks <> BEPs](beps_forks.md): Summarizes the BEPs included in each BSC fork _(EVM-compatible chain)_ diff --git a/learn_evm/beps_forks.md b/learn_evm/beps_forks.md index 90c6e58d..268c64f0 100644 --- a/learn_evm/beps_forks.md +++ b/learn_evm/beps_forks.md @@ -1,10 +1,10 @@ -The following lists every BEP associated to a Binance Smart Chain fork. +The following list includes each BEP associated with a Binance Smart Chain fork. -| Release | BEP | What it does | -| ---------------------------------------------------------------- | -------------------------------------------------------------- | --------------------------------------------------- | -| [v1.0.6](https://github.com/bnb-chain/bsc/releases/tag/v1.0.6) | [84](https://github.com/bnb-chain/BEPs/blob/master/BEP84.md) | Issue/bind BEP2 with existing BEP20 tokens | -| [v1.1.5](https://github.com/bnb-chain/bsc/releases/tag/v1.1.5) | [93](https://github.com/bnb-chain/BEPs/blob/master/BEP93.md) | Introduces new block syncing protocol | -| [v1.1.5](https://github.com/bnb-chain/bsc/releases/tag/v1.1.5) | [95](https://github.com/bnb-chain/BEPs/blob/master/BEP95.md) | Creates real-time burning mechanism | -| [v1.1.11](https://github.com/bnb-chain/bsc/releases/tag/v1.1.11) | [127](https://github.com/bnb-chain/BEPs/blob/master/BEP127.md) | Creates "Temporary Maintenance" mode for validators | -| [v1.1.11](https://github.com/bnb-chain/bsc/releases/tag/v1.1.11) | [131](https://github.com/bnb-chain/BEPs/blob/master/BEP131.md) | Increase validator set with "Candidate" validators | -| [v1.1.18](https://github.com/bnb-chain/bsc/releases/tag/v1.1.11) | [153](https://github.com/bnb-chain/BEPs/blob/master/BEP153.md) | Creates native staking protocol | +| Release | BEP | Functionality | +| ---------------------------------------------------------------- | -------------------------------------------------------------- | ----------------------------------------------------- | +| [v1.0.6](https://github.com/bnb-chain/bsc/releases/tag/v1.0.6) | [84](https://github.com/bnb-chain/BEPs/blob/master/BEP84.md) | Issue or bind BEP2 with existing BEP20 tokens | +| [v1.1.5](https://github.com/bnb-chain/bsc/releases/tag/v1.1.5) | [93](https://github.com/bnb-chain/BEPs/blob/master/BEP93.md) | Introduce new block synchronization protocol | +| [v1.1.5](https://github.com/bnb-chain/bsc/releases/tag/v1.1.5) | [95](https://github.com/bnb-chain/BEPs/blob/master/BEP95.md) | Establish real-time burning mechanism | +| [v1.1.11](https://github.com/bnb-chain/bsc/releases/tag/v1.1.11) | [127](https://github.com/bnb-chain/BEPs/blob/master/BEP127.md) | Implement "Temporary Maintenance" mode for validators | +| [v1.1.11](https://github.com/bnb-chain/bsc/releases/tag/v1.1.11) | [131](https://github.com/bnb-chain/BEPs/blob/master/BEP131.md) | Expand validator set with "Candidate" validators | +| [v1.1.18](https://github.com/bnb-chain/bsc/releases/tag/v1.1.11) | [153](https://github.com/bnb-chain/BEPs/blob/master/BEP153.md) | Develop native staking protocol | diff --git a/learn_evm/cips_forks.md b/learn_evm/cips_forks.md index 1cc8cdef..b7b1fa0c 100644 --- a/learn_evm/cips_forks.md +++ b/learn_evm/cips_forks.md @@ -1,25 +1,25 @@ -The following lists every CIP associated to a Celo fork. Celo is an EVM-compatible chain. +The following list presents every CIP associated with a Celo fork. Celo is an EVM-compatible chain. -| Fork | CIP/EIP | What it does | -| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------- | -| [Churrito](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0024.md) | [EIP 211](https://eips.ethereum.org/EIPS/eip-211) | Create `RETURNDATASIZE` and `RETURNDATACOPY` opcodes | -| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 25](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0025.md) | Add Ed25519 precompile | -| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 31 - _copied from EIP-2539_](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0031.md) | Add precompile for BLS12-381 curve operations | -| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 30 - _copied from EIP-2539_](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0030.md) | Add precompile for BLS12-377 curve operations | -| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 20](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0020.md) | Add extensible hash function precompile | -| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 21](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0021.md) | Add governable lookback window | -| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 22](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0022.md) | Upgrade epoch SNARK data | -| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 26](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0026.md) | Add precompile to return BLS pubkey of given validator | -| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 28](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0028.md) | Split etherbase into separate addresses | -| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 35](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0035.md) | Add support for Ethereum-compatible transactions | -| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [EIP 2565](https://eips.ethereum.org/EIPS/eip-2565) | Define gas cost of ModExp precompile | -| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [CIP 48 - _modified from EIP 2929_](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0048.md) | Gas repricing | -| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [EIP 2718](https://eips.ethereum.org/EIPS/eip-2718) | Introduce typed transaction envelope | -| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [EIP 2930](https://eips.ethereum.org/EIPS/eip-2930) | Introduce optional access lists | -| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [CIP 42 - _modified from EIP 1559_](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0042.md) | Fee market changes | -| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [EIP 3529](https://eips.ethereum.org/EIPS/eip-3529) | Reduction in gas refunds | -| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [EIP 3541](https://eips.ethereum.org/EIPS/eip-3541) | Reject deployment of contract code starting with the `0xEF` byte | -| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [CIP 43](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0043.md) | Block Context | -| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [CIP 47](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0047.md) | Modify round change timeout formula | -| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [CIP 45](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0045.md) | Modify transaction fee check | -| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [CIP 50](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0050.md) | Make replay protection optional | +| Fork | CIP/EIP | What it does | +| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------- | +| [Churrito](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0024.md) | [EIP 211](https://eips.ethereum.org/EIPS/eip-211) | Creates `RETURNDATASIZE` and `RETURNDATACOPY` opcodes | +| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 25](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0025.md) | Adds Ed25519 precompile | +| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 31 - _copied from EIP-2539_](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0031.md) | Adds precompile for BLS12-381 curve operations | +| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 30 - _copied from EIP-2539_](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0030.md) | Adds precompile for BLS12-377 curve operations | +| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 20](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0020.md) | Adds extensible hash function precompile | +| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 21](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0021.md) | Adds governable lookback window | +| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 22](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0022.md) | Upgrades epoch SNARK data | +| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 26](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0026.md) | Adds precompile to return BLS pubkey of given validator | +| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 28](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0028.md) | Splits etherbase into separate addresses | +| [Donut](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0027.md) | [CIP 35](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0035.md) | Adds support for Ethereum-compatible transactions | +| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [EIP 2565](https://eips.ethereum.org/EIPS/eip-2565) | Defines gas cost of ModExp precompile | +| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [CIP 48 - _modified from EIP 2929_](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0048.md) | Gas repricing | +| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [EIP 2718](https://eips.ethereum.org/EIPS/eip-2718) | Introduces typed transaction envelope | +| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [EIP 2930](https://eips.ethereum.org/EIPS/eip-2930) | Introduces optional access lists | +| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [CIP 42 - _modified from EIP 1559_](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0042.md) | Fee market changes | +| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [EIP 3529](https://eips.ethereum.org/EIPS/eip-3529) | Reduction in gas refunds | +| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [EIP 3541](https://eips.ethereum.org/EIPS/eip-3541) | Rejects deployment of contract code starting with the `0xEF` byte | +| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [CIP 43](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0043.md) | Incorporates Block Context | +| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [CIP 47](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0047.md) | Modifies round change timeout formula | +| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [CIP 45](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0045.md) | Modifies transaction fee check | +| [Espresso](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0041.md) | [CIP 50](https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0050.md) | Makes replay protection optional | diff --git a/learn_evm/eips_forks.md b/learn_evm/eips_forks.md index 8440f5a4..f6c763ae 100644 --- a/learn_evm/eips_forks.md +++ b/learn_evm/eips_forks.md @@ -1,16 +1,16 @@ -The following lists every EIP associated to an Ethereum fork. +The table below lists all EIPs associated with Ethereum forks: | Fork | EIP | What it does | Opcode | Gas | Notes | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------- | ------ | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------- | ------ | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | | [Homestead (606)](https://eips.ethereum.org/EIPS/eip-606) | [2](https://eips.ethereum.org/EIPS/eip-2) | Homestead Hard-fork Changes | | X | | | [Homestead (606)](https://eips.ethereum.org/EIPS/eip-606) | [7](https://eips.ethereum.org/EIPS/eip-7) | Delegatecall | X | | | | [Homestead (606)](https://eips.ethereum.org/EIPS/eip-606) | [8](https://eips.ethereum.org/EIPS/eip-8) | Networking layer: devp2p Forward Compatibility Requirements for Homestead | | | | | [DAO Fork (779)](https://eips.ethereum.org/EIPS/eip-779) | [779](https://eips.ethereum.org/EIPS/eip-779) | DAO Fork | | | | -| [Tangerine Whistle (608)](https://eips.ethereum.org/EIPS/eip-608) | [150](https://eips.ethereum.org/EIPS/eip-150) | Gas cost changes for IO-heavy operations | | X | Define the _all but one 64th_ rule | +| [Tangerine Whistle (608)](https://eips.ethereum.org/EIPS/eip-608) | [150](https://eips.ethereum.org/EIPS/eip-150) | Gas cost changes for IO-heavy operations | | X | Introduces the _all but one 64th_ rule | | [Spurious Dragon (607)](https://eips.ethereum.org/EIPS/eip-607) | [155](https://eips.ethereum.org/EIPS/eip-155) | Simple replay attack protection | | | | -| [Spurious Dragon (607)](https://eips.ethereum.org/EIPS/eip-607) | [160](https://eips.ethereum.org/EIPS/eip-160) | EXP cost increase | | X | | +| [Spurious Dragon (607)](https://eips.ethereum.org/EIPS/eip-607) | [160](https://eips.ethereum.org/EIPS/eip-160) | EXP cost increase | | X | | | | [Spurious Dragon (607)](https://eips.ethereum.org/EIPS/eip-607) | [161](https://eips.ethereum.org/EIPS/eip-161) | State trie clearing (invariant-preserving alternative) | | X | | -| [Spurious Dragon (607)](https://eips.ethereum.org/EIPS/eip-607) | [170](https://eips.ethereum.org/EIPS/eip-170) | Contract code size limit | | | Change the semantics of CREATE | +| [Spurious Dragon (607)](https://eips.ethereum.org/EIPS/eip-607) | [170](https://eips.ethereum.org/EIPS/eip-170) | Contract code size limit | | | Alters the semantics of CREATE | | [Byzantium (609)](https://eips.ethereum.org/EIPS/eip-609) | [100](https://eips.ethereum.org/EIPS/eip-100) | Change difficulty adjustment to target mean block time including uncles | | | | | [Byzantium (609)](https://eips.ethereum.org/EIPS/eip-609) | [140](https://eips.ethereum.org/EIPS/eip-140) | REVERT instruction | X | | | | [Byzantium (609)](https://eips.ethereum.org/EIPS/eip-609) | [196](https://eips.ethereum.org/EIPS/eip-196) | Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128 | | | | @@ -23,7 +23,7 @@ The following lists every EIP associated to an Ethereum fork. | [Constantinople (1013)](https://eips.ethereum.org/EIPS/eip-1013) | [145](https://eips.ethereum.org/EIPS/eip-145) | Bitwise shifting instructions in EVM | X | | | | [Constantinople (1013)](https://eips.ethereum.org/EIPS/eip-1013) | [1014](https://eips.ethereum.org/EIPS/eip-1014) | Skinny CREATE2 | X | | | | [Constantinople (1013)](https://eips.ethereum.org/EIPS/eip-1234) | [1234](https://eips.ethereum.org/EIPS/eip-1234) | Constantinople Difficulty Bomb Delay and Block Reward Adjustment | | | | -| [Constantinople (1013)](https://eips.ethereum.org/EIPS/eip-1234) | [1283](https://eips.ethereum.org/EIPS/eip-1283) | Net gas metering for SSTORE without dirty maps | | X | This EIP leads to reentrancies risks (see [EIP-1283 incident report](https://github.com/trailofbits/publications/blob/master/reviews/EIP-1283.pdf)) and was directly removed with [EIP-1716](https://eips.ethereum.org/EIPS/eip-1716) | +| [Constantinople (1013)](https://eips.ethereum.org/EIPS/eip-1283) | [1283](https://eips.ethereum.org/EIPS/eip-1283) | Net gas metering for SSTORE without dirty maps | | X | This EIP leads to reentrancies risks (see [EIP-1283 incident report](https://github.com/trailofbits/publications/blob/master/reviews/EIP-1283.pdf)) and was directly removed with [EIP-1716](https://eips.ethereum.org/EIPS/eip-1716) | | [Petersburg (1716)](https://eips.ethereum.org/EIPS/eip-1716) | [1716](https://eips.ethereum.org/EIPS/eip-1716) | Remove EIP-1283 | | X | See [EIP-1283 incident report](https://github.com/trailofbits/publications/blob/master/reviews/EIP-1283.pdf) | | [Istanbul (1679)](https://eips.ethereum.org/EIPS/eip-1679) | [152](https://eips.ethereum.org/EIPS/eip-152) | Precompiled contract for the BLAKE2 F compression function | | | | | [Istanbul (1679)](https://eips.ethereum.org/EIPS/eip-1679) | [1108](https://eips.ethereum.org/EIPS/eip-1108) | Reduce alt_bn128 precompile gas costs | | X | | @@ -39,7 +39,7 @@ The following lists every EIP associated to an Ethereum fork. | [London](https://github.com/ethereum/execution-specs/blob/a01c4c76e12fe9f0debf93bda7f67f002d77f8b4/network-upgrades/mainnet-upgrades/london.md) | [1559](https://eips.ethereum.org/EIPS/eip-1559) | Fee market change for ETH 1.0 chain | | X | Significant modifications of Ethereum gas pricing | | [London](https://github.com/ethereum/execution-specs/blob/a01c4c76e12fe9f0debf93bda7f67f002d77f8b4/network-upgrades/mainnet-upgrades/london.md) | [3198](https://eips.ethereum.org/EIPS/eip-3198) | BASEFEE | X | | | | [London](https://github.com/ethereum/execution-specs/blob/a01c4c76e12fe9f0debf93bda7f67f002d77f8b4/network-upgrades/mainnet-upgrades/london.md) | [3529](https://eips.ethereum.org/EIPS/eip-3529) | Reduction in refunds | | X | Remove [gas tokens](https://gastoken.io/) benefits | -| [London](https://github.com/ethereum/execution-specs/blob/a01c4c76e12fe9f0debf93bda7f67f002d77f8b4/network-upgrades/mainnet-upgrades/london.md) | [3554](https://eips.ethereum.org/EIPS/eip-3554) | Difficulty Bomb Delay to December 1st 2021 | | | | +| [London](https://github.com/ethereum/execution-specs/blob/a01c4c76e12fe9f0debf93bda7f67f002d77f8b4/network-upgrades/mainnet-upgrades/london.md) | [3554](https://eips.ethereum.org/EIPS/eip-3554) | Difficulty Bomb Delay to December 1st 2021 | | | | [Arrow Glacier](https://github.com/ethereum/execution-specs/blob/bfe84c9a9b24695f160b4686d3b4640786ee9bac/network-upgrades/mainnet-upgrades/arrow-glacier.md) | [4345](https://eips.ethereum.org/EIPS/eip-4345) | Difficulty Bomb Delay to June 2022 | | | | | [Gray Glacier](https://github.com/ethereum/execution-specs/blob/bfe84c9a9b24695f160b4686d3b4640786ee9bac/network-upgrades/mainnet-upgrades/gray-glacier.md) | [5133](https://eips.ethereum.org/EIPS/eip-5133) | Difficulty Bomb Delay to mid-September 2022 | | | | | [Paris](https://github.com/ethereum/execution-specs/blob/0a18c44ab6e567d74f2700ab1a3208644e08276b/network-upgrades/mainnet-upgrades/paris.md) | [3675](https://eips.ethereum.org/EIPS/eip-3675) | Upgrade consensus to Proof-of-Stake | | | Changes to `DIFFICULTY` and `BLOCKHASH` | @@ -47,5 +47,5 @@ The following lists every EIP associated to an Ethereum fork. In this table: -- `Opcode`: the EIP adds or removes an opcode -- `Gas`: the EIP changes the gas rules +- `Opcode`: The EIP adds or removes an opcode +- `Gas`: The EIP changes the gas rules diff --git a/learn_evm/tips_upgrades.md b/learn_evm/tips_upgrades.md index 87cb2498..794e155e 100644 --- a/learn_evm/tips_upgrades.md +++ b/learn_evm/tips_upgrades.md @@ -1,26 +1,25 @@ -The following lists every TIP associated to a TRON upgrade. -TRON is an EVM-compatible chain. +The following list comprises every TIP associated with a TRON upgrade. TRON is an EVM-compatible chain. | Upgrade | TIP | What it does | | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | -| [Odyssey-v3.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.5) | [12](https://github.com/tronprotocol/TIPs/blob/master/tip-12.md) | Event subscription model | -| [Odyssey-v3.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.5) | [16](https://github.com/tronprotocol/TIPs/blob/master/tip-16.md) | Account multi-signature/different permissions support | -| [Odyssey-v3.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.5) | [17](https://github.com/tronprotocol/TIPs/blob/master/tip-17.md) | Adapative energy upper limit | -| [Odyssey-v3.5.1](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.5.1) | [24](https://github.com/tronprotocol/TIPs/blob/master/tip-24.md) | RocksDB offered as storage engine | -| [Odyssey-v3.6.0](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.0) | [26](https://github.com/tronprotocol/TIPs/blob/master/tip-26.md) | Add `create2` instruction to TVM | -| [Odyssey-v3.6.0](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.0) | [28](https://github.com/tronprotocol/TIPs/blob/master/tip-28.md) | Built-in Message Queue in Event Subscription Model | -| [Odyssey-v3.6.0](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.0) | [29](https://github.com/tronprotocol/TIPs/blob/master/tip-29.md) | Add bitwise shifting instructions to TVM | -| [Odyssey-v3.6.0](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.0) | [30](https://github.com/tronprotocol/TIPs/blob/master/tip-30.md) | Add `extcodehash` instruction to TVM to return keccak256 hash of a contract's code | -| [Odyssey-v3.6.0](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.0) | [31](https://github.com/tronprotocol/TIPs/blob/master/tip-31.md) | Add `triggerConstantContract` API to support contracts without ABI | -| [Odyssey-v3.6.0](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.0) | [32](https://github.com/tronprotocol/TIPs/blob/master/tip-32.md) | Add `clearContractABI` API to clear existing ABI of contract | -| [Odyssey-v3.6.1](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.1) | [41](https://github.com/tronprotocol/TIPs/blob/master/tip-41.md) | Optimize transactionHistoryStore occupancy space | -| [Odyssey-v3.6.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.5) | [37](https://github.com/tronprotocol/TIPs/blob/master/tip-37.md) | Prohibit TransferContract & TransferAssetContract use for contract account | -| [Odyssey-v3.6.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.5) | [43](https://github.com/tronprotocol/TIPs/blob/master/tip-43.md) | Add precompiled contract function `batchvalidatesign` to TVM that supports parallel signature verification | -| [Odyssey-v3.6.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.5) | [44](https://github.com/tronprotocol/TIPs/blob/master/tip-44.md) | Add `ISCONTRACT` opcode | -| [Odyssey-v3.6.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.5) | [53](https://github.com/tronprotocol/TIPs/blob/master/tip-53.md) | Optimize current TRON delegation mechanism | -| [Odyssey-v3.6.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.5) | [54](https://github.com/tronprotocol/TIPs/blob/master/tip-54.md) | Automatic account activation when transferring TRX/TRC10 tokens in contracts | -| [Odyssey-v3.6.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.5) | [60](https://github.com/tronprotocol/TIPs/blob/master/tip-60.md) | Add `validatemultisign` instruction to TVM to support multi-signature verification | -| [GreatVoyage-v4.0.0](https://github.com/tronprotocol/java-tron/releases/tag/GreatVoyage-v4.0.0) | [135](https://github.com/tronprotocol/TIPs/blob/master/tip-135.md) | Introduce shielded TRC-20 contract standards | +| [Odyssey-v3.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.5) | [12](https://github.com/tronprotocol/TIPs/blob/master/tip-12.md) | Introduces event subscription model | +| [Odyssey-v3.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.5) | [16](https://github.com/tronprotocol/TIPs/blob/master/tip-16.md) | Supports account multi-signature and different permissions | +| [Odyssey-v3.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.5) | [17](https://github.com/tronprotocol/TIPs/blob/master/tip-17.md) | Implements adaptive energy upper limit | +| [Odyssey-v3.5.1](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.5.1) | [24](https://github.com/tronprotocol/TIPs/blob/master/tip-24.md) | Offers RocksDB as a storage engine | +| [Odyssey-v3.6.0](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.0) | [26](https://github.com/tronprotocol/TIPs/blob/master/tip-26.md) | Adds `create2` instruction to TVM | +| [Odyssey-v3.6.0](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.0) | [28](https://github.com/tronprotocol/TIPs/blob/master/tip-28.md) | Integrates built-in message queue in event subscription model | +| [Odyssey-v3.6.0](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.0) | [29](https://github.com/tronprotocol/TIPs/blob/master/tip-29.md) | Adds bitwise shifting instructions to TVM | +| [Odyssey-v3.6.0](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.0) | [30](https://github.com/tronprotocol/TIPs/blob/master/tip-30.md) | Adds `extcodehash` instruction to TVM to return keccak256 hash of a contract's code | +| [Odyssey-v3.6.0](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.0) | [31](https://github.com/tronprotocol/TIPs/blob/master/tip-31.md) | Adds `triggerConstantContract` API to support contracts without ABI | +| [Odyssey-v3.6.0](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.0) | [32](https://github.com/tronprotocol/TIPs/blob/master/tip-32.md) | Adds `clearContractABI` API to clear existing ABI of contract | +| [Odyssey-v3.6.1](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.1) | [41](https://github.com/tronprotocol/TIPs/blob/master/tip-41.md) | Optimizes transaction history store occupancy space | +| [Odyssey-v3.6.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.5) | [37](https://github.com/tronprotocol/TIPs/blob/master/tip-37.md) | Prohibits use of TransferContract & TransferAssetContract for contract account | +| [Odyssey-v3.6.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.5) | [43](https://github.com/tronprotocol/TIPs/blob/master/tip-43.md) | Adds precompiled contract function `batchvalidatesign` to TVM that supports parallel signature verification | +| [Odyssey-v3.6.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.5) | [44](https://github.com/tronprotocol/TIPs/blob/master/tip-44.md) | Adds `ISCONTRACT` opcode | +| [Odyssey-v3.6.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.5) | [53](https://github.com/tronprotocol/TIPs/blob/master/tip-53.md) | Optimizes current TRON delegation mechanism | +| [Odyssey-v3.6.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.5) | [54](https://github.com/tronprotocol/TIPs/blob/master/tip-54.md) | Supports automatic account activation when transferring TRX/TRC10 tokens in contracts | +| [Odyssey-v3.6.5](https://github.com/tronprotocol/java-tron/releases/tag/Odyssey-v3.6.5) | [60](https://github.com/tronprotocol/TIPs/blob/master/tip-60.md) | Adds `validatemultisign` instruction to TVM to support multi-signature verification | +| [GreatVoyage-v4.0.0](https://github.com/tronprotocol/java-tron/releases/tag/GreatVoyage-v4.0.0) | [135](https://github.com/tronprotocol/TIPs/blob/master/tip-135.md) | Introduces shielded TRC-20 contract standards | | [GreatVoyage-v4.0.0](https://github.com/tronprotocol/java-tron/releases/tag/GreatVoyage-v4.0.0) | [137](https://github.com/tronprotocol/TIPs/blob/master/tip-137.md) | Add ZKP verification functions to shielded TRC-20 contract - `verifyMintProof`, `verifyTransferProof`, and `verifyBurnProof` | | [GreatVoyage-v4.0.0](https://github.com/tronprotocol/java-tron/releases/tag/GreatVoyage-v4.0.0) | [138](https://github.com/tronprotocol/TIPs/blob/master/tip-138.md) | Add Pedersen hash computation `pedersenHash` function to shielded TRC-20 contract | | [GreatVoyage-v4.1.0](https://github.com/tronprotocol/java-tron/releases/tag/GreatVoyage-v4.1.0) | [127](https://github.com/tronprotocol/TIPs/blob/master/tip-127.md) | Add new system contracts to support token exchange (including TRX and TRC-10) | diff --git a/learn_evm/tracing.md b/learn_evm/tracing.md index 0044884c..25d69950 100644 --- a/learn_evm/tracing.md +++ b/learn_evm/tracing.md @@ -2,11 +2,11 @@ ## Transaction Tracing -One great way to learn more about how the EVM works internally is to trace the execution of a transaction opcode by opcode. This technique can also help you assess the correctness of assembly code and catch problems related to the compiler or it's optimization steps. +One excellent way to learn more about the internal workings of the EVM is to trace the execution of a transaction opcode by opcode. This approach can also help you assess the correctness of assembly code and catch problems related to the compiler or its optimization steps. -The following Javascript snippet uses an `ethers` provider to connect to an ethereum node with the `debug` JSON RPC endpoints activated. Although this requires an archive node on mainnet, it can also be run quickly & easily against a local development testnet using hardhat node, ganache, or some other ethprovider that targets developers. +The following JavaScript snippet uses an `ethers` provider to connect to an Ethereum node with the `debug` JSON RPC endpoints activated. Although this requires an archive node on Mainnet, it can also be run quickly and easily against a local development Testnet using Hardhat node, Ganache, or some other Ethprovider targeting developers. -Transaction traces for even simple smart contract interactions are verbose so we recommend you provide a filename to save the trace at for further analysis. Note that the following function depends on the `fs` module built into node.js so it should be copied into a node console rather than a browser console, however the filesystem interactions could be removed for use in the browser. +Transaction traces for even simple smart contract interactions are verbose, so we recommend providing a filename to save the trace for further analysis. Note that the following function depends on the `fs` module built into Node.js, so it should be copied into a Node console rather than a browser console. However, the filesystem interactions could be removed for use in the browser. ``` const ethers = require("ethers"); @@ -29,15 +29,15 @@ let traceTx = async (txHash, filename) => { if (filename) { fs.writeFileSync(filename, JSON.stringify(indexedRes, null, 2)); } else { - log(indexecRes); + log(indexedRes); } }); }; ``` -Note that, by default, transaction traces do not feature a sequential index making it difficult to answer, for example, "Which was the 100th opcode executed?" The above script adds such an index for easier navigation and communication. +By default, transaction traces do not feature a sequential index, making it difficult to answer questions such as, "Which was the 100th opcode executed?" The above script adds such an index for easier navigation and communication. -The output of the above features a list of opcode executions, a snippet of which might look something like: +The output of the script contains a list of opcode executions. A snippet might look something like: ``` { @@ -84,25 +84,25 @@ The output of the above features a list of opcode executions, a snippet of which An overview of the fields for opcode execution trace: -- `index`: The index we added, indicates that the above opcode was the 191st one executed. Helpful for staying oriented as you jump around the trace. -- `pc`: program counter eg this opcode exists at index `3645` of the contract bytecode. You'll notice that `pc` increments by one for many common opcodes, by more than one for PUSH opcodes, and is reset entirely by JUMP/JUMP opcodes. -- `op`: name of the opcode, because most of the actual data is hex-encoded, using grep or ctrl-f to search through the trace for opcode names is an effective strategy. -- `gas`: remaining gas _before_ the opcode is executed -- `gasCost`: cost of this operation, for CALL & similar opcodes, this cost takes into account all gas spent by the child execution frame. -- `depth`: each call creates a new child execution frame & this variable tracks how many sub-frames exist. Generally, CALL opcodes increase the depth and RETURN opcodes decrease it. -- `stack`: a snapshot of the entire stack _before_ the opcode executes -- `memory`: a snapshot of the entire memory _before_ the opcode executes -- `storage`: an accumulation of all state changes made during the execution of the transaction being traced +- `index`: The index we added indicates that the above opcode was the 191st one executed. This is helpful for staying oriented as you jump around the trace. +- `pc`: Program counter, for example, this opcode exists at index `3645` of the contract bytecode. You will notice that `pc` increments by one for many common opcodes, by more than one for PUSH opcodes, and is reset entirely by JUMP/JUMP opcodes. +- `op`: Name of the opcode. Since most of the actual data is hex-encoded, using grep or ctrl-f to search through the trace for opcode names is an effective strategy. +- `gas`: Remaining gas _before_ the opcode is executed +- `gasCost`: Cost of this operation. For CALL and similar opcodes, this cost takes into account all gas spent by the child execution frame. +- `depth`: Each call creates a new child execution frame, and this variable tracks how many sub-frames exist. Generally, CALL opcodes increase the depth and RETURN opcodes decrease it. +- `stack`: A snapshot of the entire stack _before_ the opcode executes +- `memory`: A snapshot of the entire memory _before_ the opcode executes +- `storage`: An accumulation of all state changes made during the execution of the transaction being traced -One big challenge of navigating such a transaction trace is matching opcode executions to higher-level solidity code. An effective first step is to identify uncommon opcodes which correspond to easily identified logic of the source code. Generally, expensive operations are relatively uncommon so SLOAD and SSTORE are good ones to scan for first and match against places where state variables are being read or written in solidity. Alternatively, CALL and related opcodes are relatively uncommon and can be matched with calls to other contracts in the source code. +Navigating a transaction trace can be challenging, especially when trying to match opcode executions to higher-level Solidity code. An effective first step is to identify uncommon opcodes that correspond to easily identifiable logic in the source code. Generally, expensive operations are relatively uncommon, so SLOAD and SSTORE are good ones to scan first and match against places where state variables are read or written in Solidity. Alternatively, CALL and related opcodes are relatively uncommon and can be matched with calls to other contracts in the source code. -If there's a specific part of the source code that you're interested in tracing, matching uncommon opcodes to the source code will give you bounds on where to search. From here, you'll likely start walking through the trace opcode-by-opcode as you review the source code line by line. Leaving a few ephemeral comments in the source code like `# opcode 191` can help you keep track and pick up where you left off if you need to take a break. +If there is a specific part of the source code you are interested in tracing, matching uncommon opcodes to the source code will give you bounds on where to search. From this point, you will likely start walking through the trace opcode by opcode as you review the source code line by line. Leaving a few ephemeral comments in the source code, like `# opcode 191`, can help you keep track and pick up where you left off if you need to take a break. -Exploring transaction traces is challenging work but the reward is an ultra-high-definition view into how the EVM operates internally and can help you identify problems that might not be apparent from just the source code. +Exploring transaction traces is challenging work, but the reward is an ultra-high-definition view of how the EVM operates internally and can help you identify problems that might not be apparent from just the source code. ## Storage Tracing -Although you can get an overview of all the changes to the contract state by checking the `storage` field of the last executed opcode in the above trace, the following helper function will extract that for you for quicker and easier analysis. If you're doing a more involved investigation into a contract's state, we recommend you check out the [`slither-read-storage`](https://blog.trailofbits.com/2022/07/28/shedding-smart-contract-storage-with-slither/) command for a more powerful tool. +Although you can get an overview of all the changes to the contract state by checking the `storage` field of the last executed opcode in the above trace, the following helper function will extract that for you for quicker and easier analysis. If you are conducting a more involved investigation into a contract's state, we recommend you check out the [`slither-read-storage`](https://blog.trailofbits.com/2022/07/28/shedding-smart-contract-storage-with-slither/) command for a more powerful tool. ``` const traceStorage = async (txHash) => { diff --git a/learn_evm/yellow-paper.md b/learn_evm/yellow-paper.md index 13a3db08..a759b87e 100644 --- a/learn_evm/yellow-paper.md +++ b/learn_evm/yellow-paper.md @@ -1,14 +1,14 @@ # Ethereum Yellow Paper -So, you want to read the yellow paper. Before we dive in, keep in mind that the yellow paper is out of date and some in the community might refer to it as being depreciated. Check out the [BRANCHES.md](https://github.com/ethereum/yellowpaper/blob/master/BRANCHES.md) file of the [`yellowpaper` repository on github](https://github.com/ethereum/yellowpaper) to stay up-to-date on how closely this document tracks the latest version of the Ethereum protocol. At the time of writing, the yellow paper is up to date with the Berlin hardfork which occurred in April 2021. For an overview of all Ethereum forks and which EIPs are included in each of them, see the [EIPs Forks](./eips_forks.md) page. +So, you want to read the Yellow Paper? Before we dive in, keep in mind that the Yellow Paper is outdated, and some in the community might refer to it as being deprecated. Check out the [`yellowpaper` repository on GitHub](https://github.com/ethereum/yellowpaper) and its [BRANCHES.md](https://github.com/ethereum/yellowpaper/blob/master/BRANCHES.md) file to stay up-to-date on how closely this document tracks the latest version of the Ethereum protocol. At the time of writing, the Yellow Paper is up to date with the Berlin hardfork, which occurred in April 2021. For an overview of all Ethereum forks and which EIPs are included in each of them, see the [EIPs Forks](./eips_forks.md) page. -For a more up-to-date reference, check out the [Ethereum Specification](https://ethereum.github.io/execution-specs/autoapi/ethereum/) which features a detailed description of each opcode _for each hardfork_ in addition to reference implementations written in python. +For a more up-to-date reference, check out the [Ethereum Specification](https://ethereum.github.io/execution-specs/autoapi/ethereum/), which features a detailed description of each opcode _for each hardfork_ in addition to reference implementations written in Python. -That said, the yellow paper is still a rich resource for ramping up on the fundamentals of the Ethereum protocol. This document aims to provide some guidance and assistance in deciphering Ethereum's flagship specification. +That said, the Yellow Paper is still a rich resource for ramping up on the fundamentals of the Ethereum protocol. This document aims to provide some guidance and assistance in deciphering Ethereum's flagship specification. ## Mathematical Symbols -One challenging part of the yellow paper, for those of us who are not so well trained in formal mathematics, is comprehending the mathematical symbols. A cheat-sheet of some of these symbols is provided below +One challenging part of the Yellow Paper, for those of us who are not well-trained in formal mathematics, is comprehending the mathematical symbols. A cheat-sheet of some of these symbols is provided below: - `∃`: there exists - `∀`: for all @@ -17,26 +17,26 @@ One challenging part of the yellow paper, for those of us who are not so well tr And some more Ethereum-specific symbols: -- `N_{H}`: 1,150,000 aka block number at which the protocol was upgraded from homestead to frontier. -- `T`: a transaction eg `T = { n: nonce, p: gasPrice, g: gasLimit, t: to, v: value, i: initBytecode, d: data }` -- `S()`: returns the sender of a transaction eg `S(T) = T.from` +- `N_{H}`: 1,150,000, aka block number at which the protocol was upgraded from Homestead to Frontier. +- `T`: a transaction, e.g., `T = {n: nonce, p: gasPrice, g: gasLimit, t: to, v: value, i: initBytecode, d: data}` +- `S()`: returns the sender of a transaction, e.g., `S(T) = T.from` - `Λ`: (lambda) account creation function - `KEC`: Keccak SHA-3 hash function - `RLP`: Recursive Length Prefix encoding -## High-level glossary +## High-level Glossary -The following are symbols and function representations that provide a high-level description of ethereum. Many of these symbols represent a data structure, the details of which are described in subsequent sections. +The following are symbols and function representations that provide a high-level description of Ethereum. Many of these symbols represent a data structure, the details of which are described in subsequent sections. -- `σ`: ethereum world state +- `σ`: Ethereum world state - `B`: block - `μ`: EVM state - `A`: accumulated transaction sub-state - `I`: execution environment -- `o`: output of `H(μ,I)` ie null if we're good to go or a set of data if execution should halt +- `o`: output of `H(μ,I)`; i.e., null if we're good to go or a set of data if execution should halt - `Υ(σ,T) => σ'`: the transaction-level state transition function -- `Π(σ,B) => σ'`: the block-level state transition function, processes all transactions then finalizes with Ω -- `Ω(B,σ) => σ`: block-finalisation state transition function +- `Π(σ,B) => σ'`: the block-level state transition function; processes all transactions then finalizes with Ω +- `Ω(B,σ) => σ`: block-finalization state transition function - `O(σ,μ,A,I)`: one iteration of the execution cycle - `H(μ,I) => o`: outputs null while execution should continue or a series if execution should halt. @@ -45,12 +45,12 @@ The following are symbols and function representations that provide a high-level A mapping between addresses (external or contract) and account states. Saved as a Merkle-Patricia tree whose root is recorded on the blockchain backbone. ``` -σ = [ account1={...}, account2={...}, - account3= { - n: nonce aka number of transactions sent by account3 - b: balance ie number of wei account3 controls - s: storage root, hash of the merkle-patricia tree that contains this accounts long-term data store - c: code, hash of the EVM bytecode that controls this account. If this equals the hash of an empty string, this is a non-contract account. +σ = [account1={...}, account2={...}, + account3={ + n: nonce, aka number of transactions sent by account3 + b: balance, i.e., the number of wei account3 controls + s: storage root, hash of the Merkle-Patricia tree that contains this account's long-term data store + c: code, hash of the EVM bytecode that controls this account; if this equals the hash of an empty string, this is a non-contract account. }, ... ] ``` @@ -80,7 +80,7 @@ B = Block = { tx1, tx2... ], U: Uncle block headers = [ - header1, header2.. + header1, header2... ], R: Transaction Receipts = [ receipt_1 = { @@ -97,47 +97,47 @@ B = Block = { ``` I = Execution Environment = { - a: address(this) address of the account which owns the executing code - o: tx.origin original sender of the tx that initialized this execution - p: tx.gasPrice price of gas - d: data aka byte array of method id & args + a: address(this), address of the account which owns the executing code + o: tx.origin, original sender of the tx that initialized this execution + p: tx.gasPrice, price of gas + d: data, aka byte array of method id & args s: sender of this tx or initiator of this execution - v: value send along w this execution or transaction + v: value sent along with this execution or transaction b: byte array of machine code to be executed H: header of the current block e: current stack depth } ``` -## EVM state: μ +## EVM State: μ -The state of the EVM during execution. This is the data structure provided by the `debug_traceTransaction` JSON RPC method, see [this page](./tracing.md) for more details about using this method to investigate transaction execution. +The state of the EVM during execution. This is the data structure provided by the `debug_traceTransaction` JSON RPC method. See [this page](./tracing.md) for more details about using this method to investigate transaction execution. ``` μ = { g: gas left - pc: program counter ie index into which instruction of I.b to execute next + pc: program counter, i.e., index into which instruction of I.b to execute next m: memory contents, lazily initialized to 2^256 zeros i: number of words in memory s: stack contents } ``` -## Accrued sub-state: A +## Accrued Sub-state: A -The data accumulated during tx execution that needs to be available at the end to finalize the transactions state changes. +The data accumulated during tx execution that needs to be available at the end to finalize the transaction's state changes. ``` A = { - s: suicide set ie the accounts to delete at the end of this tx + s: suicide set, i.e., the accounts to delete at the end of this tx l: logs t: touched accounts - r: refunds eg gas received when storage is freed + r: refunds, e.g., gas received when storage is freed } ``` ## Contract Creation -If we send a transaction `tx` to create a contract, `tx.to` is set to `null` and we include a `tx.init` field that contains bytecode. This is NOT the bytecode run by the contract, rather it RETURNS the bytecode run by the contract ie the `tx.init` code is run ONCE at contract creation and never again. +If we send a transaction `tx` to create a contract, `tx.to` is set to `null`, and we include a `tx.init` field that contains bytecode. This is NOT the bytecode run by the contract. Rather, it RETURNS the bytecode run by the contract, i.e., the `tx.init` code is run ONCE at contract creation and never again. -If `T.to == 0` then this is a contract creation transaction and `T.init != null`, `T.data == null` +If `T.to == 0`, then this is a contract creation transaction, and `T.init != null`, `T.data == null`.