-
Notifications
You must be signed in to change notification settings - Fork 966
feat: separate initial checks #486
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7f609d8
wip separate initial checks
rakita 57504a9
tests passing, consolidate some checks
rakita 9d58056
test
rakita 150447e
feat: add transfer test
rakita 410d768
Merge remote-tracking branch 'origin/transfer_test' into separate_ini…
rakita 25b317f
temp
rakita ec78f21
Update crates/interpreter/src/gas/calc.rs
rakita 9f82d05
/ Initial gas that is deducted from the transaction gas limit.
rakita 1dc3307
fmt
rakita File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -15,3 +15,6 @@ name = "analysis" | |
|
|
||
| [[bin]] | ||
| name = "snailtracer" | ||
|
|
||
| [[bin]] | ||
| name = "transfer" | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| use revm::{ | ||
| db::BenchmarkDB, | ||
| primitives::{Bytecode, TransactTo, U256}, | ||
| }; | ||
| use std::time::{Duration, Instant}; | ||
| extern crate alloc; | ||
|
|
||
| fn main() { | ||
| // BenchmarkDB is dummy state that implements Database trait. | ||
| let mut evm = revm::new(); | ||
|
|
||
| // execution globals block hash/gas_limit/coinbase/timestamp.. | ||
| evm.env.tx.caller = "0x0000000000000000000000000000000000000001" | ||
| .parse() | ||
| .unwrap(); | ||
| evm.env.tx.value = U256::from(10); | ||
| evm.env.tx.transact_to = TransactTo::Call( | ||
| "0x0000000000000000000000000000000000000000" | ||
| .parse() | ||
| .unwrap(), | ||
| ); | ||
| //evm.env.tx.data = Bytes::from(hex::decode("30627b7c").unwrap()); | ||
|
|
||
| evm.database(BenchmarkDB::new_bytecode(Bytecode::new())); | ||
|
|
||
| // Microbenchmark | ||
| let bench_options = microbench::Options::default().time(Duration::from_secs(1)); | ||
|
|
||
| microbench::bench(&bench_options, "Simple value transfer", || { | ||
| let _ = evm.transact().unwrap(); | ||
| }); | ||
|
|
||
| let time = Instant::now(); | ||
| for _ in 0..10000 { | ||
| let _ = evm.transact().unwrap(); | ||
| } | ||
| let elapsed = time.elapsed(); | ||
| println!("10k runs in {:?}", elapsed.as_nanos() / 10_000); | ||
| } |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /// Interpreter stack limit | ||
| pub const STACK_LIMIT: u64 = 1024; | ||
| /// EVM call stack limit | ||
| pub const CALL_STACK_LIMIT: u64 = 1024; | ||
|
|
||
| /// EIP-170: Contract code size limit | ||
| /// By default limit is 0x6000 (~25kb) | ||
| pub const MAX_CODE_SIZE: usize = 0x6000; | ||
|
|
||
| /// EIP-3860: Limit and meter initcode | ||
| /// | ||
| /// Limit of maximum initcode size is 2 * MAX_CODE_SIZE | ||
| pub const MAX_INITCODE_SIZE: usize = 2 * MAX_CODE_SIZE; |
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.