-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Evm structure (Cached Instructions and Precompiles) (#2049)
* feat: frame ctx inside Evm * feat: full Evm * Inspector trait wip * wip working inspector * rename * Inspector and Op support. Cleanup * traits, examples and cleanup * Cleanup all unused Getters * Cleanup and some renames * fix tests, clippy fmt * rm bench * no_std * doc * doc links * support inspector selfdestruct and logs * add erc20 example and cleanup
- Loading branch information
Showing
90 changed files
with
2,721 additions
and
3,892 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
use std::time::Instant; | ||
|
||
use database::{BenchmarkDB, BENCH_CALLER, BENCH_TARGET}; | ||
use revm::{ | ||
bytecode::Bytecode, | ||
primitives::{TxKind, U256}, | ||
Context, ExecuteEvm, | ||
Context, ExecuteEvm, MainBuilder, MainContext, | ||
}; | ||
use std::time::Instant; | ||
|
||
pub fn run() { | ||
let mut context = Context::builder() | ||
let time = Instant::now(); | ||
let mut evm = Context::mainnet() | ||
.with_db(BenchmarkDB::new_bytecode(Bytecode::new())) | ||
.modify_tx_chained(|tx| { | ||
// Execution globals block hash/gas_limit/coinbase/timestamp.. | ||
tx.caller = BENCH_CALLER; | ||
tx.kind = TxKind::Call(BENCH_TARGET); | ||
tx.value = U256::from(10); | ||
}); | ||
}) | ||
.build_mainnet(); | ||
println!("Init: {:?}", time.elapsed()); | ||
|
||
let time = Instant::now(); | ||
let _ = context.exec_previous(); | ||
println!("First init: {:?}", time.elapsed()); | ||
let _ = evm.transact_previous(); | ||
println!("First run: {:?}", time.elapsed()); | ||
|
||
let time = Instant::now(); | ||
let _ = context.exec_previous(); | ||
println!("Run: {:?}", time.elapsed()); | ||
let _ = evm.transact_previous(); | ||
println!("Second run: {:?}", time.elapsed()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.