Skip to content

Commit 3e5adcd

Browse files
committed
fix ut
1 parent 16751ab commit 3e5adcd

10 files changed

Lines changed: 172 additions & 365 deletions

File tree

Cargo.lock

Lines changed: 139 additions & 359 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ alloy-transport-ipc = { version = "1.0.23", default-features = false }
559559
alloy-transport-ws = { version = "1.0.23", default-features = false }
560560

561561
# op
562-
alloy-op-evm = { version = "0.15", default-features = false }
562+
alloy-op-evm = { package = "alloy-op-evm", git = "https://github.com/Galxe/alloy-evm", branch = "v0.15.0-gravity" , default-features = false }
563563
alloy-op-hardforks = "0.2.2"
564564
op-alloy-rpc-types = { version = "0.18.12", default-features = false }
565565
op-alloy-rpc-types-engine = { version = "0.18.12", default-features = false }

crates/engine/tree/src/tree/tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ fn test_tree_state_on_new_head_deep_fork() {
627627
hashed_state: Arc::new(HashedPostState::default()),
628628
},
629629
trie: ExecutedTrieUpdates::empty(),
630+
triev2: Default::default(),
630631
});
631632
}
632633
test_harness.tree.state.tree_state.set_canonical_head(chain_a.last().unwrap().num_hash());
@@ -639,6 +640,7 @@ fn test_tree_state_on_new_head_deep_fork() {
639640
hashed_state: Arc::new(HashedPostState::default()),
640641
},
641642
trie: ExecutedTrieUpdates::empty(),
643+
triev2: Default::default(),
642644
});
643645
}
644646

crates/optimism/evm/src/lib.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
extern crate alloc;
1313

14-
use alloc::sync::Arc;
14+
use alloc::{boxed::Box, sync::Arc};
1515
use alloy_consensus::{BlockHeader, Header};
1616
use alloy_evm::{FromRecoveredTx, FromTxWithEncoded};
1717
use alloy_op_evm::{block::receipt_builder::OpReceiptBuilder, OpBlockExecutionCtx};
@@ -216,6 +216,18 @@ where
216216
extra_data: attributes.extra_data,
217217
}
218218
}
219+
220+
fn parallel_executor<'a, DB: reth_evm::ParallelDatabase + 'a>(
221+
&self,
222+
_db: DB,
223+
) -> Box<
224+
dyn reth_evm::parallel_execute::ParallelExecutor<
225+
Primitives = Self::Primitives,
226+
Error = reth_execution_errors::BlockExecutionError,
227+
> + 'a,
228+
> {
229+
todo!()
230+
}
219231
}
220232
#[cfg(test)]
221233
mod tests {

crates/optimism/payload/src/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ impl<Txs> OpBuilder<'_, Txs> {
342342
hashed_state: Arc::new(hashed_state),
343343
},
344344
trie: ExecutedTrieUpdates::Present(Arc::new(trie_updates)),
345+
triev2: Default::default(),
345346
};
346347

347348
let no_tx_pool = ctx.attributes().no_tx_pool;

crates/optimism/txpool/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ reth-primitives-traits.workspace = true
2727
reth-chain-state.workspace = true
2828
reth-storage-api.workspace = true
2929
reth-transaction-pool.workspace = true
30+
gravity-storage.workspace = true
3031

3132
# revm
3233
op-revm.workspace = true

crates/optimism/txpool/src/validator.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::{supervisor::SupervisorClient, InvalidCrossTx, OpPooledTx};
22
use alloy_consensus::{BlockHeader, Transaction};
3+
use gravity_storage::block_view_storage::BlockViewProvider;
34
use op_revm::L1BlockInfo;
45
use parking_lot::RwLock;
56
use reth_chainspec::ChainSpecProvider;
@@ -8,7 +9,7 @@ use reth_optimism_forks::OpHardforks;
89
use reth_primitives_traits::{
910
transaction::error::InvalidTransactionError, Block, BlockBody, GotExpected, SealedBlock,
1011
};
11-
use reth_storage_api::{AccountInfoReader, BlockReaderIdExt, StateProviderFactory};
12+
use reth_storage_api::{BlockReaderIdExt, StateProviderFactory};
1213
use reth_transaction_pool::{
1314
error::InvalidPoolTransactionError, EthPoolTransaction, EthTransactionValidator,
1415
TransactionOrigin, TransactionValidationOutcome, TransactionValidator,
@@ -181,7 +182,7 @@ where
181182
&self,
182183
origin: TransactionOrigin,
183184
transaction: Tx,
184-
state: &mut Option<Box<dyn AccountInfoReader>>,
185+
state: &mut Option<BlockViewProvider>,
185186
) -> TransactionValidationOutcome<Tx> {
186187
if transaction.is_eip4844() {
187188
return TransactionValidationOutcome::Invalid(

crates/stages/stages/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ reth-trie = { workspace = true, features = ["test-utils"] }
8484
reth-provider = { workspace = true, features = ["test-utils"] }
8585
reth-network-peers.workspace = true
8686
reth-tracing.workspace = true
87+
reth-trie-db.workspace = true
8788

8889
alloy-primitives = { workspace = true, features = ["getrandom", "rand"] }
8990
alloy-rlp.workspace = true
@@ -116,6 +117,7 @@ test-utils = [
116117
"reth-revm/test-utils",
117118
"reth-codecs/test-utils",
118119
"reth-db-api/test-utils",
120+
"reth-trie-db/test-utils",
119121
"reth-trie-parallel/test-utils",
120122
"reth-trie/test-utils",
121123
"reth-prune-types/test-utils",

crates/stages/stages/src/stages/merkle.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ mod tests {
336336
self, random_block, random_block_range, random_changeset_range,
337337
random_contract_account_range, BlockParams, BlockRangeParams,
338338
};
339+
use reth_trie::StateRoot;
340+
use reth_trie_db::DatabaseStateRoot;
339341
use reth_trie::test_utils::{state_root, state_root_prehashed};
340342
use std::collections::BTreeMap;
341343

crates/storage/db/src/implementation/mdbx/parallel_tx.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub struct ParallelTxRO {
2424
env: Environment,
2525
metrics: Option<Arc<DatabaseEnvMetrics>>,
2626
max_txs: usize,
27+
disable_long_read_transaction_safety: bool,
2728
}
2829

2930
#[derive(Debug)]
@@ -59,6 +60,7 @@ impl ParallelTxRO {
5960
max_txs: 8,
6061
env,
6162
metrics,
63+
disable_long_read_transaction_safety: false,
6264
})
6365
}
6466

@@ -69,7 +71,10 @@ impl ParallelTxRO {
6971
inner.num_txs += 1;
7072
drop(inner);
7173
match create_tx(&self.env, self.metrics.clone()) {
72-
Ok(tx) => {
74+
Ok(mut tx) => {
75+
if self.disable_long_read_transaction_safety {
76+
tx.disable_long_read_transaction_safety();
77+
}
7378
let tx = Arc::new(tx);
7479
let tx_clone: Arc<Tx<RO>> = tx.clone();
7580
let mut inner = self.inner.lock().unwrap();
@@ -232,7 +237,8 @@ impl DbTx for ParallelTxRO {
232237
}
233238

234239
fn disable_long_read_transaction_safety(&mut self) {
235-
// Do nothing.
240+
self.tx.disable_long_read_transaction_safety();
241+
self.disable_long_read_transaction_safety = true;
236242
}
237243
}
238244

0 commit comments

Comments
 (0)