Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(revm-test): release v0.1.0 #2

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
924 changes: 530 additions & 394 deletions Cargo.lock

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions bins/revm-test/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,113 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.0](https://github.com/CeciliaZ030/revm/releases/tag/revm-test-v0.1.0) - 2024-10-29

### Added

- EOF (Ethereum Object Format) ([#1143](https://github.com/CeciliaZ030/revm/pull/1143))
- add tests for shift instructions ([#1254](https://github.com/CeciliaZ030/revm/pull/1254))
- EvmBuilder and External Contexts ([#888](https://github.com/CeciliaZ030/revm/pull/888))
- separate initial checks ([#486](https://github.com/CeciliaZ030/revm/pull/486))
- revm-interpreter created ([#320](https://github.com/CeciliaZ030/revm/pull/320))
- *(interpreter)* Unify instruction fn signature ([#283](https://github.com/CeciliaZ030/revm/pull/283))
- Migrate `primitive_types::U256` to `ruint::Uint<256, 4>` ([#239](https://github.com/CeciliaZ030/revm/pull/239))
- Introduce ByteCode format, Update Readme ([#156](https://github.com/CeciliaZ030/revm/pull/156))

### Fixed

- *(eof)* fixture 2 tests ([#1550](https://github.com/CeciliaZ030/revm/pull/1550))
- *(clippy)* fix some clippy lints

### Other

- Sync database ([#17](https://github.com/CeciliaZ030/revm/pull/17))
- release ([#1729](https://github.com/CeciliaZ030/revm/pull/1729))
- release ([#1722](https://github.com/CeciliaZ030/revm/pull/1722))
- *(deps)* bump alloy and primitives ([#1725](https://github.com/CeciliaZ030/revm/pull/1725))
- *(deps)* bump bytes from 1.6.1 to 1.7.1 ([#1700](https://github.com/CeciliaZ030/revm/pull/1700))
- tag v41 revm v13.0.0 ([#1692](https://github.com/CeciliaZ030/revm/pull/1692))
- release ([#1683](https://github.com/CeciliaZ030/revm/pull/1683))
- *(deps)* bump regex from 1.10.5 to 1.10.6 ([#1682](https://github.com/CeciliaZ030/revm/pull/1682))
- bump versions bcs of primitives ([#1631](https://github.com/CeciliaZ030/revm/pull/1631))
- release ([#1620](https://github.com/CeciliaZ030/revm/pull/1620))
- *(deps)* bump alloy-sol-types from 0.7.6 to 0.7.7 ([#1614](https://github.com/CeciliaZ030/revm/pull/1614))
- *(deps)* bump alloy-sol-macro from 0.7.6 to 0.7.7 ([#1613](https://github.com/CeciliaZ030/revm/pull/1613))
- release ([#1579](https://github.com/CeciliaZ030/revm/pull/1579))
- release ([#1548](https://github.com/CeciliaZ030/revm/pull/1548))
- replace TransactTo with TxKind ([#1542](https://github.com/CeciliaZ030/revm/pull/1542))
- *(deps)* bump regex from 1.10.4 to 1.10.5 ([#1502](https://github.com/CeciliaZ030/revm/pull/1502))
- release ([#1261](https://github.com/CeciliaZ030/revm/pull/1261))
- *(interpreter)* rewrite gas accounting for memory expansion ([#1361](https://github.com/CeciliaZ030/revm/pull/1361))
- revert snailtracer without microbench ([#1259](https://github.com/CeciliaZ030/revm/pull/1259))
- release ([#1231](https://github.com/CeciliaZ030/revm/pull/1231))
- *(deps)* bump other alloy deps 0.7.0 ([#1252](https://github.com/CeciliaZ030/revm/pull/1252))
- *(deps)* bump regex from 1.10.3 to 1.10.4 ([#1223](https://github.com/CeciliaZ030/revm/pull/1223))
- *(deps)* bump bytes from 1.5.0 to 1.6.0 ([#1224](https://github.com/CeciliaZ030/revm/pull/1224))
- release ([#1175](https://github.com/CeciliaZ030/revm/pull/1175))
- tag v32 revm v7.1.0 ([#1176](https://github.com/CeciliaZ030/revm/pull/1176))
- release ([#1125](https://github.com/CeciliaZ030/revm/pull/1125))
- *(deps)* bump alloy-sol-types from 0.6.3 to 0.6.4 ([#1148](https://github.com/CeciliaZ030/revm/pull/1148))
- *(deps)* bump alloy-sol-macro from 0.6.3 to 0.6.4 ([#1136](https://github.com/CeciliaZ030/revm/pull/1136))
- release tag v30 revm v6.1.0 ([#1100](https://github.com/CeciliaZ030/revm/pull/1100))
- clippy cleanup ([#1112](https://github.com/CeciliaZ030/revm/pull/1112))
- *(deps)* bump alloy-sol-types from 0.6.2 to 0.6.3 ([#1103](https://github.com/CeciliaZ030/revm/pull/1103))
- release ([#1082](https://github.com/CeciliaZ030/revm/pull/1082))
- *(deps)* bump alloy-sol-macro from 0.6.2 to 0.6.3 ([#1094](https://github.com/CeciliaZ030/revm/pull/1094))
- license date and revm docs ([#1080](https://github.com/CeciliaZ030/revm/pull/1080))
- release ([#1067](https://github.com/CeciliaZ030/revm/pull/1067))
- tag v27, revm v4.0.0 release ([#1061](https://github.com/CeciliaZ030/revm/pull/1061))
- *(deps)* bump eyre from 0.6.11 to 0.6.12 ([#1051](https://github.com/CeciliaZ030/revm/pull/1051))
- *(deps)* bump alloy-sol-types from 0.6.0 to 0.6.2 ([#1035](https://github.com/CeciliaZ030/revm/pull/1035))
- *(deps)* bump alloy-sol-macro from 0.6.0 to 0.6.2 ([#1013](https://github.com/CeciliaZ030/revm/pull/1013))
- chore(Test) : const to static ([#1016](https://github.com/CeciliaZ030/revm/pull/1016))
- Burntpix criterion bench ([#1004](https://github.com/CeciliaZ030/revm/pull/1004))
- Instruction table ([#759](https://github.com/CeciliaZ030/revm/pull/759))
- rewrite revm-test as a criterion bench ([#579](https://github.com/CeciliaZ030/revm/pull/579))
- optimize stack usage for recursive `call` and `create` programs ([#522](https://github.com/CeciliaZ030/revm/pull/522))
- Bump v24, revm v3.3.0 ([#476](https://github.com/CeciliaZ030/revm/pull/476))
- Release v23, revm v3.2.0 ([#464](https://github.com/CeciliaZ030/revm/pull/464))
- Release v22, revm v3.1.1 ([#460](https://github.com/CeciliaZ030/revm/pull/460))
- v21, revm v3.1.0 ([#444](https://github.com/CeciliaZ030/revm/pull/444))
- remove gas blocks ([#391](https://github.com/CeciliaZ030/revm/pull/391))
- *(deps)* bump bytes from 1.3.0 to 1.4.0 ([#355](https://github.com/CeciliaZ030/revm/pull/355))
- Bump v20, changelog ([#350](https://github.com/CeciliaZ030/revm/pull/350))
- includes to libs ([#338](https://github.com/CeciliaZ030/revm/pull/338))
- Creating revm-primitives, revm better errors and db components ([#334](https://github.com/CeciliaZ030/revm/pull/334))
- Cleanup, move hot fields toggether in Interpreter ([#321](https://github.com/CeciliaZ030/revm/pull/321))
- native bits ([#278](https://github.com/CeciliaZ030/revm/pull/278))
- *(release)* Bump revm and precompiles versions
- Bump primitive_types. Add statetest spec
- Bump revm v2.1.0 ([#224](https://github.com/CeciliaZ030/revm/pull/224))
- revm bump v2.0.0, precompile bump v1.1.1 ([#212](https://github.com/CeciliaZ030/revm/pull/212))
- Cfg choose create analysis, option on bytecode size limit ([#210](https://github.com/CeciliaZ030/revm/pull/210))
- Cargo sort. Bump lib versions ([#208](https://github.com/CeciliaZ030/revm/pull/208))
- Return `ExecutionResult`, which includes `gas_refunded` ([#169](https://github.com/CeciliaZ030/revm/pull/169))
- Bytecode hash, remove override_spec, ([#165](https://github.com/CeciliaZ030/revm/pull/165))
- revm bump 1.8. update libs. snailtracer rename ([#159](https://github.com/CeciliaZ030/revm/pull/159))
- v6 changelog, bump versions
- Big Refactor. Machine to Interpreter. refactor instructions. call/create struct ([#52](https://github.com/CeciliaZ030/revm/pull/52))
- [revm] pop_top and unsafe comments ([#51](https://github.com/CeciliaZ030/revm/pull/51))
- [precompiles] remove unused borsh
- [recompl] Bump precompile deps, cargo sort on workspace
- [revm] output log. Stetetest test log output. fmt
- Bump versions, Changelogs, fmt, revm readme, clippy.
- [revm] Run test multiple times. fmt, BenchmarkDB
- Multiple changes: web3 db, debugger initial commit, precompile load
- Memory to usize, clippy,fmt
- wip optimize i256
- TEMP switch stacks H256 with U256
- [revm] some perfs
- [revm] Perfs stack pop. Benchmark snailtracer.
- [revm] cleanup
- fmt
- EVM Interface changed. Inspector called separately
- Bump revm v0.3.0. README updated
- DB ref mut polished
- And now we debug
- [revm] Interface. Inspector added, Env cleanup. revm-test passes
- Rename bin to bins

## [0.1.0](https://github.com/bluealloy/revm/releases/tag/revm-test-v0.1.0) - 2024-08-30

### Added
Expand Down
7 changes: 3 additions & 4 deletions bins/revm-test/src/bin/burntpix/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use regex::bytes::Regex;
use revm::{
db::{CacheDB, EmptyDB},
primitives::{
address, hex, keccak256, AccountInfo, Address, Bytecode, Bytes, ExecutionResult, Output,
TxKind, B256, U256,
address, hex, keccak256, AccountInfo, Address, Bytecode, Bytes, ChainAddress, ExecutionResult, Output, TransactTo, TxKind, B256, U256
},
Evm,
};
Expand Down Expand Up @@ -37,8 +36,8 @@ fn main() {

let mut evm = Evm::builder()
.modify_tx_env(|tx| {
tx.caller = address!("1000000000000000000000000000000000000000");
tx.transact_to = TxKind::Call(BURNTPIX_MAIN_ADDRESS);
tx.caller = ChainAddress(1, address!("1000000000000000000000000000000000000000"));
tx.transact_to = TransactTo::Call(BURNTPIX_MAIN_ADDRESS);
tx.data = run_call_data.clone().into();
})
.with_db(db)
Expand Down
8 changes: 4 additions & 4 deletions bins/revme/src/cmd/evmrunner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use revm::{
db::BenchmarkDB,
inspector_handle_register,
inspectors::TracerEip3155,
primitives::{Address, Bytecode, BytecodeDecodeError, TxKind},
primitives::{Address, Bytecode, BytecodeDecodeError, ChainAddress, TransactTo, TxKind},
Evm,
};
use std::io::Error as IoError;
Expand Down Expand Up @@ -79,10 +79,10 @@ impl Cmd {
)?))
.modify_tx_env(|tx| {
// execution globals block hash/gas_limit/coinbase/timestamp..
tx.caller = "0x0000000000000000000000000000000000000001"
tx.caller = ChainAddress(1, "0x0000000000000000000000000000000000000001"
.parse()
.unwrap();
tx.transact_to = TxKind::Call(Address::ZERO);
.unwrap());
tx.transact_to = TransactTo::Call(ChainAddress(1, Address::ZERO));
tx.data = input;
})
.build();
Expand Down
6 changes: 3 additions & 3 deletions bins/revme/src/cmd/statetest/merkle_trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use hash_db::Hasher;
use plain_hasher::PlainHasher;
use revm::{
db::PlainAccount,
primitives::{keccak256, Address, Log, B256, U256},
primitives::{keccak256, Address, ChainAddress, Log, B256, U256},
};
use triehash::sec_trie_root;

Expand All @@ -14,11 +14,11 @@ pub fn log_rlp_hash(logs: &[Log]) -> B256 {
}

pub fn state_merkle_trie_root<'a>(
accounts: impl IntoIterator<Item = (Address, &'a PlainAccount)>,
accounts: impl IntoIterator<Item = (ChainAddress, &'a PlainAccount)>,
) -> B256 {
trie_root(accounts.into_iter().map(|(address, acc)| {
(
address,
address.1,
alloy_rlp::encode_fixed_size(&TrieAccount::new(acc)),
)
}))
Expand Down
15 changes: 7 additions & 8 deletions bins/revme/src/cmd/statetest/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ use revm::{
inspectors::TracerEip3155,
interpreter::analysis::to_analysed,
primitives::{
calc_excess_blob_gas, keccak256, Bytecode, Bytes, EVMResultGeneric, Env, ExecutionResult,
SpecId, TxKind, B256,
calc_excess_blob_gas, keccak256, Bytecode, Bytes, ChainAddress, EVMResultGeneric, Env, ExecutionResult, SpecId, TransactTo, TxKind, B256
},
Evm, State,
};
Expand Down Expand Up @@ -274,7 +273,7 @@ pub fn execute_test_suite(
code: Some(bytecode),
nonce: info.nonce,
};
cache_state.insert_account_with_storage(address, acc_info, info.storage);
cache_state.insert_account_with_storage(ChainAddress(1, address), acc_info, info.storage);
}

let mut env = Box::<Env>::default();
Expand All @@ -284,7 +283,7 @@ pub fn execute_test_suite(

// block env
env.block.number = unit.env.current_number;
env.block.coinbase = unit.env.current_coinbase;
env.block.coinbase = ChainAddress(1, unit.env.current_coinbase);
env.block.timestamp = unit.env.current_timestamp;
env.block.gas_limit = unit.env.current_gas_limit;
env.block.basefee = unit.env.current_base_fee.unwrap_or_default();
Expand All @@ -307,14 +306,14 @@ pub fn execute_test_suite(
}

// tx env
env.tx.caller = if let Some(address) = unit.transaction.sender {
env.tx.caller = ChainAddress(1, if let Some(address) = unit.transaction.sender {
address
} else {
recover_address(unit.transaction.secret_key.as_slice()).ok_or_else(|| TestError {
name: name.clone(),
kind: TestErrorKind::UnknownPrivateKey(unit.transaction.secret_key),
})?
};
});
env.tx.gas_price = unit
.transaction
.gas_price
Expand Down Expand Up @@ -365,8 +364,8 @@ pub fn execute_test_suite(
env.tx.authorization_list = auth_list;

let to = match unit.transaction.to {
Some(add) => TxKind::Call(add),
None => TxKind::Create,
Some(add) => TransactTo::Call(ChainAddress(1, add)),
None => TransactTo::Create,
};
env.tx.transact_to = to;

Expand Down
23 changes: 12 additions & 11 deletions crates/interpreter/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use core::ops::{Deref, DerefMut};

mod dummy;
pub use dummy::DummyHost;
use revm_primitives::ChainAddress;

/// EVM context host.
pub trait Host {
Expand All @@ -13,47 +14,47 @@ pub trait Host {
fn env_mut(&mut self) -> &mut Env;

/// Load an account code.
fn load_account_delegated(&mut self, address: Address) -> Option<AccountLoad>;
fn load_account_delegated(&mut self, address: ChainAddress) -> Option<AccountLoad>;

/// Get the block hash of the given block `number`.
fn block_hash(&mut self, number: u64) -> Option<B256>;
fn block_hash(&mut self, chain_id: u64, number: u64) -> Option<B256>;

/// Get balance of `address` and if the account is cold.
fn balance(&mut self, address: Address) -> Option<StateLoad<U256>>;
fn balance(&mut self, address: ChainAddress) -> Option<StateLoad<U256>>;

/// Get code of `address` and if the account is cold.
fn code(&mut self, address: Address) -> Option<Eip7702CodeLoad<Bytes>>;
fn code(&mut self, address: ChainAddress) -> Option<Eip7702CodeLoad<Bytes>>;

/// Get code hash of `address` and if the account is cold.
fn code_hash(&mut self, address: Address) -> Option<Eip7702CodeLoad<B256>>;
fn code_hash(&mut self, address: ChainAddress) -> Option<Eip7702CodeLoad<B256>>;

/// Get storage value of `address` at `index` and if the account is cold.
fn sload(&mut self, address: Address, index: U256) -> Option<StateLoad<U256>>;
fn sload(&mut self, address: ChainAddress, index: U256) -> Option<StateLoad<U256>>;

/// Set storage value of account address at index.
///
/// Returns [`StateLoad`] with [`SStoreResult`] that contains original/new/old storage value.
fn sstore(
&mut self,
address: Address,
address: ChainAddress,
index: U256,
value: U256,
) -> Option<StateLoad<SStoreResult>>;

/// Get the transient storage value of `address` at `index`.
fn tload(&mut self, address: Address, index: U256) -> U256;
fn tload(&mut self, address: ChainAddress, index: U256) -> U256;

/// Set the transient storage value of `address` at `index`.
fn tstore(&mut self, address: Address, index: U256, value: U256);
fn tstore(&mut self, address: ChainAddress, index: U256, value: U256);

/// Emit a log owned by `address` with given `LogData`.
fn log(&mut self, log: Log);

/// Mark `address` to be deleted, with funds transferred to `target`.
fn selfdestruct(
&mut self,
address: Address,
target: Address,
address: ChainAddress,
target: ChainAddress,
) -> Option<StateLoad<SelfDestructResult>>;
}

Expand Down
23 changes: 12 additions & 11 deletions crates/interpreter/src/host/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::{
Host, SStoreResult, SelfDestructResult,
};
use std::vec::Vec;
use revm_primitives::ChainAddress;

use super::{AccountLoad, Eip7702CodeLoad, StateLoad};

Expand Down Expand Up @@ -45,32 +46,32 @@ impl Host for DummyHost {
}

#[inline]
fn load_account_delegated(&mut self, _address: Address) -> Option<AccountLoad> {
fn load_account_delegated(&mut self, _address: ChainAddress) -> Option<AccountLoad> {
Some(AccountLoad::default())
}

#[inline]
fn block_hash(&mut self, _number: u64) -> Option<B256> {
fn block_hash(&mut self, _chain_id: u64, _number: u64) -> Option<B256> {
Some(B256::ZERO)
}

#[inline]
fn balance(&mut self, _address: Address) -> Option<StateLoad<U256>> {
fn balance(&mut self, _address: ChainAddress) -> Option<StateLoad<U256>> {
Some(Default::default())
}

#[inline]
fn code(&mut self, _address: Address) -> Option<Eip7702CodeLoad<Bytes>> {
fn code(&mut self, _address: ChainAddress) -> Option<Eip7702CodeLoad<Bytes>> {
Some(Default::default())
}

#[inline]
fn code_hash(&mut self, _address: Address) -> Option<Eip7702CodeLoad<B256>> {
fn code_hash(&mut self, _address: ChainAddress) -> Option<Eip7702CodeLoad<B256>> {
Some(Eip7702CodeLoad::new_not_delegated(KECCAK_EMPTY, false))
}

#[inline]
fn sload(&mut self, _address: Address, index: U256) -> Option<StateLoad<U256>> {
fn sload(&mut self, _address: ChainAddress, index: U256) -> Option<StateLoad<U256>> {
match self.storage.entry(index) {
Entry::Occupied(entry) => Some(StateLoad::new(*entry.get(), false)),
Entry::Vacant(entry) => {
Expand All @@ -83,7 +84,7 @@ impl Host for DummyHost {
#[inline]
fn sstore(
&mut self,
_address: Address,
_address: ChainAddress,
index: U256,
value: U256,
) -> Option<StateLoad<SStoreResult>> {
Expand All @@ -99,15 +100,15 @@ impl Host for DummyHost {
}

#[inline]
fn tload(&mut self, _address: Address, index: U256) -> U256 {
fn tload(&mut self, _address: ChainAddress, index: U256) -> U256 {
self.transient_storage
.get(&index)
.copied()
.unwrap_or_default()
}

#[inline]
fn tstore(&mut self, _address: Address, index: U256, value: U256) {
fn tstore(&mut self, _address: ChainAddress, index: U256, value: U256) {
self.transient_storage.insert(index, value);
}

Expand All @@ -119,8 +120,8 @@ impl Host for DummyHost {
#[inline]
fn selfdestruct(
&mut self,
_address: Address,
_target: Address,
_address: ChainAddress,
_target: ChainAddress,
) -> Option<StateLoad<SelfDestructResult>> {
Some(StateLoad::default())
}
Expand Down
Loading