Skip to content

Commit

Permalink
add correct caller/target address
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita committed Jan 23, 2025
1 parent fac5911 commit 6c3c753
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
8 changes: 4 additions & 4 deletions bins/revme/src/cmd/bench/analysis.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use database::BenchmarkDB;
use database::{BenchmarkDB, BENCH_CALLER, BENCH_TARGET};
use revm::{
bytecode::Bytecode,
primitives::{address, bytes, hex, Bytes, TxKind},
primitives::{bytes, hex, Bytes, TxKind},
transact_main, Context,
};

Expand All @@ -15,8 +15,8 @@ pub fn run() {
.with_db(BenchmarkDB::new_bytecode(bytecode))
.modify_tx_chained(|tx| {
// Execution globals block hash/gas_limit/coinbase/timestamp..
tx.caller = address!("1000000000000000000000000000000000000000");
tx.kind = TxKind::Call(address!("0000000000000000000000000000000000000000"));
tx.caller = BENCH_CALLER;
tx.kind = TxKind::Call(BENCH_TARGET);
//evm.env.tx.data = Bytes::from(hex::decode("30627b7c").unwrap());
tx.data = bytes!("8035F0CE");
});
Expand Down
6 changes: 3 additions & 3 deletions bins/revme/src/cmd/bench/burntpix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use static_data::{

use alloy_sol_macro::sol;
use alloy_sol_types::SolCall;
use database::CacheDB;
use database::{CacheDB, BENCH_CALLER};
use revm::{
context_interface::result::{ExecutionResult, Output},
database_interface::EmptyDB,
primitives::{address, hex, keccak256, Address, Bytes, TxKind, B256, U256},
primitives::{hex, keccak256, Address, Bytes, TxKind, B256, U256},
state::{AccountInfo, Bytecode},
transact_main, Context,
};
Expand All @@ -37,7 +37,7 @@ pub fn run() {
let db = init_db();

let mut context = Context::builder().with_db(db).modify_tx_chained(|tx| {
tx.caller = address!("1000000000000000000000000000000000000000");
tx.caller = BENCH_CALLER;
tx.kind = TxKind::Call(BURNTPIX_MAIN_ADDRESS);
tx.data = run_call_data.clone().into();
tx.gas_limit = u64::MAX;
Expand Down
8 changes: 4 additions & 4 deletions bins/revme/src/cmd/bench/snailtracer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use database::BenchmarkDB;
use database::{BenchmarkDB, BENCH_CALLER, BENCH_TARGET};
use revm::{
bytecode::Bytecode,
primitives::{address, bytes, hex, Bytes, TxKind},
primitives::{bytes, hex, Bytes, TxKind},
transact_main, Context,
};

Expand All @@ -10,8 +10,8 @@ pub fn simple_example(bytecode: Bytecode) {
.with_db(BenchmarkDB::new_bytecode(bytecode.clone()))
.modify_tx_chained(|tx| {
// Execution globals block hash/gas_limit/coinbase/timestamp..
tx.caller = address!("1000000000000000000000000000000000000000");
tx.kind = TxKind::Call(address!("0000000000000000000000000000000000000000"));
tx.caller = BENCH_CALLER;
tx.kind = TxKind::Call(BENCH_TARGET);
tx.data = bytes!("30627b7c");
tx.gas_limit = 1_000_000_000;
});
Expand Down
12 changes: 3 additions & 9 deletions bins/revme/src/cmd/bench/transfer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use database::BenchmarkDB;
use database::{BenchmarkDB, BENCH_CALLER, BENCH_TARGET};
use revm::{
bytecode::Bytecode,
primitives::{TxKind, U256},
Expand All @@ -10,15 +10,9 @@ pub fn run() {
.with_db(BenchmarkDB::new_bytecode(Bytecode::new()))
.modify_tx_chained(|tx| {
// Execution globals block hash/gas_limit/coinbase/timestamp..
tx.caller = "0x0000000000000000000000000000000000000001"
.parse()
.unwrap();
tx.caller = BENCH_CALLER;
tx.kind = TxKind::Call(BENCH_TARGET);
tx.value = U256::from(10);
tx.kind = TxKind::Call(
"0x0000000000000000000000000000000000000000"
.parse()
.unwrap(),
);
});
let _ = transact_main(&mut context);
}
2 changes: 2 additions & 0 deletions crates/database/src/in_memory_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,10 @@ impl BenchmarkDB {

/// BYTECODE address
pub const FFADDRESS: Address = address!("ffffffffffffffffffffffffffffffffffffffff");
pub const BENCH_TARGET: Address = FFADDRESS;
/// CALLER address
pub const EEADDRESS: Address = address!("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
pub const BENCH_CALLER: Address = EEADDRESS;

impl Database for BenchmarkDB {
type Error = Infallible;
Expand Down

0 comments on commit 6c3c753

Please sign in to comment.