Skip to content

Commit 32a888b

Browse files
Evalirprestwich
andauthored
feat(deps): bump revm/reth (#84)
* feat(deps): bump revm/reth * chore: compatible bumps * chore: fixes * lint: clippy --------- Co-authored-by: James <[email protected]>
1 parent 609f8b9 commit 32a888b

File tree

11 files changed

+57
-75
lines changed

11 files changed

+57
-75
lines changed

Cargo.toml

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,41 +49,38 @@ signet-zenith = { version = "0.5.0", path = "crates/zenith" }
4949
ajj = { version = "0.3.4" }
5050

5151
# trevm
52-
trevm = { version = "0.23.7", features = ["full_env_cfg"] }
52+
trevm = { version = "0.27.0", features = ["full_env_cfg"] }
5353

5454
# Alloy periphery crates
55-
alloy = { version = "=1.0.11", features = [
55+
alloy = { version = "1.0.19", features = [
5656
"full",
5757
"rpc-types-mev",
5858
"genesis",
5959
"arbitrary",
6060
] }
61-
alloy-contract = { version = "=1.0.11", features = ["pubsub"] }
62-
alloy-trie = { version = "=0.8.1" }
63-
alloy-genesis = { version = "=1.0.11" }
64-
alloy-consensus = { version = "=1.0.11" }
61+
alloy-contract = { version = "1.0.19", features = ["pubsub"] }
6562

6663
# Reth
67-
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
68-
reth-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
69-
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
70-
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
71-
reth-db-common = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
72-
reth-eth-wire-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
73-
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
74-
reth-exex = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
75-
reth-exex-test-utils = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
76-
reth-network-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
77-
reth-network-peers = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
78-
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
79-
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
80-
reth-prune-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
81-
reth-rpc-eth-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
82-
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
83-
reth-trie-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.3" }
64+
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
65+
reth-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
66+
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
67+
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
68+
reth-db-common = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
69+
reth-eth-wire-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
70+
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
71+
reth-exex = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
72+
reth-exex-test-utils = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
73+
reth-network-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
74+
reth-network-peers = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
75+
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
76+
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
77+
reth-prune-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
78+
reth-rpc-eth-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
79+
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
80+
reth-trie-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
8481

8582
# Foundry periphery
86-
foundry-blob-explorers = "0.10"
83+
foundry-blob-explorers = "0.17"
8784

8885
# Async
8986
tokio = { version = "1.43.0", features = ["macros"] }

crates/bundle/src/call/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ where
117117

118118
// Check if the block we're in is valid for this bundle. Both must match
119119
trevm_ensure!(
120-
trevm.block_number() == bundle.block_number,
120+
trevm.block_number().to::<u64>() == bundle.block_number,
121121
trevm,
122122
BundleError::BlockNumberMismatch
123123
);
124124
// Set the state block number this simulation was based on
125-
self.response.state_block_number = trevm.block_number();
125+
self.response.state_block_number = trevm.block_number().to();
126126

127127
// Check if the state block number is valid (not 0, and not a tag)
128128
trevm_ensure!(

crates/bundle/src/call/trevm.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::SignetCallBundle;
2+
use alloy::primitives::U256;
23
use trevm::{revm::context::BlockEnv, Block};
34

45
impl Block for SignetCallBundle {
@@ -14,9 +15,9 @@ impl Block for SignetCallBundle {
1415
blob_excess_gas_and_price: _,
1516
} = block_env;
1617

17-
*number = self.bundle.state_block_number.as_number().unwrap_or(*number);
18+
*number = self.bundle.state_block_number.as_number().map(U256::from).unwrap_or(*number);
1819
*beneficiary = self.bundle.coinbase.unwrap_or(*beneficiary);
19-
*timestamp = self.bundle.timestamp.unwrap_or(*timestamp);
20+
*timestamp = self.bundle.timestamp.map(U256::from).unwrap_or(*timestamp);
2021
*gas_limit = self.bundle.gas_limit.unwrap_or(*gas_limit);
2122
*difficulty = self.bundle.difficulty.unwrap_or(*difficulty);
2223
*basefee =

crates/bundle/src/send/driver.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,21 @@ where
122122

123123
// Check if the block we're in is valid for this bundle. Both must match
124124
trevm_ensure!(
125-
trevm.block_number() == bundle.block_number,
125+
trevm.block_number().to::<u64>() == bundle.block_number,
126126
trevm,
127127
BundleError::BlockNumberMismatch.into()
128128
);
129129

130130
// Check if the state block number is valid (not 0, and not a tag)
131131
let timestamp = trevm.block_timestamp();
132132
trevm_ensure!(
133-
timestamp >= bundle.min_timestamp.unwrap_or_default()
134-
&& timestamp <= bundle.max_timestamp.unwrap_or(u64::MAX),
133+
self.bundle.is_valid_at_timestamp(timestamp.to()),
135134
trevm,
136135
BundleError::TimestampOutOfRange.into()
137136
);
138137

139138
// Check that the `SignedFill` is valid at the timestamp.
140-
if self.bundle().validate_fills_offchain(timestamp).is_err() {
139+
if self.bundle().validate_fills_offchain(timestamp.to()).is_err() {
141140
return Err(trevm.errored(BundleError::BundleReverted.into()));
142141
}
143142

crates/constants/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ repository.workspace = true
1111

1212
[dependencies]
1313
alloy.workspace = true
14-
alloy-trie.workspace = true
15-
alloy-genesis.workspace = true
16-
alloy-consensus.workspace = true
1714

1815
serde.workspace = true
1916
serde_json.workspace = true

crates/constants/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ pub use chains::pecorino;
2121
#[cfg(any(test, feature = "test-utils"))]
2222
pub use chains::test_utils;
2323

24-
use alloy_consensus as _;
25-
use alloy_genesis as _;
26-
use alloy_trie as _;
27-
2824
mod types;
2925
pub use types::{
3026
ConfigError, HostConstants, KnownChains, PairedHeights, ParseChainError, PermissionedToken,

crates/evm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ signet-extract.workspace = true
1414
signet-types.workspace = true
1515
signet-zenith.workspace = true
1616

17-
trevm = { workspace = true, features = ["secp256r1"] }
17+
trevm.workspace = true
1818

1919
alloy.workspace = true
2020

crates/evm/src/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,9 +950,9 @@ impl<C: Extractable> trevm::Block for SignetDriver<'_, '_, C> {
950950
prevrandao,
951951
blob_excess_gas_and_price,
952952
} = block_env;
953-
*number = self.ru_height();
953+
*number = U256::from(self.ru_height());
954954
*beneficiary = self.beneficiary();
955-
*timestamp = self.extracts.host_block.timestamp();
955+
*timestamp = U256::from(self.extracts.host_block.timestamp());
956956
*gas_limit = self.gas_limit();
957957
*basefee = self.base_fee();
958958
*difficulty = self.extracts.host_block.difficulty();

crates/evm/src/orders/inspector.rs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ use trevm::{
99
helpers::Ctx,
1010
revm::{
1111
interpreter::{
12-
CallInputs, CallOutcome, CreateInputs, CreateOutcome, EOFCreateInputs, Interpreter,
13-
InterpreterTypes,
12+
CallInputs, CallOutcome, CreateInputs, CreateOutcome, Interpreter, InterpreterTypes,
1413
},
1514
Database, Inspector,
1615
},
@@ -147,28 +146,6 @@ where
147146
}
148147
}
149148

150-
fn eofcreate(
151-
&mut self,
152-
_context: &mut Ctx<Db>,
153-
_inputs: &mut EOFCreateInputs,
154-
) -> Option<CreateOutcome> {
155-
self.orders.enter_frame();
156-
None
157-
}
158-
159-
fn eofcreate_end(
160-
&mut self,
161-
_context: &mut Ctx<Db>,
162-
_inputs: &EOFCreateInputs,
163-
outcome: &mut CreateOutcome,
164-
) {
165-
if outcome.result.is_ok() {
166-
self.orders.exit_frame();
167-
} else {
168-
self.orders.revert_frame();
169-
}
170-
}
171-
172149
fn selfdestruct(&mut self, _contract: Address, _target: Address, _value: U256) {
173150
self.orders.exit_frame();
174151
}

crates/rpc/src/ctx.rs

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ use reth::{
2323
},
2424
revm::{database::StateProviderDatabase, primitives::hardfork::SpecId},
2525
rpc::{
26-
compat::block::from_block,
27-
eth::{filter::EthFilterError, EthTxBuilder},
26+
eth::{filter::EthFilterError, helpers::types::EthRpcConverter},
2827
server_types::eth::{
2928
fee_history::{
3029
calculate_reward_percentiles_for_block, fee_history_cache_new_blocks_task,
@@ -39,7 +38,7 @@ use reth::{
3938
};
4039
use reth_chainspec::{BaseFeeParams, ChainSpec, ChainSpecProvider};
4140
use reth_node_api::{BlockBody, FullNodeComponents};
42-
use reth_rpc_eth_api::{RpcBlock, RpcReceipt, RpcTransaction};
41+
use reth_rpc_eth_api::{RpcBlock, RpcConvert, RpcReceipt, RpcTransaction};
4342
use signet_evm::EvmNeedsTx;
4443
use signet_tx_cache::client::TxCache;
4544
use signet_types::{constants::SignetSystemConstants, MagicSig};
@@ -203,7 +202,7 @@ where
203202

204203
// Gas stuff
205204
gas_oracle: GasPriceOracle<BlockchainProvider<Inner>>,
206-
fee_history: FeeHistoryCache,
205+
fee_history: FeeHistoryCache<reth::primitives::Header>,
207206

208207
// Tx stuff
209208
tx_cache: Option<TxCache>,
@@ -326,6 +325,11 @@ where
326325
self.cache.get_recovered_block(hash).await.map_err(Into::into).map(|b| b.map(|b| (hash, b)))
327326
}
328327

328+
/// Create a transaction response builder for the RPC API.
329+
pub const fn tx_resp_builder(&self) -> EthRpcConverter {
330+
EthRpcConverter::new()
331+
}
332+
329333
/// Get the block for a given block, formatting the block for
330334
/// the RPC API.
331335
pub async fn block(
@@ -341,7 +345,11 @@ where
341345
return Ok(None);
342346
};
343347

344-
from_block((*block).clone(), full.unwrap_or_default().into(), &EthTxBuilder::default())
348+
(*block)
349+
.clone()
350+
.into_rpc_block(full.unwrap_or_default().into(), |tx, tx_info| {
351+
self.tx_resp_builder().fill(tx, tx_info)
352+
})
345353
.map(Some)
346354
}
347355

@@ -627,7 +635,10 @@ where
627635
}
628636

629637
for entry in &fee_entries {
630-
base_fee_per_gas.push(entry.base_fee_per_gas as u128);
638+
base_fee_per_gas.push(
639+
entry.header.base_fee_per_gas().expect("signet only has post-eip1559 headers")
640+
as u128,
641+
);
631642
gas_used_ratio.push(entry.gas_used_ratio);
632643

633644
if let Some(percentiles) = &reward_percentiles {
@@ -642,8 +653,12 @@ where
642653

643654
// Also need to include the `base_fee_per_gas` and `base_fee_per_blob_gas` for the
644655
// next block
645-
base_fee_per_gas
646-
.push(last_entry.next_block_base_fee(self.provider().chain_spec()) as u128);
656+
base_fee_per_gas.push(
657+
last_entry
658+
.header
659+
.next_block_base_fee(BaseFeeParams::ethereum())
660+
.expect("signet only has post-eip1559 headers") as u128,
661+
);
647662
} else {
648663
// read the requested header range
649664
let headers = self.provider().sealed_headers_range(start_block..=end_block)?;

0 commit comments

Comments
 (0)