Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
fd26b4f
feat: patched revm for eip 7928
Rimeeeeee Aug 7, 2025
28fc82e
ci
Soubhik-10 Aug 7, 2025
b3ef190
ci
Soubhik-10 Aug 7, 2025
a4061f0
refactor for bal
Rimeeeeee Aug 7, 2025
37a03ff
fixes
Rimeeeeee Aug 7, 2025
70e733e
fixes
Rimeeeeee Aug 7, 2025
6bed765
Merge pull request #2 from Rimeeeeee/refactor
Rimeeeeee Aug 7, 2025
574b3ed
feat: build block-level-access-list utility fxn
Rimeeeeee Aug 11, 2025
d5bdd40
fixes
Rimeeeeee Aug 11, 2025
f3d5e05
fixes
Rimeeeeee Aug 11, 2025
8edb697
add bal
Soubhik-10 Aug 12, 2025
adb6847
fixes
Rimeeeeee Aug 12, 2025
4ab6113
added block-access-list to BlockExecutionResult
Rimeeeeee Aug 15, 2025
bcfaff2
ci
Soubhik-10 Aug 16, 2025
3233cf4
approach 1
Rimeeeeee Aug 16, 2025
2dc7412
fixes
Rimeeeeee Aug 16, 2025
46ce792
Merge branch 'build-bal' of https://github.com/Rimeeeeee/evm into bui…
Rimeeeeee Aug 16, 2025
d87d053
feat: change after migration to accountinfo from account
Rimeeeeee Aug 16, 2025
8f4210c
fixes
Rimeeeeee Aug 16, 2025
6764974
only store updated balance and nonce
Rimeeeeee Aug 17, 2025
6b72a28
new things :)
Soubhik-10 Aug 17, 2025
fee7a3f
new things :)
Soubhik-10 Aug 17, 2025
0c79d40
track pre execution chamges for eip 2935
Rimeeeeee Aug 17, 2025
07e65a5
beacon root pre ex change
Soubhik-10 Aug 17, 2025
f5d0978
beacon root pre ex change
Soubhik-10 Aug 17, 2025
e13d172
store addresses
Soubhik-10 Aug 18, 2025
c6c56f3
track post block changes
Rimeeeeee Aug 18, 2025
2409ec7
modified post execution tracking
Rimeeeeee Aug 18, 2025
25f6072
finally build bal (pending sort)
Soubhik-10 Aug 18, 2025
a172893
sort and deduplication
Rimeeeeee Aug 18, 2025
8a1cb23
nit
Soubhik-10 Aug 18, 2025
707d142
nit
Soubhik-10 Aug 18, 2025
e935051
fixes
Rimeeeeee Aug 18, 2025
901c7e7
fixes
Rimeeeeee Aug 18, 2025
0f3d90c
fixes double unwrap
Rimeeeeee Aug 18, 2025
e095d38
Added a dummy test
Soubhik-10 Aug 18, 2025
1a523d1
nit
Rimeeeeee Aug 18, 2025
e06b25a
remove print
Soubhik-10 Aug 18, 2025
bd5f89e
Merge branch 'build-bal' of https://github.com/Rimeeeeee/evm into bui…
Soubhik-10 Aug 18, 2025
1382f99
remove print
Soubhik-10 Aug 18, 2025
d3a929d
ty Rimeeeeeee who told me to enable feature after me wasting hours
Soubhik-10 Aug 18, 2025
5aa5e90
nit
Soubhik-10 Aug 18, 2025
0063f6f
nit
Rimeeeeee Aug 19, 2025
a2e7e68
nit
Rimeeeeee Aug 19, 2025
5b00696
fixed tx_index issue
Rimeeeeee Aug 19, 2025
7fd0c26
fixes
Rimeeeeee Aug 19, 2025
a60f5b3
deprecate tx index
Soubhik-10 Aug 21, 2025
9b46d1a
minor fixes
Rimeeeeee Aug 21, 2025
45989d5
minor refactors and added validation fxn(wip)
Rimeeeeee Aug 23, 2025
7f6fb97
added validate block access list
Rimeeeeee Aug 23, 2025
ce84ece
Merge branch 'alloy-rs:main' into bal
Soubhik-10 Aug 25, 2025
51b1100
Merge branch 'bal' into build-bal
Soubhik-10 Aug 25, 2025
6ad1fa7
Merge branch 'build-bal' into wo-txindex
Rimeeeeee Aug 25, 2025
850ec97
fixes
Rimeeeeee Aug 25, 2025
268b3f4
Merge branch 'wo-txindex' of https://github.com/Rimeeeeee/evm into wo…
Rimeeeeee Aug 25, 2025
d775e67
zepter
Rimeeeeee Aug 25, 2025
a7b59d8
Merge pull request #4 from Rimeeeeee/wo-txindex
Soubhik-10 Aug 25, 2025
971a74c
Merge pull request #3 from Rimeeeeee/build-bal
Soubhik-10 Aug 25, 2025
867730d
fix smol bug
Soubhik-10 Aug 26, 2025
47167be
feat: added handling of eip-2930 related changes for bal
Rimeeeeee Aug 26, 2025
30446bb
fixes
Rimeeeeee Aug 26, 2025
f7a3c42
bump
Soubhik-10 Aug 30, 2025
35df703
feat: expose `PrecompileId` (#165)
klkvr Aug 26, 2025
8f71e4d
feat: expose target/bytecode addresses on `PrecompileInput` (#161)
klkvr Aug 25, 2025
0044f98
cargo update
Soubhik-10 Sep 1, 2025
85fdc80
Merge branch 'bal' into accesslist
Soubhik-10 Sep 4, 2025
1fd612d
Merge pull request #5 from Rimeeeeee/accesslist
Rimeeeeee Sep 4, 2025
4bc8d71
fixes
Rimeeeeee Sep 5, 2025
0a39ad5
fixes
Rimeeeeee Sep 5, 2025
8c4ada9
no std
Soubhik-10 Sep 5, 2025
033e7af
no std
Soubhik-10 Sep 5, 2025
0f4cedd
fixes
Rimeeeeee Sep 5, 2025
e390940
update
Soubhik-10 Sep 5, 2025
553e1f0
trace
Soubhik-10 Sep 5, 2025
26069c7
trace
Soubhik-10 Sep 5, 2025
5ab81b1
fixes
Rimeeeeee Sep 5, 2025
00ad320
logs
Soubhik-10 Sep 6, 2025
57ea631
more traces
Soubhik-10 Sep 6, 2025
c5e74c4
new types
Soubhik-10 Sep 7, 2025
fd79f2f
proper handle of pre changes
Rimeeeeee Sep 7, 2025
e1b8b0e
traces
Soubhik-10 Sep 8, 2025
bde1381
replaced history serve 8192 with 8191
Rimeeeeee Sep 8, 2025
6b89ded
Merge branch 'bal' of https://github.com/Rimeeeeee/evm into bal
Rimeeeeee Sep 8, 2025
e9e345a
try fix
Soubhik-10 Sep 8, 2025
9af8340
try fix
Soubhik-10 Sep 8, 2025
dc257df
experiment
Rimeeeeee Sep 8, 2025
d6ffb32
fixes
Rimeeeeee Sep 8, 2025
77b0b7f
Revert "fixes"
Rimeeeeee Sep 8, 2025
3dad779
Revert "experiment"
Rimeeeeee Sep 8, 2025
f53b7cb
Reapply "experiment"
Rimeeeeee Sep 9, 2025
fcb4548
fixes
Rimeeeeee Sep 9, 2025
54bd8bd
clippy
Soubhik-10 Sep 9, 2025
afb10c8
clippy
Soubhik-10 Sep 9, 2025
d00cf17
update
Soubhik-10 Sep 9, 2025
186ffd3
Merge pull request #6 from Rimeeeeee/pre-execution
Soubhik-10 Sep 9, 2025
2b47ac4
merge
Soubhik-10 Sep 10, 2025
1d62597
bumo
Soubhik-10 Sep 10, 2025
61f7209
refactor: bal
Rimeeeeee Sep 12, 2025
bfaa740
fixes
Rimeeeeee Sep 12, 2025
742e5f2
refactor: pre execution
Rimeeeeee Sep 12, 2025
32c4ffa
fixes
Rimeeeeee Sep 12, 2025
6fcdf55
refactor: execute txn with commit condn
Rimeeeeee Sep 12, 2025
ddbd85f
refactor: post execution changes
Rimeeeeee Sep 12, 2025
acf22ad
default
Soubhik-10 Sep 12, 2025
f53d1d2
added utlity
Rimeeeeee Sep 12, 2025
1325d33
Merge branch 'refactor-bal' of https://github.com/Rimeeeeee/evm into …
Rimeeeeee Sep 12, 2025
1a6212c
deprecate alloy bal
Soubhik-10 Sep 12, 2025
2fa9cde
deprecate alloy bal
Soubhik-10 Sep 12, 2025
6c9c9c6
update
Rimeeeeee Sep 12, 2025
816ae67
patch
Rimeeeeee Sep 12, 2025
6151e5a
removed timestamp
Rimeeeeee Sep 12, 2025
d83d034
clippy
Soubhik-10 Sep 12, 2025
3c02721
clippy
Soubhik-10 Sep 12, 2025
1397358
Merge pull request #7 from Rimeeeeee/refactor-bal
Rimeeeeee Sep 12, 2025
285831c
balance change modification
Rimeeeeee Sep 16, 2025
1fcabc1
fixes
Rimeeeeee Sep 16, 2025
1538bb8
rebase
Rimeeeeee Sep 19, 2025
6775567
updated op alloy v
Rimeeeeee Sep 19, 2025
92598f3
version bump
Soubhik-10 Sep 23, 2025
af237ee
bump
Soubhik-10 Sep 23, 2025
a7bfaae
bump
Soubhik-10 Sep 23, 2025
9463886
specid
Soubhik-10 Sep 23, 2025
cefe6e5
specid
Soubhik-10 Sep 23, 2025
a5df941
added balance
Soubhik-10 Sep 23, 2025
84e9e45
added coinbase explicitly
Soubhik-10 Sep 23, 2025
84693fd
idk
Soubhik-10 Sep 23, 2025
a406570
temp
Soubhik-10 Sep 23, 2025
ca0fe66
coinbase
Rimeeeeee Sep 23, 2025
2f4d4d9
code
Soubhik-10 Sep 23, 2025
d8d1602
fix
Soubhik-10 Sep 23, 2025
9932d4c
nonce change fix
Rimeeeeee Sep 23, 2025
d3ba2cc
create
Soubhik-10 Sep 23, 2025
59af4f7
create
Soubhik-10 Sep 23, 2025
197559f
fix nonce
Soubhik-10 Sep 23, 2025
90d947b
nonce
Soubhik-10 Sep 23, 2025
aa30e7d
nonce fix
Rimeeeeee Sep 23, 2025
0399af1
experimental
Rimeeeeee Sep 27, 2025
8b64509
clippy + fmt
Soubhik-10 Sep 27, 2025
f58279a
fixes
Rimeeeeee Sep 27, 2025
803a186
handle self destruct
Rimeeeeee Sep 30, 2025
0462e89
self destruct fix
Soubhik-10 Sep 30, 2025
3835cb7
self destruct fix
Soubhik-10 Sep 30, 2025
ebe820e
update
Soubhik-10 Oct 1, 2025
4484ba1
feat: added zero transfer check through revm
Rimeeeeee Oct 3, 2025
6cb4043
rebase
Rimeeeeee Oct 3, 2025
9a87ba4
fixes
Rimeeeeee Oct 3, 2025
622dafd
trace
Soubhik-10 Oct 3, 2025
7d3b253
fix balance
Soubhik-10 Oct 3, 2025
9b35c19
fixes
Rimeeeeee Oct 3, 2025
40d4251
revert tracking
Rimeeeeee Oct 3, 2025
18d61b2
balance
Rimeeeeee Oct 3, 2025
ab9aebc
feat: added initial balance (#9)
Rimeeeeee Oct 4, 2025
9a1e181
2930 for empty acc changes
Rimeeeeee Oct 4, 2025
7e22908
access list fix
Soubhik-10 Oct 4, 2025
5e5a366
access list
Soubhik-10 Oct 4, 2025
e36647d
check for sender = reciever
Rimeeeeee Oct 9, 2025
8c98c89
wip: oog
Soubhik-10 Oct 9, 2025
9271afd
fix coinbase
Soubhik-10 Oct 10, 2025
38f9eae
fix coinbase
Soubhik-10 Oct 10, 2025
b119e4c
feat:tracing result
Rimeeeeee Oct 11, 2025
7a93836
oog handling
Rimeeeeee Oct 11, 2025
359e1d3
feat: added account tracing
Rimeeeeee Oct 11, 2025
c370a56
feat:code change modification
Rimeeeeee Oct 12, 2025
03d821b
fixes
Rimeeeeee Oct 12, 2025
6e305f4
removed oog handling from evm
Rimeeeeee Oct 15, 2025
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: CI

on:
push:
branches: [main]
branches: ["**"]
pull_request:
branches: ["**"]

env:
CARGO_TERM_COLOR: always
Expand Down
27 changes: 17 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,19 @@ alloy-op-evm = { version = "0.21.2", path = "crates/op-evm", default-features =
# alloy
alloy-eip2124 = { version = "0.2", default-features = false }
alloy-chains = { version = "0.2.0", default-features = false }
alloy-eips = { version = "1.0.34", default-features = false }
alloy-consensus = { version = "1.0.27", default-features = false }
alloy-eips = { version = "1.0.37", default-features = false }
alloy-consensus = { version = "1.0.37", default-features = false }
alloy-primitives = { version = "1.0.0", default-features = false }
alloy-sol-types = { version = "1.0.0", default-features = false }
alloy-hardforks = { version = "0.3" }
alloy-rpc-types-eth = { version = "1.0.27", default-features = false }
alloy-rpc-types-engine = { version = "1.0.27", default-features = false }
alloy-hardforks = { version = "0.3.1" }
alloy-rpc-types-eth = { version = "1.0.37", default-features = false }
alloy-rlp = { version = "0.3.12", default-features = false }
alloy-rpc-types-engine = { version = "1.0.37", default-features = false }

# op-alloy
alloy-op-hardforks = { version = "0.3" }
op-alloy-consensus = { version = "0.20", default-features = false }
op-alloy-rpc-types-engine = { version = "0.20", default-features = false }
alloy-op-hardforks = { version = "0.3.1" }
op-alloy-consensus = { version = "0.20.0", default-features = false }
op-alloy-rpc-types-engine = { version = "0.20.0", default-features = false }

# revm
revm = { version = "29.0.0", default-features = false }
Expand All @@ -64,8 +65,14 @@ derive_more = { version = "2", default-features = false, features = ["full"] }
serde = { version = "1", default-features = false, features = ["derive"] }
thiserror = { version = "2.0.0", default-features = false }
serde_json = "1"
tracing = { version = "0.1.41", default-features = false }
test-case = "3"

[patch.crates-io]
# revm = { git = "https://github.com/bluealloy/revm", rev = "11b16259" }
# op-revm = { git = "https://github.com/bluealloy/revm", rev = "11b16259" }
revm = { git = "https://github.com/Soubhik-10/revm", branch = "bal" }
op-revm = { git = "https://github.com/Soubhik-10/revm", branch = "bal" }
alloy-eips = { git = "https://github.com/Soubhik-10/alloy", branch = "bal" }
alloy-consensus = { git = "https://github.com/Soubhik-10/alloy", branch = "bal" }
# alloy-hardforks = { git = "https://github.com/Rimeeeeee/hardforks", branch = "amsterdam" }
alloy-rpc-types-eth = { git = "https://github.com/Soubhik-10/alloy", branch = "bal" }
alloy-rpc-types-engine = { git = "https://github.com/Soubhik-10/alloy", branch = "bal" }
32 changes: 16 additions & 16 deletions crates/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,39 @@ alloy-eips.workspace = true
alloy-hardforks.workspace = true
alloy-op-hardforks = { workspace = true, optional = true }
alloy-rpc-types-eth = { workspace = true, optional = true }
alloy-rlp.workspace = true
alloy-rpc-types-engine = { workspace = true, optional = true }
op-alloy-rpc-types-engine = { workspace = true, optional = true }

revm.workspace = true
revm = { workspace = true, features = ["glamsterdam"] }
op-revm = { workspace = true, optional = true }
op-alloy-consensus = { workspace = true, optional = true }

auto_impl.workspace = true
derive_more.workspace = true
thiserror.workspace = true

tracing.workspace = true
[dev-dependencies]
alloy-primitives = { workspace = true, features = ["serde"] }
serde_json.workspace = true
test-case.workspace = true

[features]
default = ["std"]
secp256k1 = [
"std",
"alloy-consensus/secp256k1",
]
secp256k1 = ["std", "alloy-consensus/secp256k1"]
std = [
"alloy-primitives/std",
"revm/std",
"alloy-consensus/std",
"alloy-eips/std",
"alloy-sol-types/std",
"derive_more/std",
"op-revm?/std",
"thiserror/std",
"op-alloy-consensus?/std",
"alloy-rpc-types-eth?/std",
"alloy-primitives/std",
"revm/std",
"alloy-consensus/std",
"alloy-eips/std",
"alloy-sol-types/std",
"derive_more/std",
"op-revm?/std",
"thiserror/std",
"op-alloy-consensus?/std",
"alloy-rpc-types-eth?/std",
"alloy-rlp/std",
"tracing/std",
"alloy-rpc-types-engine?/std",
"op-alloy-rpc-types-engine?/std",
]
Expand Down
4 changes: 3 additions & 1 deletion crates/evm/src/block/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::{Database, Evm, EvmFactory, FromRecoveredTx, FromTxWithEncoded, RecoveredTx, ToTxEnv};
use alloc::{boxed::Box, vec::Vec};
use alloy_eips::eip7685::Requests;
use alloy_eips::{eip7685::Requests, eip7928::BlockAccessList};
use revm::{
context::result::{ExecutionResult, ResultAndState},
database::State,
Expand Down Expand Up @@ -32,6 +32,8 @@ pub struct BlockExecutionResult<T> {
pub requests: Requests,
/// The total gas used by the block.
pub gas_used: u64,
/// block-level access list
pub block_access_list: Option<BlockAccessList>,
}

/// Helper trait to encapsulate requirements for a type to be used as input for [`BlockExecutor`].
Expand Down
7 changes: 7 additions & 0 deletions crates/evm/src/block/state_changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,19 @@ where
// Ommer rewards
for ommer in ommers {
*balance_increments.entry(ommer.beneficiary()).or_default() += calc::ommer_reward(
//bal
base_block_reward,
block_env.number.saturating_to(),
ommer.number(),
);
}

// Full block reward
tracing::debug!(
"Adding block reward of {} to beneficiary {:?}",
calc::block_reward(base_block_reward, ommers.len()),
block_env.beneficiary
);
*balance_increments.entry(block_env.beneficiary).or_default() +=
calc::block_reward(base_block_reward, ommers.len());
}
Expand Down Expand Up @@ -131,6 +137,7 @@ where
storage: Default::default(),
status: AccountStatus::Touched,
transaction_id: 0,
..Default::default()
},
))
};
Expand Down
58 changes: 50 additions & 8 deletions crates/evm/src/block/system_calls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ use crate::{
block::{BlockExecutionError, OnStateHook},
Evm,
};
use alloc::{borrow::Cow, boxed::Box};
use alloc::{borrow::Cow, boxed::Box, vec::Vec};
use alloy_consensus::BlockHeader;
use alloy_eips::{
eip7002::WITHDRAWAL_REQUEST_TYPE, eip7251::CONSOLIDATION_REQUEST_TYPE, eip7685::Requests,
eip2935::{HISTORY_SERVE_WINDOW, HISTORY_STORAGE_ADDRESS},
eip7002::WITHDRAWAL_REQUEST_TYPE,
eip7251::CONSOLIDATION_REQUEST_TYPE,
eip7685::Requests,
eip7928::{AccountChanges, SlotChanges, StorageChange},
};
use alloy_hardforks::EthereumHardforks;
use alloy_primitives::{Bytes, B256};
use alloy_primitives::{Bytes, B256, U256};
use revm::{state::EvmState, DatabaseCommit};

