diff --git a/bins/revme/src/cmd/statetest/merkle_trie.rs b/bins/revme/src/cmd/statetest/merkle_trie.rs index e294c4e4be..0aa501b528 100644 --- a/bins/revme/src/cmd/statetest/merkle_trie.rs +++ b/bins/revme/src/cmd/statetest/merkle_trie.rs @@ -15,14 +15,19 @@ pub fn state_merkle_trie_root<'a>( accounts: impl IntoIterator, ) -> B256 { trie_root(accounts.into_iter().map(|(address, acc)| { - ( - address, - alloy_rlp::encode_fixed_size(&TrieAccount::new(acc)), - ) + let t = TrieAccount::new(acc); + let s: Vec<_> = acc.storage.iter().filter(|(_k, &v)| !v.is_zero()).collect(); + println!("@ {address:?}:"); + for (k, v) in s { + // TODOFEE + println!(" {k:?}: {:X?}", v.to_be_bytes::<32>()); + } + println!(""); + (address, alloy_rlp::encode_fixed_size(&t)) })) } -#[derive(RlpEncodable, RlpMaxEncodedLen)] +#[derive(Debug, RlpEncodable, RlpMaxEncodedLen)] struct TrieAccount { nonce: u64, balance: U256, diff --git a/bins/revme/src/cmd/statetest/models/mod.rs b/bins/revme/src/cmd/statetest/models/mod.rs new file mode 100644 index 0000000000..92d219d31a --- /dev/null +++ b/bins/revme/src/cmd/statetest/models/mod.rs @@ -0,0 +1,197 @@ +mod deserializer; +mod spec; + +use deserializer::*; + +pub use spec::SpecName; + +use revm::{ + primitives::{Address, Bytes, HashMap, B256, U256}, + specification::{ + eip2930::AccessList, + eip7702::{Authorization, Parity, RecoveredAuthorization, Signature}, + }, +}; +use serde::{Deserialize, Serialize}; +use std::collections::BTreeMap; + +#[derive(Debug, PartialEq, Eq, Deserialize)] +pub struct TestSuite(pub BTreeMap); + +#[derive(Debug, PartialEq, Eq, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct TestUnit { + /// Test info is optional + #[serde(default, rename = "_info")] + pub info: Option, + + pub env: Env, + pub pre: HashMap, + pub post: BTreeMap>, + pub transaction: TransactionParts, + #[serde(default)] + pub out: Option, +} + +/// State test indexed state result deserialization. +#[derive(Debug, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct Test { + pub expect_exception: Option, + + /// Indexes + pub indexes: TxPartIndices, + /// Post state hash + pub hash: B256, + /// Post state + #[serde(default)] + pub post_state: HashMap, + + /// Logs root + pub logs: B256, + + /// Tx bytes + pub txbytes: Option, +} + +#[derive(Debug, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct TxPartIndices { + pub data: usize, + pub gas: usize, + pub value: usize, +} + +#[derive(Clone, Debug, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct AccountInfo { + pub balance: U256, + pub code: Bytes, + #[serde(deserialize_with = "deserialize_str_as_u64")] + pub nonce: u64, + pub storage: HashMap, +} + +#[derive(Debug, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct Env { + pub current_coinbase: Address, + #[serde(default)] + pub current_difficulty: U256, + pub current_gas_limit: U256, + pub current_number: U256, + pub current_timestamp: U256, + pub current_base_fee: Option, + pub previous_hash: Option, + + pub current_random: Option, + pub current_beacon_root: Option, + pub current_withdrawals_root: Option, + + pub parent_blob_gas_used: Option, + pub parent_excess_blob_gas: Option, + pub current_excess_blob_gas: Option, +} + +#[derive(Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TransactionParts { + pub data: Vec, + pub gas_limit: Vec, + pub gas_price: Option, + pub nonce: U256, + pub secret_key: B256, + /// if sender is not present we need to derive it from secret key. + #[serde(default)] + pub sender: Option
, + #[serde(default, deserialize_with = "deserialize_maybe_empty")] + pub to: Option
, + pub value: Vec, + pub max_fee_per_gas: Option, + pub max_priority_fee_per_gas: Option, + + #[serde(default)] + pub access_lists: Vec>, + pub authorization_list: Option>, + #[serde(default)] + pub blob_versioned_hashes: Vec, + pub max_fee_per_blob_gas: Option, +} + +#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone, Copy)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct TestAuthorization { + chain_id: U256, + address: Address, + nonce: U256, + v: U256, + r: U256, + s: U256, + signer: Option
, +} + +impl TestAuthorization { + pub fn signature(&self) -> Signature { + let v = u64::try_from(self.v).unwrap_or(u64::MAX); + let parity = Parity::try_from(v).unwrap_or(Parity::Eip155(36)); + Signature::from_rs_and_parity(self.r, self.s, parity).unwrap() + } + + pub fn into_recovered(self) -> RecoveredAuthorization { + let authorization = Authorization { + chain_id: self.chain_id, + address: self.address, + nonce: u64::try_from(self.nonce).unwrap(), + }; + let authority = self + .signature() + .recover_address_from_prehash(&authorization.signature_hash()) + .ok(); + RecoveredAuthorization::new_unchecked( + authorization.into_signed(self.signature()), + authority, + ) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use serde_json::Error; + + #[test] + pub fn serialize_u256() -> Result<(), Error> { + let json = r#"{"_item":"0x10"}"#; + + #[derive(Deserialize, Debug)] + pub struct Test { + _item: Option, + } + + let out: Test = serde_json::from_str(json)?; + println!("out:{out:?}"); + Ok(()) + } + + #[test] + pub fn deserialize_minimal_transaction_parts() -> Result<(), Error> { + let json = r#"{"data":[],"gasLimit":[],"nonce":"0x0","secretKey":"0x0000000000000000000000000000000000000000000000000000000000000000","to":"","value":[]}"#; + + let _: TransactionParts = serde_json::from_str(json)?; + Ok(()) + } + + #[test] + pub fn serialize_b160() -> Result<(), Error> { + let json = r#"{"_item":"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"}"#; + + #[derive(Deserialize, Debug)] + pub struct Test { + _item: Address, + } + + let out: Test = serde_json::from_str(json)?; + println!("out:{out:?}"); + Ok(()) + } +} diff --git a/bins/revme/src/cmd/statetest/runner.rs b/bins/revme/src/cmd/statetest/runner.rs index bfdc5c0ae3..59b5cff9e2 100644 --- a/bins/revme/src/cmd/statetest/runner.rs +++ b/bins/revme/src/cmd/statetest/runner.rs @@ -154,6 +154,9 @@ fn check_evm_execution( spec: SpecId, print_json_outcome: bool, ) -> Result<(), TestErrorKind> { + // for acc in evm.context.evm.db.cache.trie_account() { + // println!("# {:?} [{:?}]", acc, acc.1.storage.len()); + // } let logs_root = log_rlp_hash(exec_result.as_ref().map(|r| r.logs()).unwrap_or_default()); let state_root = state_merkle_trie_root(db.cache.trie_account()); @@ -264,6 +267,10 @@ pub fn execute_test_suite( })?; for (name, unit) in suite.0 { + if name != "tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_contract_creating_set_code_transaction[fork_Prague-state_test]" { + // continue; + } + // Create database and insert cache let mut cache_state = database::CacheState::new(false); for (address, info) in unit.pre { @@ -429,6 +436,7 @@ pub fn execute_test_suite( let timer = Instant::now(); let res = evm.exec_commit(); + println!("RES: {res:?}\n"); *elapsed.lock().unwrap() += timer.elapsed(); let spec = cfg.spec(); diff --git a/crates/bytecode/CHANGELOG.md b/crates/bytecode/CHANGELOG.md index e69de29bb2..069587de1f 100644 --- a/crates/bytecode/CHANGELOG.md +++ b/crates/bytecode/CHANGELOG.md @@ -0,0 +1,83 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0](https://github.com/mrLSD/revm/releases/tag/revm-bytecode-v1.0.0) - 2024-12-27 + +### Added + +- *(database)* implement order-independent equality for Reverts (#1827) +- Restucturing Part7 Handler and Context rework (#1865) +- restructuring Part6 transaction crate (#1814) +- Merge validation/analyzis with Bytecode (#1793) +- restructure Part2 database crate (#1784) +- project restructuring Part1 (#1776) +- *(examples)* generate block traces (#895) +- implement EIP-4844 (#668) +- *(Shanghai)* All EIPs: push0, warm coinbase, limit/measure initcode (#376) +- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` (#239) +- Introduce ByteCode format, Update Readme (#156) + +### Fixed + +- fix typos ([#620](https://github.com/mrLSD/revm/pull/620)) + +### Other + +- fix comments and docs into more sensible (#1920) +- *(crates/bytecode)* fix some comments (#1851) +- some no_std cleanup (#1834) +- fix `constants` module typo (#1801) +- Bump new logo (#1735) +- *(README)* add rbuilder to used-by (#1585) +- added simular to used-by (#1521) +- add Trin to used by list (#1393) +- Fix typo in readme ([#1185](https://github.com/mrLSD/revm/pull/1185)) +- Add Hardhat to the "Used by" list ([#1164](https://github.com/mrLSD/revm/pull/1164)) +- Add VERBS to used by list ([#1141](https://github.com/mrLSD/revm/pull/1141)) +- license date and revm docs (#1080) +- *(docs)* Update the benchmark docs to point to revm package (#906) +- *(docs)* Update top-level benchmark docs (#894) +- clang requirement (#784) +- Readme Updates (#756) +- Logo (#743) +- book workflow ([#537](https://github.com/mrLSD/revm/pull/537)) +- add example to revm crate ([#468](https://github.com/mrLSD/revm/pull/468)) +- Update README.md ([#424](https://github.com/mrLSD/revm/pull/424)) +- add no_std to primitives ([#366](https://github.com/mrLSD/revm/pull/366)) +- revm-precompiles to revm-precompile +- Bump v20, changelog ([#350](https://github.com/mrLSD/revm/pull/350)) +- typos (#232) +- Add support for old forks. ([#191](https://github.com/mrLSD/revm/pull/191)) +- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/mrLSD/revm/pull/159)) +- typo fixes +- fix readme typo +- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/mrLSD/revm/pull/52)) +- readme. debuger update +- Bump revm v0.3.0. README updated +- readme +- Add time elapsed for tests +- readme updated +- Include Basefee into cost calc. readme change +- Initialize precompile accounts +- Status update. Taking a break +- Merkle calc. Tweaks and debugging for eip158 +- Replace aurora bn lib with parity's. All Bn128Add/Mul/Pair tests passes +- TEMP +- one tab removed +- readme +- README Example simplified +- Gas calculation for Call/Create. Example Added +- readme usage +- README changes +- Static gas cost added +- Subroutine changelogs and reverts +- Readme postulates +- Spelling +- Restructure project +- First iteration. Machine is looking okay diff --git a/crates/context/CHANGELOG.md b/crates/context/CHANGELOG.md index e69de29bb2..a291999886 100644 --- a/crates/context/CHANGELOG.md +++ b/crates/context/CHANGELOG.md @@ -0,0 +1,85 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0](https://github.com/mrLSD/revm/releases/tag/revm-context-v1.0.0) - 2024-12-27 + +### Added + +- expose precompile address in Journal, DB::Error: StdError (#1956) +- Make Ctx journal generic (#1933) +- Restucturing Part7 Handler and Context rework (#1865) +- restructuring Part6 transaction crate (#1814) +- *(examples)* generate block traces (#895) +- implement EIP-4844 (#668) +- *(Shanghai)* All EIPs: push0, warm coinbase, limit/measure initcode (#376) +- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` (#239) +- Introduce ByteCode format, Update Readme (#156) + +### Fixed + +- clear JournalState and set first journal vec (#1929) +- Clear journal (#1927) +- *(revme)* include correct bytecode for snailtracer (#1917) +- fix typos ([#620](https://github.com/mrLSD/revm/pull/620)) + +### Other + +- Merge branch 'main' of https://github.com/bluealloy/revm +- Make inspector use generics, rm associated types (#1934) +- fix comments and docs into more sensible (#1920) +- tie journal database with database getter (#1923) +- Move CfgEnv from context-interface to context crate (#1910) +- Bump new logo (#1735) +- *(README)* add rbuilder to used-by (#1585) +- added simular to used-by (#1521) +- add Trin to used by list (#1393) +- Fix typo in readme ([#1185](https://github.com/mrLSD/revm/pull/1185)) +- Add Hardhat to the "Used by" list ([#1164](https://github.com/mrLSD/revm/pull/1164)) +- Add VERBS to used by list ([#1141](https://github.com/mrLSD/revm/pull/1141)) +- license date and revm docs (#1080) +- *(docs)* Update the benchmark docs to point to revm package (#906) +- *(docs)* Update top-level benchmark docs (#894) +- clang requirement (#784) +- Readme Updates (#756) +- Logo (#743) +- book workflow ([#537](https://github.com/mrLSD/revm/pull/537)) +- add example to revm crate ([#468](https://github.com/mrLSD/revm/pull/468)) +- Update README.md ([#424](https://github.com/mrLSD/revm/pull/424)) +- add no_std to primitives ([#366](https://github.com/mrLSD/revm/pull/366)) +- revm-precompiles to revm-precompile +- Bump v20, changelog ([#350](https://github.com/mrLSD/revm/pull/350)) +- typos (#232) +- Add support for old forks. ([#191](https://github.com/mrLSD/revm/pull/191)) +- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/mrLSD/revm/pull/159)) +- typo fixes +- fix readme typo +- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/mrLSD/revm/pull/52)) +- readme. debuger update +- Bump revm v0.3.0. README updated +- readme +- Add time elapsed for tests +- readme updated +- Include Basefee into cost calc. readme change +- Initialize precompile accounts +- Status update. Taking a break +- Merkle calc. Tweaks and debugging for eip158 +- Replace aurora bn lib with parity's. All Bn128Add/Mul/Pair tests passes +- TEMP +- one tab removed +- readme +- README Example simplified +- Gas calculation for Call/Create. Example Added +- readme usage +- README changes +- Static gas cost added +- Subroutine changelogs and reverts +- Readme postulates +- Spelling +- Restructure project +- First iteration. Machine is looking okay diff --git a/crates/context/interface/CHANGELOG.md b/crates/context/interface/CHANGELOG.md index e69de29bb2..33802f9a38 100644 --- a/crates/context/interface/CHANGELOG.md +++ b/crates/context/interface/CHANGELOG.md @@ -0,0 +1,81 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0](https://github.com/mrLSD/revm/releases/tag/revm-context-interface-v1.0.0) - 2024-12-27 + +### Added + +- expose precompile address in Journal, DB::Error: StdError (#1956) +- Make Ctx journal generic (#1933) +- Restucturing Part7 Handler and Context rework (#1865) +- *(examples)* generate block traces (#895) +- implement EIP-4844 (#668) +- *(Shanghai)* All EIPs: push0, warm coinbase, limit/measure initcode (#376) +- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` (#239) +- Introduce ByteCode format, Update Readme (#156) + +### Fixed + +- Clear journal (#1927) +- fix typos ([#620](https://github.com/mrLSD/revm/pull/620)) + +### Other + +- Make inspector use generics, rm associated types (#1934) +- fix comments and docs into more sensible (#1920) +- tie journal database with database getter (#1923) +- Move CfgEnv from context-interface to context crate (#1910) +- Bump new logo (#1735) +- *(README)* add rbuilder to used-by (#1585) +- added simular to used-by (#1521) +- add Trin to used by list (#1393) +- Fix typo in readme ([#1185](https://github.com/mrLSD/revm/pull/1185)) +- Add Hardhat to the "Used by" list ([#1164](https://github.com/mrLSD/revm/pull/1164)) +- Add VERBS to used by list ([#1141](https://github.com/mrLSD/revm/pull/1141)) +- license date and revm docs (#1080) +- *(docs)* Update the benchmark docs to point to revm package (#906) +- *(docs)* Update top-level benchmark docs (#894) +- clang requirement (#784) +- Readme Updates (#756) +- Logo (#743) +- book workflow ([#537](https://github.com/mrLSD/revm/pull/537)) +- add example to revm crate ([#468](https://github.com/mrLSD/revm/pull/468)) +- Update README.md ([#424](https://github.com/mrLSD/revm/pull/424)) +- add no_std to primitives ([#366](https://github.com/mrLSD/revm/pull/366)) +- revm-precompiles to revm-precompile +- Bump v20, changelog ([#350](https://github.com/mrLSD/revm/pull/350)) +- typos (#232) +- Add support for old forks. ([#191](https://github.com/mrLSD/revm/pull/191)) +- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/mrLSD/revm/pull/159)) +- typo fixes +- fix readme typo +- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/mrLSD/revm/pull/52)) +- readme. debuger update +- Bump revm v0.3.0. README updated +- readme +- Add time elapsed for tests +- readme updated +- Include Basefee into cost calc. readme change +- Initialize precompile accounts +- Status update. Taking a break +- Merkle calc. Tweaks and debugging for eip158 +- Replace aurora bn lib with parity's. All Bn128Add/Mul/Pair tests passes +- TEMP +- one tab removed +- readme +- README Example simplified +- Gas calculation for Call/Create. Example Added +- readme usage +- README changes +- Static gas cost added +- Subroutine changelogs and reverts +- Readme postulates +- Spelling +- Restructure project +- First iteration. Machine is looking okay diff --git a/crates/context/src/journaled_state.rs b/crates/context/src/journaled_state.rs index 9926f3a098..b529da4f0f 100644 --- a/crates/context/src/journaled_state.rs +++ b/crates/context/src/journaled_state.rs @@ -760,6 +760,8 @@ impl JournaledState { if let Some(Bytecode::Eip7702(code)) = &account.info.code { let address = code.address(); let delegate_account = self.load_account(address)?; + // TODOFEE + println!("## load delegate_account [{address:?}]: {delegate_account:?}"); account_load .load .set_delegate_load(delegate_account.is_cold); diff --git a/crates/database/CHANGELOG.md b/crates/database/CHANGELOG.md index e69de29bb2..dd3d0d4ba5 100644 --- a/crates/database/CHANGELOG.md +++ b/crates/database/CHANGELOG.md @@ -0,0 +1,86 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0](https://github.com/mrLSD/revm/releases/tag/revm-database-v1.0.0) - 2024-12-27 + +### Added + +- expose precompile address in Journal, DB::Error: StdError (#1956) +- integrate codspeed (#1935) +- *(database)* implement order-independent equality for Reverts (#1827) +- couple convenience functions for nested cache dbs (#1852) +- Restucturing Part7 Handler and Context rework (#1865) +- add support for async database (#1809) +- restructure Part2 database crate (#1784) +- *(examples)* generate block traces (#895) +- implement EIP-4844 (#668) +- *(Shanghai)* All EIPs: push0, warm coinbase, limit/measure initcode (#376) +- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` (#239) +- Introduce ByteCode format, Update Readme (#156) + +### Fixed + +- fix typos ([#620](https://github.com/mrLSD/revm/pull/620)) + +### Other + +- fix comments and docs into more sensible (#1920) +- bumps select alloy crates to 0.6 (#1854) +- *(TransitionAccount)* remove unneeded clone (#1860) +- *(CacheAccount)* remove unneeded clone (#1859) +- bump alloy to 0.4.2 (#1817) +- *(primitives)* replace HashMap re-exports with alloy_primitives::map (#1805) +- Bump new logo (#1735) +- *(README)* add rbuilder to used-by (#1585) +- added simular to used-by (#1521) +- add Trin to used by list (#1393) +- Fix typo in readme ([#1185](https://github.com/mrLSD/revm/pull/1185)) +- Add Hardhat to the "Used by" list ([#1164](https://github.com/mrLSD/revm/pull/1164)) +- Add VERBS to used by list ([#1141](https://github.com/mrLSD/revm/pull/1141)) +- license date and revm docs (#1080) +- *(docs)* Update the benchmark docs to point to revm package (#906) +- *(docs)* Update top-level benchmark docs (#894) +- clang requirement (#784) +- Readme Updates (#756) +- Logo (#743) +- book workflow ([#537](https://github.com/mrLSD/revm/pull/537)) +- add example to revm crate ([#468](https://github.com/mrLSD/revm/pull/468)) +- Update README.md ([#424](https://github.com/mrLSD/revm/pull/424)) +- add no_std to primitives ([#366](https://github.com/mrLSD/revm/pull/366)) +- revm-precompiles to revm-precompile +- Bump v20, changelog ([#350](https://github.com/mrLSD/revm/pull/350)) +- typos (#232) +- Add support for old forks. ([#191](https://github.com/mrLSD/revm/pull/191)) +- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/mrLSD/revm/pull/159)) +- typo fixes +- fix readme typo +- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/mrLSD/revm/pull/52)) +- readme. debuger update +- Bump revm v0.3.0. README updated +- readme +- Add time elapsed for tests +- readme updated +- Include Basefee into cost calc. readme change +- Initialize precompile accounts +- Status update. Taking a break +- Merkle calc. Tweaks and debugging for eip158 +- Replace aurora bn lib with parity's. All Bn128Add/Mul/Pair tests passes +- TEMP +- one tab removed +- readme +- README Example simplified +- Gas calculation for Call/Create. Example Added +- readme usage +- README changes +- Static gas cost added +- Subroutine changelogs and reverts +- Readme postulates +- Spelling +- Restructure project +- First iteration. Machine is looking okay diff --git a/crates/database/interface/CHANGELOG.md b/crates/database/interface/CHANGELOG.md index e69de29bb2..89f3a4962a 100644 --- a/crates/database/interface/CHANGELOG.md +++ b/crates/database/interface/CHANGELOG.md @@ -0,0 +1,81 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0](https://github.com/mrLSD/revm/releases/tag/revm-database-interface-v1.0.0) - 2024-12-27 + +### Added + +- expose precompile address in Journal, DB::Error: StdError (#1956) +- integrate codspeed (#1935) +- Restucturing Part7 Handler and Context rework (#1865) +- add support for async database (#1809) +- restructure Part2 database crate (#1784) +- project restructuring Part1 (#1776) +- *(examples)* generate block traces (#895) +- implement EIP-4844 (#668) +- *(Shanghai)* All EIPs: push0, warm coinbase, limit/measure initcode (#376) +- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` (#239) +- Introduce ByteCode format, Update Readme (#156) + +### Fixed + +- fix typos ([#620](https://github.com/mrLSD/revm/pull/620)) + +### Other + +- Make inspector use generics, rm associated types (#1934) +- fix comments and docs into more sensible (#1920) +- Bump new logo (#1735) +- *(README)* add rbuilder to used-by (#1585) +- added simular to used-by (#1521) +- add Trin to used by list (#1393) +- Fix typo in readme ([#1185](https://github.com/mrLSD/revm/pull/1185)) +- Add Hardhat to the "Used by" list ([#1164](https://github.com/mrLSD/revm/pull/1164)) +- Add VERBS to used by list ([#1141](https://github.com/mrLSD/revm/pull/1141)) +- license date and revm docs (#1080) +- *(docs)* Update the benchmark docs to point to revm package (#906) +- *(docs)* Update top-level benchmark docs (#894) +- clang requirement (#784) +- Readme Updates (#756) +- Logo (#743) +- book workflow ([#537](https://github.com/mrLSD/revm/pull/537)) +- add example to revm crate ([#468](https://github.com/mrLSD/revm/pull/468)) +- Update README.md ([#424](https://github.com/mrLSD/revm/pull/424)) +- add no_std to primitives ([#366](https://github.com/mrLSD/revm/pull/366)) +- revm-precompiles to revm-precompile +- Bump v20, changelog ([#350](https://github.com/mrLSD/revm/pull/350)) +- typos (#232) +- Add support for old forks. ([#191](https://github.com/mrLSD/revm/pull/191)) +- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/mrLSD/revm/pull/159)) +- typo fixes +- fix readme typo +- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/mrLSD/revm/pull/52)) +- readme. debuger update +- Bump revm v0.3.0. README updated +- readme +- Add time elapsed for tests +- readme updated +- Include Basefee into cost calc. readme change +- Initialize precompile accounts +- Status update. Taking a break +- Merkle calc. Tweaks and debugging for eip158 +- Replace aurora bn lib with parity's. All Bn128Add/Mul/Pair tests passes +- TEMP +- one tab removed +- readme +- README Example simplified +- Gas calculation for Call/Create. Example Added +- readme usage +- README changes +- Static gas cost added +- Subroutine changelogs and reverts +- Readme postulates +- Spelling +- Restructure project +- First iteration. Machine is looking okay diff --git a/crates/database/src/states/cache_account.rs b/crates/database/src/states/cache_account.rs index 822ecc31fb..c47c37351f 100644 --- a/crates/database/src/states/cache_account.rs +++ b/crates/database/src/states/cache_account.rs @@ -289,6 +289,7 @@ impl CacheAccount { }; this_storage.extend(storage.iter().map(|(k, s)| (*k, s.present_value))); + let changed_account = PlainAccount { info: new, storage: this_storage, diff --git a/crates/handler/CHANGELOG.md b/crates/handler/CHANGELOG.md index e69de29bb2..33e9175a30 100644 --- a/crates/handler/CHANGELOG.md +++ b/crates/handler/CHANGELOG.md @@ -0,0 +1,80 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0](https://github.com/mrLSD/revm/releases/tag/revm-handler-v1.0.0) - 2024-12-27 + +### Added + +- expose precompile address in Journal, DB::Error: StdError (#1956) +- Make Ctx journal generic (#1933) +- removed create address collision check (#1928) +- Restucturing Part7 Handler and Context rework (#1865) +- *(examples)* generate block traces (#895) +- implement EIP-4844 (#668) +- *(Shanghai)* All EIPs: push0, warm coinbase, limit/measure initcode (#376) +- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` (#239) +- Introduce ByteCode format, Update Readme (#156) + +### Fixed + +- fix typos ([#620](https://github.com/mrLSD/revm/pull/620)) + +### Other + +- Make inspector use generics, rm associated types (#1934) +- fix comments and docs into more sensible (#1920) +- Rename PRAGUE_EOF to OSAKA (#1903) +- Bump new logo (#1735) +- *(README)* add rbuilder to used-by (#1585) +- added simular to used-by (#1521) +- add Trin to used by list (#1393) +- Fix typo in readme ([#1185](https://github.com/mrLSD/revm/pull/1185)) +- Add Hardhat to the "Used by" list ([#1164](https://github.com/mrLSD/revm/pull/1164)) +- Add VERBS to used by list ([#1141](https://github.com/mrLSD/revm/pull/1141)) +- license date and revm docs (#1080) +- *(docs)* Update the benchmark docs to point to revm package (#906) +- *(docs)* Update top-level benchmark docs (#894) +- clang requirement (#784) +- Readme Updates (#756) +- Logo (#743) +- book workflow ([#537](https://github.com/mrLSD/revm/pull/537)) +- add example to revm crate ([#468](https://github.com/mrLSD/revm/pull/468)) +- Update README.md ([#424](https://github.com/mrLSD/revm/pull/424)) +- add no_std to primitives ([#366](https://github.com/mrLSD/revm/pull/366)) +- revm-precompiles to revm-precompile +- Bump v20, changelog ([#350](https://github.com/mrLSD/revm/pull/350)) +- typos (#232) +- Add support for old forks. ([#191](https://github.com/mrLSD/revm/pull/191)) +- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/mrLSD/revm/pull/159)) +- typo fixes +- fix readme typo +- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/mrLSD/revm/pull/52)) +- readme. debuger update +- Bump revm v0.3.0. README updated +- readme +- Add time elapsed for tests +- readme updated +- Include Basefee into cost calc. readme change +- Initialize precompile accounts +- Status update. Taking a break +- Merkle calc. Tweaks and debugging for eip158 +- Replace aurora bn lib with parity's. All Bn128Add/Mul/Pair tests passes +- TEMP +- one tab removed +- readme +- README Example simplified +- Gas calculation for Call/Create. Example Added +- readme usage +- README changes +- Static gas cost added +- Subroutine changelogs and reverts +- Readme postulates +- Spelling +- Restructure project +- First iteration. Machine is looking okay diff --git a/crates/handler/interface/CHANGELOG.md b/crates/handler/interface/CHANGELOG.md index e69de29bb2..63fff56cb6 100644 --- a/crates/handler/interface/CHANGELOG.md +++ b/crates/handler/interface/CHANGELOG.md @@ -0,0 +1,76 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0](https://github.com/mrLSD/revm/releases/tag/revm-handler-interface-v1.0.0) - 2024-12-27 + +### Added + +- expose precompile address in Journal, DB::Error: StdError (#1956) +- Restucturing Part7 Handler and Context rework (#1865) +- *(examples)* generate block traces (#895) +- implement EIP-4844 (#668) +- *(Shanghai)* All EIPs: push0, warm coinbase, limit/measure initcode (#376) +- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` (#239) +- Introduce ByteCode format, Update Readme (#156) + +### Fixed + +- fix typos ([#620](https://github.com/mrLSD/revm/pull/620)) + +### Other + +- fix comments and docs into more sensible (#1920) +- Bump new logo (#1735) +- *(README)* add rbuilder to used-by (#1585) +- added simular to used-by (#1521) +- add Trin to used by list (#1393) +- Fix typo in readme ([#1185](https://github.com/mrLSD/revm/pull/1185)) +- Add Hardhat to the "Used by" list ([#1164](https://github.com/mrLSD/revm/pull/1164)) +- Add VERBS to used by list ([#1141](https://github.com/mrLSD/revm/pull/1141)) +- license date and revm docs (#1080) +- *(docs)* Update the benchmark docs to point to revm package (#906) +- *(docs)* Update top-level benchmark docs (#894) +- clang requirement (#784) +- Readme Updates (#756) +- Logo (#743) +- book workflow ([#537](https://github.com/mrLSD/revm/pull/537)) +- add example to revm crate ([#468](https://github.com/mrLSD/revm/pull/468)) +- Update README.md ([#424](https://github.com/mrLSD/revm/pull/424)) +- add no_std to primitives ([#366](https://github.com/mrLSD/revm/pull/366)) +- revm-precompiles to revm-precompile +- Bump v20, changelog ([#350](https://github.com/mrLSD/revm/pull/350)) +- typos (#232) +- Add support for old forks. ([#191](https://github.com/mrLSD/revm/pull/191)) +- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/mrLSD/revm/pull/159)) +- typo fixes +- fix readme typo +- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/mrLSD/revm/pull/52)) +- readme. debuger update +- Bump revm v0.3.0. README updated +- readme +- Add time elapsed for tests +- readme updated +- Include Basefee into cost calc. readme change +- Initialize precompile accounts +- Status update. Taking a break +- Merkle calc. Tweaks and debugging for eip158 +- Replace aurora bn lib with parity's. All Bn128Add/Mul/Pair tests passes +- TEMP +- one tab removed +- readme +- README Example simplified +- Gas calculation for Call/Create. Example Added +- readme usage +- README changes +- Static gas cost added +- Subroutine changelogs and reverts +- Readme postulates +- Spelling +- Restructure project +- First iteration. Machine is looking okay diff --git a/crates/inspector/CHANGELOG.md b/crates/inspector/CHANGELOG.md index e69de29bb2..9351b462cf 100644 --- a/crates/inspector/CHANGELOG.md +++ b/crates/inspector/CHANGELOG.md @@ -0,0 +1,87 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0](https://github.com/mrLSD/revm/releases/tag/revm-inspector-v1.0.0) - 2024-12-27 + +### Added + +- expose precompile address in Journal, DB::Error: StdError (#1956) +- Make Ctx journal generic (#1933) +- Restucturing Part7 Handler and Context rework (#1865) +- restructuring Part6 transaction crate (#1814) +- Merge validation/analyzis with Bytecode (#1793) +- Restructuring Part3 inspector crate (#1788) +- restructure Part2 database crate (#1784) +- project restructuring Part1 (#1776) +- *(examples)* generate block traces (#895) +- implement EIP-4844 (#668) +- *(Shanghai)* All EIPs: push0, warm coinbase, limit/measure initcode (#376) +- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` (#239) +- Introduce ByteCode format, Update Readme (#156) + +### Fixed + +- Clear journal (#1927) +- fix typos ([#620](https://github.com/mrLSD/revm/pull/620)) + +### Other + +- Make inspector use generics, rm associated types (#1934) +- fix comments and docs into more sensible (#1920) +- add depth to GasInspector (#1922) +- Simplify GasInspector (#1919) +- Move CfgEnv from context-interface to context crate (#1910) +- Bump new logo (#1735) +- *(README)* add rbuilder to used-by (#1585) +- added simular to used-by (#1521) +- add Trin to used by list (#1393) +- Fix typo in readme ([#1185](https://github.com/mrLSD/revm/pull/1185)) +- Add Hardhat to the "Used by" list ([#1164](https://github.com/mrLSD/revm/pull/1164)) +- Add VERBS to used by list ([#1141](https://github.com/mrLSD/revm/pull/1141)) +- license date and revm docs (#1080) +- *(docs)* Update the benchmark docs to point to revm package (#906) +- *(docs)* Update top-level benchmark docs (#894) +- clang requirement (#784) +- Readme Updates (#756) +- Logo (#743) +- book workflow ([#537](https://github.com/mrLSD/revm/pull/537)) +- add example to revm crate ([#468](https://github.com/mrLSD/revm/pull/468)) +- Update README.md ([#424](https://github.com/mrLSD/revm/pull/424)) +- add no_std to primitives ([#366](https://github.com/mrLSD/revm/pull/366)) +- revm-precompiles to revm-precompile +- Bump v20, changelog ([#350](https://github.com/mrLSD/revm/pull/350)) +- typos (#232) +- Add support for old forks. ([#191](https://github.com/mrLSD/revm/pull/191)) +- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/mrLSD/revm/pull/159)) +- typo fixes +- fix readme typo +- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/mrLSD/revm/pull/52)) +- readme. debuger update +- Bump revm v0.3.0. README updated +- readme +- Add time elapsed for tests +- readme updated +- Include Basefee into cost calc. readme change +- Initialize precompile accounts +- Status update. Taking a break +- Merkle calc. Tweaks and debugging for eip158 +- Replace aurora bn lib with parity's. All Bn128Add/Mul/Pair tests passes +- TEMP +- one tab removed +- readme +- README Example simplified +- Gas calculation for Call/Create. Example Added +- readme usage +- README changes +- Static gas cost added +- Subroutine changelogs and reverts +- Readme postulates +- Spelling +- Restructure project +- First iteration. Machine is looking okay diff --git a/crates/interpreter/src/gas.rs b/crates/interpreter/src/gas.rs index e3295cfe2b..9c5dba66e1 100644 --- a/crates/interpreter/src/gas.rs +++ b/crates/interpreter/src/gas.rs @@ -99,6 +99,8 @@ impl Gas { /// at the end of transact. #[inline] pub fn record_refund(&mut self, refund: i64) { + // TODOFEE + println!("\trecord_refund: {}", refund); self.refunded += refund; } @@ -130,6 +132,8 @@ impl Gas { if success { self.remaining = remaining; } + // TODOFEE + println!("\t# record_cost: {cost} [{} | {remaining}]", self.spent()); success } diff --git a/crates/interpreter/src/gas/calc.rs b/crates/interpreter/src/gas/calc.rs index 8bdee00324..f8ad5f1b6b 100644 --- a/crates/interpreter/src/gas/calc.rs +++ b/crates/interpreter/src/gas/calc.rs @@ -196,6 +196,8 @@ pub fn sstore_cost(spec_id: SpecId, vals: &SStoreResult, is_cold: bool) -> u64 { if is_cold { gas_cost += COLD_SLOAD_COST; } + // TODOFEE + println!("=====> {gas_cost} [{is_cold}]"); gas_cost } else if spec_id.is_enabled_in(SpecId::ISTANBUL) { // Istanbul logic @@ -285,7 +287,7 @@ pub const fn selfdestruct_cost(spec_id: SpecId, res: StateLoad u64 { +pub fn call_cost(spec_id: SpecId, transfers_value: bool, account_load: AccountLoad) -> u64 { // Account access. let mut gas = if spec_id.is_enabled_in(SpecId::BERLIN) { warm_cold_cost_with_delegation(account_load.load) diff --git a/crates/interpreter/src/instructions/host.rs b/crates/interpreter/src/instructions/host.rs index b3b8a69d3e..bcf05cfafc 100644 --- a/crates/interpreter/src/instructions/host.rs +++ b/crates/interpreter/src/instructions/host.rs @@ -68,7 +68,10 @@ pub fn extcodesize( .set_instruction_result(InstructionResult::FatalExternalError); return; }; + println!("extcodesize: {address:?}"); + println!("load: {code:?}"); let (code, load) = code.into_components(); + println!("code: [{}] {code:X?}", code.len()); let spec_id = interpreter.runtime_flag.spec_id(); if spec_id.is_enabled_in(BERLIN) { gas!(interpreter, warm_cold_cost_with_delegation(load)); @@ -96,6 +99,7 @@ pub fn extcodehash( return; }; let (code_hash, load) = code_hash.into_components(); + println!("@ {address:?}: {code_hash:?}"); let spec_id = interpreter.runtime_flag.spec_id(); if spec_id.is_enabled_in(BERLIN) { gas!(interpreter, warm_cold_cost_with_delegation(load)) @@ -104,6 +108,7 @@ pub fn extcodehash( } else { gas!(interpreter, 400); } + println!("PUSH: {code_hash:?}"); *top = code_hash.into(); } @@ -119,6 +124,7 @@ pub fn extcodecopy( .set_instruction_result(InstructionResult::FatalExternalError); return; }; + println!("extcodecopy: {address:?}: {memory_offset:?} {code_offset:?} {len_u256:?}"); let len = as_usize_or_fail!(interpreter, len_u256); let (code, load) = code.into_components(); @@ -126,6 +132,7 @@ pub fn extcodecopy( interpreter, gas::extcodecopy_cost(interpreter.runtime_flag.spec_id(), len, load) ); + println!("EXT: {len} {code:X?}"); if len == 0 { return; } @@ -181,6 +188,10 @@ pub fn sstore( require_non_staticcall!(interpreter); popn!([index, value], interpreter); + print!( + "##### SSTORE [{index:?}]: {:X?} ", + value.to_be_bytes::<32>() + ); let Some(state_load) = host.sstore(interpreter.input.target_address(), index, value) else { interpreter .control diff --git a/crates/interpreter/src/interpreter.rs b/crates/interpreter/src/interpreter.rs index c43216df3b..0853a5391d 100644 --- a/crates/interpreter/src/interpreter.rs +++ b/crates/interpreter/src/interpreter.rs @@ -160,6 +160,8 @@ impl Interpreter { { // Get current opcode. let opcode = self.bytecode.opcode(); + // TODOFEE + println!("OPCODE({})", bytecode::opcode::OpCode::new(opcode).unwrap()); // SAFETY: In analysis we are doing padding of bytecode so that we are sure that last // byte instruction is STOP so we are safe to just increment program_counter bcs on last instruction diff --git a/crates/optimism/CHANGELOG.md b/crates/optimism/CHANGELOG.md index e69de29bb2..891f403543 100644 --- a/crates/optimism/CHANGELOG.md +++ b/crates/optimism/CHANGELOG.md @@ -0,0 +1,92 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0](https://github.com/mrLSD/revm/releases/tag/revm-optimism-v1.0.0) - 2024-12-27 + +### Added + +- expose precompile address in Journal, DB::Error: StdError (#1956) +- add isthmus spec (#1938) +- integrate codspeed (#1935) +- Make Ctx journal generic (#1933) +- Restucturing Part7 Handler and Context rework (#1865) +- restructuring Part6 transaction crate (#1814) +- Restructuring Part3 inspector crate (#1788) +- restructure Part2 database crate (#1784) +- project restructuring Part1 (#1776) +- introducing EvmWiring, a chain-specific configuration (#1672) +- *(examples)* generate block traces (#895) +- implement EIP-4844 (#668) +- *(Shanghai)* All EIPs: push0, warm coinbase, limit/measure initcode (#376) +- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` (#239) +- Introduce ByteCode format, Update Readme (#156) + +### Fixed + +- make macro crate-agnostic (#1802) +- fix typos ([#620](https://github.com/mrLSD/revm/pull/620)) + +### Other + +- Make inspector use generics, rm associated types (#1934) +- add OpTransaction conversion tests (#1939) +- fix comments and docs into more sensible (#1920) +- Rename PRAGUE_EOF to OSAKA (#1903) +- refactor L1BlockInfo::tx_estimated_size_fjord (#1856) +- *(primitives)* replace HashMap re-exports with alloy_primitives::map (#1805) +- Test for l1 gas used and l1 fee for ecotone tx (#1748) +- *(deps)* bump anyhow from 1.0.88 to 1.0.89 (#1772) +- Bump new logo (#1735) +- *(README)* add rbuilder to used-by (#1585) +- added simular to used-by (#1521) +- add Trin to used by list (#1393) +- Fix typo in readme ([#1185](https://github.com/mrLSD/revm/pull/1185)) +- Add Hardhat to the "Used by" list ([#1164](https://github.com/mrLSD/revm/pull/1164)) +- Add VERBS to used by list ([#1141](https://github.com/mrLSD/revm/pull/1141)) +- license date and revm docs (#1080) +- *(docs)* Update the benchmark docs to point to revm package (#906) +- *(docs)* Update top-level benchmark docs (#894) +- clang requirement (#784) +- Readme Updates (#756) +- Logo (#743) +- book workflow ([#537](https://github.com/mrLSD/revm/pull/537)) +- add example to revm crate ([#468](https://github.com/mrLSD/revm/pull/468)) +- Update README.md ([#424](https://github.com/mrLSD/revm/pull/424)) +- add no_std to primitives ([#366](https://github.com/mrLSD/revm/pull/366)) +- revm-precompiles to revm-precompile +- Bump v20, changelog ([#350](https://github.com/mrLSD/revm/pull/350)) +- typos (#232) +- Add support for old forks. ([#191](https://github.com/mrLSD/revm/pull/191)) +- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/mrLSD/revm/pull/159)) +- typo fixes +- fix readme typo +- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/mrLSD/revm/pull/52)) +- readme. debuger update +- Bump revm v0.3.0. README updated +- readme +- Add time elapsed for tests +- readme updated +- Include Basefee into cost calc. readme change +- Initialize precompile accounts +- Status update. Taking a break +- Merkle calc. Tweaks and debugging for eip158 +- Replace aurora bn lib with parity's. All Bn128Add/Mul/Pair tests passes +- TEMP +- one tab removed +- readme +- README Example simplified +- Gas calculation for Call/Create. Example Added +- readme usage +- README changes +- Static gas cost added +- Subroutine changelogs and reverts +- Readme postulates +- Spelling +- Restructure project +- First iteration. Machine is looking okay diff --git a/crates/precompile/src/lib.rs b/crates/precompile/src/lib.rs index 91053c921d..eef5ce07f3 100644 --- a/crates/precompile/src/lib.rs +++ b/crates/precompile/src/lib.rs @@ -172,6 +172,14 @@ impl Precompiles { precompiles }; + for p in bls12_381::precompiles() { + println!("PREC: {:?}", p); + } + println!("==="); + for p in &precompiles.addresses { + println!("PREC: {:?}", p); + } + Box::new(precompiles) }) } diff --git a/crates/revm/src/context/inner_evm_context.rs b/crates/revm/src/context/inner_evm_context.rs new file mode 100644 index 0000000000..9d7ecaf5a3 --- /dev/null +++ b/crates/revm/src/context/inner_evm_context.rs @@ -0,0 +1,440 @@ +use crate::{journaled_state::JournaledState, JournalCheckpoint}; +use bytecode::{Bytecode, Eof, EOF_MAGIC_BYTES, EOF_MAGIC_HASH}; +use database_interface::Database; +use derive_where::derive_where; +use interpreter::{ + gas, return_ok, AccountLoad, Eip7702CodeLoad, InstructionResult, InterpreterResult, + SStoreResult, SelfDestructResult, StateLoad, +}; +use primitives::{Address, Bytes, HashSet, B256, U256}; +use specification::hardfork::{ + Spec, + SpecId::{self, *}, +}; +use state::Account; +use std::{boxed::Box, sync::Arc}; +use transaction::AccessListTrait; +use wiring::{ + default::{AnalysisKind, CfgEnv, EnvWiring}, + EvmWiring, Transaction, +}; + +/// EVM contexts contains data that EVM needs for execution. +#[derive_where(Clone, Debug; EvmWiringT::Block, EvmWiringT::ChainContext, EvmWiringT::Transaction, EvmWiringT::Database, ::Error +)] +pub struct InnerEvmContext { + /// EVM Environment contains all the information about config, block and transaction that + /// evm needs. + pub env: Box>, + /// EVM State with journaling support. + pub journaled_state: JournaledState, + /// Database to load data from. + pub db: EvmWiringT::Database, + /// Inner context. + pub chain: EvmWiringT::ChainContext, + /// Error that happened during execution. + pub error: Result<(), ::Error>, +} + +impl InnerEvmContext +where + EvmWiringT: EvmWiring, +{ + pub fn new(db: EvmWiringT::Database) -> Self { + Self { + env: Box::default(), + journaled_state: JournaledState::new(SpecId::LATEST, HashSet::default()), + db, + chain: Default::default(), + error: Ok(()), + } + } +} + +impl InnerEvmContext { + /// Creates a new context with the given environment and database. + #[inline] + pub fn new_with_env(db: EvmWiringT::Database, env: Box>) -> Self { + Self { + env, + journaled_state: JournaledState::new(SpecId::LATEST, HashSet::default()), + db, + chain: Default::default(), + error: Ok(()), + } + } + + /// Sets the database. + /// + /// Note that this will ignore the previous `error` if set. + #[inline] + pub fn with_db< + OWiring: EvmWiring, + >( + self, + db: OWiring::Database, + ) -> InnerEvmContext { + InnerEvmContext { + env: self.env, + journaled_state: self.journaled_state, + db, + chain: Default::default(), + error: Ok(()), + } + } + + /// Returns the configured EVM spec ID. + #[inline] + pub const fn spec_id(&self) -> SpecId { + self.journaled_state.spec + } + + /// Load access list for berlin hard fork. + /// + /// Loading of accounts/storages is needed to make them warm. + #[inline] + pub fn load_access_list(&mut self) -> Result<(), ::Error> { + let Some(access_list) = self.env.tx.access_list() else { + return Ok(()); + }; + + for access_list in access_list.iter() { + self.journaled_state.initial_account_load( + access_list.0, + access_list.1.map(|i| U256::from_be_bytes(i.0)), + &mut self.db, + )?; + } + Ok(()) + } + + /// Return environment. + #[inline] + pub fn env(&mut self) -> &mut EnvWiring { + &mut self.env + } + + /// Returns reference to [`CfgEnv`]. + pub fn cfg(&self) -> &CfgEnv { + &self.env.cfg + } + + /// Returns the error by replacing it with `Ok(())`, if any. + #[inline] + pub fn take_error(&mut self) -> Result<(), ::Error> { + core::mem::replace(&mut self.error, Ok(())) + } + + /// Fetch block hash from database. + #[inline] + pub fn block_hash( + &mut self, + number: u64, + ) -> Result::Error> { + self.db.block_hash(number) + } + + /// Mark account as touched as only touched accounts will be added to state. + #[inline] + pub fn touch(&mut self, address: &Address) { + self.journaled_state.touch(address); + } + + /// Loads an account into memory. Returns `true` if it is cold accessed. + #[inline] + pub fn load_account( + &mut self, + address: Address, + ) -> Result, ::Error> { + self.journaled_state.load_account(address, &mut self.db) + } + + /// Load account from database to JournaledState. + /// + /// Return boolean pair where first is `is_cold` second bool `exists`. + #[inline] + pub fn load_account_delegated( + &mut self, + address: Address, + ) -> Result::Error> { + self.journaled_state + .load_account_delegated(address, &mut self.db) + } + + /// Return account balance and is_cold flag. + #[inline] + pub fn balance( + &mut self, + address: Address, + ) -> Result, ::Error> { + self.journaled_state + .load_account(address, &mut self.db) + .map(|acc| acc.map(|a| a.info.balance)) + } + + /// Return account code bytes and if address is cold loaded. + /// + /// In case of EOF account it will return `EOF_MAGIC` (0xEF00) as code. + #[inline] + pub fn code( + &mut self, + address: Address, + ) -> Result, ::Error> { + let a = self.journaled_state.load_code(address, &mut self.db)?; + // SAFETY: safe to unwrap as load_code will insert code if it is empty. + let code = a.info.code.as_ref().unwrap(); + if code.is_eof() { + return Ok(Eip7702CodeLoad::new_not_delegated( + EOF_MAGIC_BYTES.clone(), + a.is_cold, + )); + } + + if let Bytecode::Eip7702(code) = code { + let address = code.address(); + let is_cold = a.is_cold; + // TODOFEE + println!("## CODE: {address:?} [{is_cold}]"); + + let delegated_account = self.journaled_state.load_code(address, &mut self.db)?; + + // SAFETY: safe to unwrap as load_code will insert code if it is empty. + let delegated_code = delegated_account.info.code.as_ref().unwrap(); + + let bytes = if delegated_code.is_eof() { + EOF_MAGIC_BYTES.clone() + } else { + delegated_code.original_bytes() + }; + + return Ok(Eip7702CodeLoad::new( + StateLoad::new(bytes, is_cold), + delegated_account.is_cold, + )); + } + + Ok(Eip7702CodeLoad::new_not_delegated( + code.original_bytes(), + a.is_cold, + )) + } + + /// Get code hash of address. + /// + /// In case of EOF account it will return `EOF_MAGIC_HASH` + /// (the hash of `0xEF00`). + #[inline] + pub fn code_hash( + &mut self, + address: Address, + ) -> Result, ::Error> { + let acc = self.journaled_state.load_code(address, &mut self.db)?; + if acc.is_empty() { + return Ok(Eip7702CodeLoad::new_not_delegated(B256::ZERO, acc.is_cold)); + } + // SAFETY: safe to unwrap as load_code will insert code if it is empty. + let code = acc.info.code.as_ref().unwrap(); + + // If bytecode is EIP-7702 then we need to load the delegated account. + println!("### code_hash for: {address:?}"); + if let Bytecode::Eip7702(code) = code { + let address = code.address(); + let is_cold = acc.is_cold; + // TODOFEE + println!("### code_hash delegated: {address:?} [{is_cold}]"); + + let delegated_account = self.journaled_state.load_code(address, &mut self.db)?; + println!("# codehash code: z{:X?}", delegated_account.info.code); + + let hash = if delegated_account.is_empty() { + B256::ZERO + } else if delegated_account.info.code.as_ref().unwrap().is_eof() { + EOF_MAGIC_HASH + } else { + delegated_account.info.code_hash + }; + + return Ok(Eip7702CodeLoad::new( + StateLoad::new(hash, is_cold), + delegated_account.is_cold, + )); + } + + let hash = if code.is_eof() { + EOF_MAGIC_HASH + } else { + acc.info.code_hash + }; + + Ok(Eip7702CodeLoad::new_not_delegated(hash, acc.is_cold)) + } + + /// Load storage slot, if storage is not present inside the account then it will be loaded from database. + #[inline] + pub fn sload( + &mut self, + address: Address, + index: U256, + ) -> Result, ::Error> { + // account is always warm. reference on that statement https://eips.ethereum.org/EIPS/eip-2929 see `Note 2:` + self.journaled_state.sload(address, index, &mut self.db) + } + + /// Storage change of storage slot, before storing `sload` will be called for that slot. + #[inline] + pub fn sstore( + &mut self, + address: Address, + index: U256, + value: U256, + ) -> Result, ::Error> { + self.journaled_state + .sstore(address, index, value, &mut self.db) + } + + /// Returns transient storage value. + #[inline] + pub fn tload(&mut self, address: Address, index: U256) -> U256 { + self.journaled_state.tload(address, index) + } + + /// Stores transient storage value. + #[inline] + pub fn tstore(&mut self, address: Address, index: U256, value: U256) { + self.journaled_state.tstore(address, index, value) + } + + /// Selfdestructs the account. + #[inline] + pub fn selfdestruct( + &mut self, + address: Address, + target: Address, + ) -> Result, ::Error> { + self.journaled_state + .selfdestruct(address, target, &mut self.db) + } + + /// If error is present revert changes, otherwise save EOF bytecode. + pub fn eofcreate_return( + &mut self, + interpreter_result: &mut InterpreterResult, + address: Address, + journal_checkpoint: JournalCheckpoint, + ) { + // Note we still execute RETURN opcode and return the bytes. + // In EOF those opcodes should abort execution. + // + // In RETURN gas is still protecting us from ddos and in oog, + // behaviour will be same as if it failed on return. + // + // Bytes of RETURN will drained in `insert_eofcreate_outcome`. + if interpreter_result.result != InstructionResult::ReturnContract { + self.journaled_state.checkpoint_revert(journal_checkpoint); + return; + } + + if interpreter_result.output.len() > self.cfg().max_code_size() { + self.journaled_state.checkpoint_revert(journal_checkpoint); + interpreter_result.result = InstructionResult::CreateContractSizeLimit; + return; + } + + // deduct gas for code deployment. + let gas_for_code = interpreter_result.output.len() as u64 * gas::CODEDEPOSIT; + if !interpreter_result.gas.record_cost(gas_for_code) { + self.journaled_state.checkpoint_revert(journal_checkpoint); + interpreter_result.result = InstructionResult::OutOfGas; + return; + } + + // commit changes reduces depth by -1. + self.journaled_state.checkpoint_commit(); + + // decode bytecode has a performance hit, but it has reasonable restrains. + let bytecode = + Eof::decode(interpreter_result.output.clone()).expect("Eof is already verified"); + + // eof bytecode is going to be hashed. + self.journaled_state + .set_code(address, Bytecode::Eof(Arc::new(bytecode))); + } + + /// Handles call return. + #[inline] + pub fn call_return( + &mut self, + interpreter_result: &InterpreterResult, + journal_checkpoint: JournalCheckpoint, + ) { + // revert changes or not. + if matches!(interpreter_result.result, return_ok!()) { + self.journaled_state.checkpoint_commit(); + } else { + self.journaled_state.checkpoint_revert(journal_checkpoint); + } + } + + /// Handles create return. + #[inline] + pub fn create_return( + &mut self, + interpreter_result: &mut InterpreterResult, + address: Address, + journal_checkpoint: JournalCheckpoint, + ) { + // if return is not ok revert and return. + if !matches!(interpreter_result.result, return_ok!()) { + self.journaled_state.checkpoint_revert(journal_checkpoint); + return; + } + // Host error if present on execution + // if ok, check contract creation limit and calculate gas deduction on output len. + // + // EIP-3541: Reject new contract code starting with the 0xEF byte + if SPEC::enabled(LONDON) && interpreter_result.output.first() == Some(&0xEF) { + self.journaled_state.checkpoint_revert(journal_checkpoint); + interpreter_result.result = InstructionResult::CreateContractStartingWithEF; + return; + } + + // EIP-170: Contract code size limit + // By default limit is 0x6000 (~25kb) + if SPEC::enabled(SPURIOUS_DRAGON) + && interpreter_result.output.len() > self.cfg().max_code_size() + { + self.journaled_state.checkpoint_revert(journal_checkpoint); + interpreter_result.result = InstructionResult::CreateContractSizeLimit; + return; + } + let gas_for_code = interpreter_result.output.len() as u64 * gas::CODEDEPOSIT; + if !interpreter_result.gas.record_cost(gas_for_code) { + // record code deposit gas cost and check if we are out of gas. + // EIP-2 point 3: If contract creation does not have enough gas to pay for the + // final gas fee for adding the contract code to the state, the contract + // creation fails (i.e. goes out-of-gas) rather than leaving an empty contract. + if SPEC::enabled(HOMESTEAD) { + self.journaled_state.checkpoint_revert(journal_checkpoint); + interpreter_result.result = InstructionResult::OutOfGas; + return; + } else { + interpreter_result.output = Bytes::new(); + } + } + // if we have enough gas we can commit changes. + self.journaled_state.checkpoint_commit(); + + // Do analysis of bytecode straight away. + let bytecode = match self.env.cfg.perf_analyse_created_bytecodes { + AnalysisKind::Raw => Bytecode::new_legacy(interpreter_result.output.clone()), + AnalysisKind::Analyse => { + Bytecode::new_legacy(interpreter_result.output.clone()).into_analyzed() + } + }; + + // set code + self.journaled_state.set_code(address, bytecode); + + interpreter_result.result = InstructionResult::Return; + } +} diff --git a/crates/revm/src/evm.rs b/crates/revm/src/evm.rs index af925f81a2..13650468e0 100644 --- a/crates/revm/src/evm.rs +++ b/crates/revm/src/evm.rs @@ -252,6 +252,7 @@ where pre_exec.deduct_caller(context)?; let gas_limit = context.tx().common_fields().gas_limit() - initial_gas_spend; + println!("{gas_limit} - {}", initial_gas_spend); // Apply EIP-7702 auth list. let eip7702_gas_refund = pre_exec.apply_eip7702_auth_list(context)? as i64; @@ -286,7 +287,6 @@ where #[cfg(test)] mod tests { - use super::*; use crate::{ handler::mainnet::{EthExecution, EthPostExecution, EthPreExecution, EthValidation}, diff --git a/crates/revm/src/handler/mainnet/pre_execution.rs b/crates/revm/src/handler/mainnet/pre_execution.rs new file mode 100644 index 0000000000..b3812a05ce --- /dev/null +++ b/crates/revm/src/handler/mainnet/pre_execution.rs @@ -0,0 +1,199 @@ +//! Handles related to the main function of the EVM. +//! +//! They handle initial setup of the EVM, call loop and the final return of the EVM + +use crate::{Context, ContextPrecompiles, EvmWiring, JournalEntry}; +use bytecode::Bytecode; +use precompile::PrecompileSpecId; +use primitives::{BLOCKHASH_STORAGE_ADDRESS, U256}; +use specification::{ + eip7702, + hardfork::{Spec, SpecId}, +}; +use state::Account; +use transaction::{eip7702::Authorization, Eip7702Tx}; +use wiring::{ + default::EnvWiring, + result::{EVMError, EVMResultGeneric}, + Block, Transaction, TransactionType, +}; + +/// Main precompile load +#[inline] +pub fn load_precompiles() -> ContextPrecompiles { + ContextPrecompiles::new(PrecompileSpecId::from_spec_id(SPEC::SPEC_ID)) +} + +/// Main load handle +#[inline] +pub fn load_accounts( + context: &mut Context, +) -> EVMResultGeneric<(), EvmWiringT> { + // set journaling state flag. + context.evm.journaled_state.set_spec_id(SPEC::SPEC_ID); + + // load coinbase + // EIP-3651: Warm COINBASE. Starts the `COINBASE` address warm + if SPEC::enabled(SpecId::SHANGHAI) { + let coinbase = *context.evm.inner.env.block.coinbase(); + context + .evm + .journaled_state + .warm_preloaded_addresses + .insert(coinbase); + } + + // Load blockhash storage address + // EIP-2935: Serve historical block hashes from state + if SPEC::enabled(SpecId::PRAGUE) { + context + .evm + .journaled_state + .warm_preloaded_addresses + .insert(BLOCKHASH_STORAGE_ADDRESS); + } + + // Load access list + context.evm.load_access_list().map_err(EVMError::Database)?; + Ok(()) +} + +/// Helper function that deducts the caller balance. +#[inline] +pub fn deduct_caller_inner( + caller_account: &mut Account, + env: &EnvWiring, +) { + // Subtract gas costs from the caller's account. + // We need to saturate the gas cost to prevent underflow in case that `disable_balance_check` is enabled. + let mut gas_cost = + U256::from(env.tx.common_fields().gas_limit()).saturating_mul(env.effective_gas_price()); + + // EIP-4844 + if let Some(data_fee) = env.calc_data_fee() { + gas_cost = gas_cost.saturating_add(data_fee); + } + + // set new caller account balance. + caller_account.info.balance = caller_account.info.balance.saturating_sub(gas_cost); + + // bump the nonce for calls. Nonce for CREATE will be bumped in `handle_create`. + if env.tx.kind().is_call() { + // Nonce is already checked + caller_account.info.nonce = caller_account.info.nonce.saturating_add(1); + } + + // touch account so we know it is changed. + caller_account.mark_touch(); +} + +/// Deducts the caller balance to the transaction limit. +#[inline] +pub fn deduct_caller( + context: &mut Context, +) -> EVMResultGeneric<(), EvmWiringT> { + let caller = context.evm.inner.env.tx.common_fields().caller(); + // load caller's account. + let caller_account = context + .evm + .inner + .journaled_state + .load_account(caller, &mut context.evm.inner.db) + .map_err(EVMError::Database)?; + + // deduct gas cost from caller's account. + deduct_caller_inner::(caller_account.data, &context.evm.inner.env); + + // Ensure tx kind is call + if context.evm.inner.env.tx.kind().is_call() { + // Push NonceChange entry + context + .evm + .inner + .journaled_state + .journal + .last_mut() + .unwrap() + .push(JournalEntry::NonceChange { address: caller }); + } + Ok(()) +} + +/// Apply EIP-7702 auth list and return number gas refund on already created accounts. +#[inline] +pub fn apply_eip7702_auth_list( + context: &mut Context, +) -> EVMResultGeneric { + // EIP-7702. Load bytecode to authorized accounts. + if !SPEC::enabled(SpecId::PRAGUE) { + return Ok(0); + } + + // return if there is no auth list. + let tx = &context.evm.inner.env.tx; + if tx.tx_type().into() != TransactionType::Eip7702 { + return Ok(0); + } + + //let authorization_list = tx.eip7702().authorization_list(); + + let mut refunded_accounts = 0; + for authorization in tx.eip7702().authorization_list_iter() { + // 1. recover authority and authorized addresses. + // authority = ecrecover(keccak(MAGIC || rlp([chain_id, address, nonce])), y_parity, r, s] + let Some(authority) = authorization.authority() else { + continue; + }; + + // 2. Verify the chain id is either 0 or the chain's current ID. + if !authorization.chain_id().is_zero() + && authorization.chain_id() != U256::from(context.evm.inner.env.cfg.chain_id) + { + continue; + } + + // warm authority account and check nonce. + // 3. Add authority to accessed_addresses (as defined in EIP-2929.) + let mut authority_acc = context + .evm + .inner + .journaled_state + .load_code(authority, &mut context.evm.inner.db) + .map_err(EVMError::Database)?; + + // 4. Verify the code of authority is either empty or already delegated. + if let Some(bytecode) = &authority_acc.info.code { + // if it is not empty and it is not eip7702 + if !bytecode.is_empty() && !bytecode.is_eip7702() { + continue; + } + } + + // 5. Verify the nonce of authority is equal to nonce. + if authorization.nonce() != authority_acc.info.nonce { + continue; + } + // TODOFEE + println!("[5] {:?} => {:?}", authority, authorization.address()); + + // 6. Refund the sender PER_EMPTY_ACCOUNT_COST - PER_AUTH_BASE_COST gas if authority exists in the trie. + if !authority_acc.is_empty() { + refunded_accounts += 1; + } + + // 7. Set the code of authority to be 0xef0100 || address. This is a delegation designation. + let bytecode = Bytecode::new_eip7702(authorization.address()); + authority_acc.info.code_hash = bytecode.hash_slow(); + authority_acc.info.code = Some(bytecode); + + // 8. Increase the nonce of authority by one. + authority_acc.info.nonce = authority_acc.info.nonce.saturating_add(1); + authority_acc.mark_touch(); + println!("PASS"); + } + + let refunded_gas = + refunded_accounts * (eip7702::PER_EMPTY_ACCOUNT_COST - eip7702::PER_AUTH_BASE_COST); + println!("refunded_accounts: {refunded_accounts}"); + Ok(refunded_gas) +} diff --git a/crates/specification/CHANGELOG.md b/crates/specification/CHANGELOG.md index e69de29bb2..ea2cb2c50e 100644 --- a/crates/specification/CHANGELOG.md +++ b/crates/specification/CHANGELOG.md @@ -0,0 +1,83 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0](https://github.com/mrLSD/revm/releases/tag/revm-specification-v1.0.0) - 2024-12-27 + +### Added + +- Restucturing Part7 Handler and Context rework (#1865) +- restructuring Part6 transaction crate (#1814) +- Merge validation/analyzis with Bytecode (#1793) +- restructure Part2 database crate (#1784) +- project restructuring Part1 (#1776) +- *(examples)* generate block traces (#895) +- implement EIP-4844 (#668) +- *(Shanghai)* All EIPs: push0, warm coinbase, limit/measure initcode (#376) +- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` (#239) +- Introduce ByteCode format, Update Readme (#156) + +### Fixed + +- fix typos ([#620](https://github.com/mrLSD/revm/pull/620)) + +### Other + +- Merge branch 'main' of https://github.com/bluealloy/revm +- fix comments and docs into more sensible (#1920) +- Rename PRAGUE_EOF to OSAKA (#1903) +- fix `constants` module typo (#1801) +- migrate off alloy-eips (#1789) +- Bump new logo (#1735) +- *(README)* add rbuilder to used-by (#1585) +- added simular to used-by (#1521) +- add Trin to used by list (#1393) +- Fix typo in readme ([#1185](https://github.com/mrLSD/revm/pull/1185)) +- Add Hardhat to the "Used by" list ([#1164](https://github.com/mrLSD/revm/pull/1164)) +- Add VERBS to used by list ([#1141](https://github.com/mrLSD/revm/pull/1141)) +- license date and revm docs (#1080) +- *(docs)* Update the benchmark docs to point to revm package (#906) +- *(docs)* Update top-level benchmark docs (#894) +- clang requirement (#784) +- Readme Updates (#756) +- Logo (#743) +- book workflow ([#537](https://github.com/mrLSD/revm/pull/537)) +- add example to revm crate ([#468](https://github.com/mrLSD/revm/pull/468)) +- Update README.md ([#424](https://github.com/mrLSD/revm/pull/424)) +- add no_std to primitives ([#366](https://github.com/mrLSD/revm/pull/366)) +- revm-precompiles to revm-precompile +- Bump v20, changelog ([#350](https://github.com/mrLSD/revm/pull/350)) +- typos (#232) +- Add support for old forks. ([#191](https://github.com/mrLSD/revm/pull/191)) +- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/mrLSD/revm/pull/159)) +- typo fixes +- fix readme typo +- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/mrLSD/revm/pull/52)) +- readme. debuger update +- Bump revm v0.3.0. README updated +- readme +- Add time elapsed for tests +- readme updated +- Include Basefee into cost calc. readme change +- Initialize precompile accounts +- Status update. Taking a break +- Merkle calc. Tweaks and debugging for eip158 +- Replace aurora bn lib with parity's. All Bn128Add/Mul/Pair tests passes +- TEMP +- one tab removed +- readme +- README Example simplified +- Gas calculation for Call/Create. Example Added +- readme usage +- README changes +- Static gas cost added +- Subroutine changelogs and reverts +- Readme postulates +- Spelling +- Restructure project +- First iteration. Machine is looking okay diff --git a/crates/specification/src/eip7702/authorization_list.rs b/crates/specification/src/eip7702/authorization_list.rs index 668aa00f47..bad0af41c6 100644 --- a/crates/specification/src/eip7702/authorization_list.rs +++ b/crates/specification/src/eip7702/authorization_list.rs @@ -50,7 +50,7 @@ impl AuthorizationList { } /// Returns iterator of recovered Authorizations. - pub fn recovered_iter<'a>(&'a self) -> Box + 'a> { + pub fn recovered_iter<'a>(&'a self) -> Box + 'a> { match self { Self::Signed(signed) => Box::new(signed.iter().map(|signed| signed.clone().into())), Self::Recovered(recovered) => Box::new(recovered.clone().into_iter()), diff --git a/crates/state/CHANGELOG.md b/crates/state/CHANGELOG.md index e69de29bb2..607965173b 100644 --- a/crates/state/CHANGELOG.md +++ b/crates/state/CHANGELOG.md @@ -0,0 +1,81 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0](https://github.com/mrLSD/revm/releases/tag/revm-state-v1.0.0) - 2024-12-27 + +### Added + +- *(database)* implement order-independent equality for Reverts (#1827) +- Restucturing Part7 Handler and Context rework (#1865) +- restructuring Part6 transaction crate (#1814) +- restructure Part2 database crate (#1784) +- project restructuring Part1 (#1776) +- *(examples)* generate block traces (#895) +- implement EIP-4844 (#668) +- *(Shanghai)* All EIPs: push0, warm coinbase, limit/measure initcode (#376) +- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` (#239) +- Introduce ByteCode format, Update Readme (#156) + +### Fixed + +- fix typos ([#620](https://github.com/mrLSD/revm/pull/620)) + +### Other + +- fix comments and docs into more sensible (#1920) +- inline more `AccountInfo` fns and add docs (#1819) +- *(primitives)* replace HashMap re-exports with alloy_primitives::map (#1805) +- Bump new logo (#1735) +- *(README)* add rbuilder to used-by (#1585) +- added simular to used-by (#1521) +- add Trin to used by list (#1393) +- Fix typo in readme ([#1185](https://github.com/mrLSD/revm/pull/1185)) +- Add Hardhat to the "Used by" list ([#1164](https://github.com/mrLSD/revm/pull/1164)) +- Add VERBS to used by list ([#1141](https://github.com/mrLSD/revm/pull/1141)) +- license date and revm docs (#1080) +- *(docs)* Update the benchmark docs to point to revm package (#906) +- *(docs)* Update top-level benchmark docs (#894) +- clang requirement (#784) +- Readme Updates (#756) +- Logo (#743) +- book workflow ([#537](https://github.com/mrLSD/revm/pull/537)) +- add example to revm crate ([#468](https://github.com/mrLSD/revm/pull/468)) +- Update README.md ([#424](https://github.com/mrLSD/revm/pull/424)) +- add no_std to primitives ([#366](https://github.com/mrLSD/revm/pull/366)) +- revm-precompiles to revm-precompile +- Bump v20, changelog ([#350](https://github.com/mrLSD/revm/pull/350)) +- typos (#232) +- Add support for old forks. ([#191](https://github.com/mrLSD/revm/pull/191)) +- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/mrLSD/revm/pull/159)) +- typo fixes +- fix readme typo +- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/mrLSD/revm/pull/52)) +- readme. debuger update +- Bump revm v0.3.0. README updated +- readme +- Add time elapsed for tests +- readme updated +- Include Basefee into cost calc. readme change +- Initialize precompile accounts +- Status update. Taking a break +- Merkle calc. Tweaks and debugging for eip158 +- Replace aurora bn lib with parity's. All Bn128Add/Mul/Pair tests passes +- TEMP +- one tab removed +- readme +- README Example simplified +- Gas calculation for Call/Create. Example Added +- readme usage +- README changes +- Static gas cost added +- Subroutine changelogs and reverts +- Readme postulates +- Spelling +- Restructure project +- First iteration. Machine is looking okay diff --git a/crates/statetest-types/CHANGELOG.md b/crates/statetest-types/CHANGELOG.md index e69de29bb2..60a5d79fd6 100644 --- a/crates/statetest-types/CHANGELOG.md +++ b/crates/statetest-types/CHANGELOG.md @@ -0,0 +1,77 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0](https://github.com/mrLSD/revm/releases/tag/revm-statetest-types-v1.0.0) - 2024-12-27 + +### Added + +- Restucturing Part7 Handler and Context rework (#1865) +- restructuring Part6 transaction crate (#1814) +- extract statetest models/structs to standalone crate (#1808) +- *(examples)* generate block traces (#895) +- implement EIP-4844 (#668) +- *(Shanghai)* All EIPs: push0, warm coinbase, limit/measure initcode (#376) +- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` (#239) +- Introduce ByteCode format, Update Readme (#156) + +### Fixed + +- fix typos ([#620](https://github.com/mrLSD/revm/pull/620)) + +### Other + +- fix comments and docs into more sensible (#1920) +- Bump new logo (#1735) +- *(README)* add rbuilder to used-by (#1585) +- added simular to used-by (#1521) +- add Trin to used by list (#1393) +- Fix typo in readme ([#1185](https://github.com/mrLSD/revm/pull/1185)) +- Add Hardhat to the "Used by" list ([#1164](https://github.com/mrLSD/revm/pull/1164)) +- Add VERBS to used by list ([#1141](https://github.com/mrLSD/revm/pull/1141)) +- license date and revm docs (#1080) +- *(docs)* Update the benchmark docs to point to revm package (#906) +- *(docs)* Update top-level benchmark docs (#894) +- clang requirement (#784) +- Readme Updates (#756) +- Logo (#743) +- book workflow ([#537](https://github.com/mrLSD/revm/pull/537)) +- add example to revm crate ([#468](https://github.com/mrLSD/revm/pull/468)) +- Update README.md ([#424](https://github.com/mrLSD/revm/pull/424)) +- add no_std to primitives ([#366](https://github.com/mrLSD/revm/pull/366)) +- revm-precompiles to revm-precompile +- Bump v20, changelog ([#350](https://github.com/mrLSD/revm/pull/350)) +- typos (#232) +- Add support for old forks. ([#191](https://github.com/mrLSD/revm/pull/191)) +- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/mrLSD/revm/pull/159)) +- typo fixes +- fix readme typo +- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/mrLSD/revm/pull/52)) +- readme. debuger update +- Bump revm v0.3.0. README updated +- readme +- Add time elapsed for tests +- readme updated +- Include Basefee into cost calc. readme change +- Initialize precompile accounts +- Status update. Taking a break +- Merkle calc. Tweaks and debugging for eip158 +- Replace aurora bn lib with parity's. All Bn128Add/Mul/Pair tests passes +- TEMP +- one tab removed +- readme +- README Example simplified +- Gas calculation for Call/Create. Example Added +- readme usage +- README changes +- Static gas cost added +- Subroutine changelogs and reverts +- Readme postulates +- Spelling +- Restructure project +- First iteration. Machine is looking okay