Skip to content

Commit f771d1d

Browse files
authored
chore: move Block impl for ZenithCallBundle to trevm (#73)
As we moved out these types to zenith-types, we need to move this type impl here. Closes ENG-728
1 parent c4cc25a commit f771d1d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ alloy = { version = "=0.7.3", default-features = false, features = ["consensus",
3636

3737
revm = { version = "18.0.0", default-features = false, features = ["std"] }
3838

39-
zenith-types = { version = "0.12" }
39+
zenith-types = { version = "0.13" }
4040

4141
dashmap = { version = "6.1.0", optional = true }
4242

src/fill/zenith.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use crate::Tx;
1+
use crate::{Block, Tx};
22
use alloy_primitives::{Address, U256};
33
use alloy_sol_types::SolCall;
44
use revm::primitives::{TransactTo, TxEnv};
5-
use zenith_types::{Passage::EnterToken, Transactor};
5+
use zenith_types::{Passage::EnterToken, Transactor, ZenithCallBundle};
66

77
impl Tx for Transactor::Transact {
88
fn fill_tx_env(&self, tx_env: &mut revm::primitives::TxEnv) {
@@ -79,3 +79,15 @@ impl Tx for EnterToken {
7979
authorization_list.take();
8080
}
8181
}
82+
83+
impl Block for ZenithCallBundle {
84+
fn fill_block_env(&self, block_env: &mut revm::primitives::BlockEnv) {
85+
block_env.number =
86+
self.bundle.state_block_number.as_number().map(U256::from).unwrap_or(block_env.number);
87+
block_env.timestamp = self.bundle.timestamp.map(U256::from).unwrap_or(block_env.timestamp);
88+
block_env.gas_limit = self.bundle.gas_limit.map(U256::from).unwrap_or(block_env.gas_limit);
89+
block_env.difficulty =
90+
self.bundle.difficulty.map(U256::from).unwrap_or(block_env.difficulty);
91+
block_env.basefee = self.bundle.base_fee.map(U256::from).unwrap_or(block_env.basefee);
92+
}
93+
}

0 commit comments

Comments
 (0)