use super::{StateChangePostBlockSource, StateChangePreBlockSource, StateChangeSource};
Expand Down Expand Up @@ -88,7 +92,7 @@ where
&mut self,
parent_block_hash: B256,
evm: &mut impl Evm<DB: DatabaseCommit>,
) -> Result<(), BlockExecutionError> {
) -> Result<Option<AccountChanges>, BlockExecutionError> {
let result_and_state =
eip2935::transact_blockhashes_contract_call(&self.spec, parent_block_hash, evm)?;

Expand All @@ -100,17 +104,31 @@ where
);
}
evm.db_mut().commit(res.state);

if self.spec.is_amsterdam_active_at_timestamp(evm.block().timestamp.saturating_to()) {
let block_num: u64 = evm.block().number.saturating_to();
let slot_change = SlotChanges::default()
.with_change(StorageChange {
block_access_index: 0,
new_value: parent_block_hash,
})
.with_slot(U256::from((block_num - 1) % HISTORY_SERVE_WINDOW as u64).into());
let acc_changes = AccountChanges::default()
.with_storage_change(slot_change)
.with_address(HISTORY_STORAGE_ADDRESS);
return Ok(Some(acc_changes));
}
}

Ok(())
Ok(None)
}

/// Applies the pre-block call to the EIP-4788 beacon root contract.
pub fn apply_beacon_root_contract_call(
&mut self,
parent_beacon_block_root: Option<B256>,
evm: &mut impl Evm<DB: DatabaseCommit>,
) -> Result<(), BlockExecutionError> {
) -> Result<Option<Vec<SlotChanges>>, BlockExecutionError> {
let result_and_state =
eip4788::transact_beacon_root_contract_call(&self.spec, parent_beacon_block_root, evm)?;

Expand All @@ -122,9 +140,33 @@ where
);
}
evm.db_mut().commit(res.state);
if self.spec.is_amsterdam_active_at_timestamp(evm.block().timestamp.saturating_to()) {
let timestamp: u64 = evm.block().timestamp.saturating_to();
let slot_changes: Vec<SlotChanges> = alloc::vec![
SlotChanges::default()
.with_change(StorageChange {
block_access_index: 0,
new_value: U256::from(timestamp).into(),
})
.with_slot(U256::from(timestamp % HISTORY_SERVE_WINDOW as u64).into()),
SlotChanges::default()
.with_change(StorageChange {
block_access_index: 0,
new_value: parent_beacon_block_root.unwrap(),
})
.with_slot(
U256::from(
(timestamp % HISTORY_SERVE_WINDOW as u64)
+ HISTORY_SERVE_WINDOW as u64,
)
.into(),
),
];

return Ok(Some(slot_changes));
}
}

Ok(())
Ok(None)
}

/// Applies the post-block call to the EIP-7002 withdrawal request contract.
Expand Down
Loading