Skip to content

Commit b25c897

Browse files
committed
chore: more alloy num changes
1 parent 522654f commit b25c897

File tree

7 files changed

+12
-16
lines changed

7 files changed

+12
-16
lines changed

examples/trevm_block_driver_example.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ struct SimpleBlock {
3838

3939
impl Block for SimpleBlock {
4040
fn fill_block_env(&self, block_env: &mut BlockEnv) {
41-
block_env.number = self.number;
42-
block_env.timestamp = self.timestamp;
41+
block_env.number = U256::from(self.number);
42+
block_env.timestamp = U256::from(self.timestamp);
4343
block_env.gas_limit = 30_000_000u64; // 30M gas limit
4444
}
4545
}

examples/tx_tracer_cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
7979

8080
// Prepare block environment
8181
let mut block_env = BlockEnv::default();
82-
block_env.number = 1;
83-
block_env.timestamp = 1234567890;
82+
block_env.number = U256::from(1u64);
83+
block_env.timestamp = U256::from(1234567890u64);
8484
block_env.gas_limit = 30_000_000;
8585
block_env.basefee = 1_000_000_000; // 1 gwei
8686
block_env.beneficiary = Address::with_last_byte(255);

src/fill/alloy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl Block for alloy::consensus::Header {
299299

300300
if let Some(excess_blob_gas) = self.excess_blob_gas {
301301
block_env
302-
.set_blob_excess_gas_and_price(excess_blob_gas, self.withdrawals_root.is_some());
302+
.set_blob_excess_gas_and_price(excess_blob_gas, revm::primitives::eip4844::BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE);
303303
}
304304
}
305305

@@ -329,7 +329,7 @@ impl Block for alloy::rpc::types::eth::Header {
329329
*prevrandao = Some(self.mix_hash);
330330
*blob_excess_gas_and_price = self
331331
.blob_gas_used
332-
.map(|bgu| BlobExcessGasAndPrice::new(bgu, self.withdrawals_root.is_some()));
332+
.map(|bgu| BlobExcessGasAndPrice::new(bgu, revm::primitives::eip4844::BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE));
333333
}
334334
}
335335

src/fill/traits.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,16 @@ mod test {
197197
prevrandao,
198198
blob_excess_gas_and_price,
199199
} = block_env;
200-
*number = 1;
200+
*number = U256::ONE;
201201
*beneficiary = Default::default();
202-
*timestamp = 1720450148; // Time when I was writing the test code
202+
*timestamp = U256::from(1720450148u64); // Time when I was writing the test code
203203
*gas_limit = 30_000_000;
204204
*basefee = 5 * GWEI_TO_WEI;
205205

206206
let diff = B256::repeat_byte(0xab);
207207
*prevrandao = Some(diff);
208208
*difficulty = U256::from_be_bytes(diff.into());
209-
*blob_excess_gas_and_price = Some(BlobExcessGasAndPrice::new(1_000_000, false));
209+
*blob_excess_gas_and_price = Some(BlobExcessGasAndPrice::new(1_000_000, revm::primitives::eip4844::BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE));
210210
}
211211

212212
fn tx_count_hint(&self) -> Option<usize> {

src/journal/coder.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -686,20 +686,16 @@ mod test {
686686
roundtrip(&changed_acc);
687687

688688
let bytecode = Bytecode::new_raw(Bytes::from(vec![1, 2, 3]));
689-
let eof_bytes = Bytecode::Eof(Arc::new(Eof::default()));
690689
roundtrip(&bytecode);
691-
roundtrip(&eof_bytes);
692690

693691
let bsi = BundleStateIndex {
694692
state: vec![
695693
(Address::repeat_byte(0xa), created_acc),
696-
(Address::repeat_byte(0xb), changed_acc),
697694
]
698695
.into_iter()
699696
.collect(),
700697
new_contracts: vec![
701698
(B256::repeat_byte(0xa), Cow::Owned(bytecode)),
702-
(B256::repeat_byte(0xb), Cow::Owned(eof_bytes)),
703699
]
704700
.into_iter()
705701
.collect(),

src/system/eip2935.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ mod test {
7575
let mut trevm = crate::test_utils::test_trevm().fill_cfg(&NoopCfg).fill_block(&NoopBlock);
7676

7777
trevm.inner_mut_unchecked().modify_block(|block| {
78-
block.number = block_num;
78+
block.number = U256::from(block_num);
7979
});
8080

8181
// we set the previous block hash in the cachedb, as it will be loaded
8282
// during eip application
83-
trevm.inner_mut_unchecked().db().cache.block_hashes.insert(prev_block_num, prev_hash);
83+
trevm.inner_mut_unchecked().db_mut().cache.block_hashes.insert(prev_block_num, prev_hash);
8484

8585
trevm.apply_eip2935().unwrap();
8686

src/system/eip4788.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ mod test {
8989
let mut trevm = crate::test_utils::test_trevm().fill_cfg(&NoopCfg).fill_block(&NoopBlock);
9090

9191
trevm.inner_mut_unchecked().modify_block(|block| {
92-
block.timestamp = timestamp;
92+
block.timestamp = U256::from(timestamp);
9393
});
9494

9595
let parent_beacon_root = B256::repeat_byte(0xaa);

0 commit comments

Comments
 (0)