Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Oct 7, 2024
1 parent 1fbe242 commit 94fd9e5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth" }
reth-provider = { git = "https://github.com/paradigmxyz/reth" }
reth-revm = { git = "https://github.com/paradigmxyz/reth" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth" }
reth-tracing = { git = "https://github.com/paradigmxyz/reth" }

# alloy
Expand Down
4 changes: 2 additions & 2 deletions rollup/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ reth-tracing.workspace = true
reth.workspace = true

# alloy
alloy-consensus.workspace = true
alloy-consensus = { workspace = true, features = ["k256"] }
alloy-eips.workspace = true
alloy-genesis = "0.4"
alloy-primitives.workspace = true
Expand All @@ -41,4 +41,4 @@ serde_json = "1"
[dev-dependencies]
reth-testing-utils.workspace = true
secp256k1 = "0.29"

reth-transaction-pool = { workspace = true, features = ["test-utils"] }
25 changes: 13 additions & 12 deletions rollup/src/execution.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{db::Database, Zenith, CHAIN_ID, CHAIN_SPEC};
use alloy_consensus::{Blob, SidecarCoder, SimpleCoder};
use alloy_eips::eip4844::kzg_to_versioned_hash;
use alloy_eips::{eip2718::Decodable2718, eip4844::kzg_to_versioned_hash};
use alloy_primitives::{keccak256, Address, Bytes, B256, U256};
use alloy_rlp::Decodable as _;
use eyre::OptionExt;
Expand Down Expand Up @@ -174,14 +174,15 @@ async fn decode_transactions<Pool: TransactionPool>(
}

// Decode block data, filter only transactions with the correct chain ID and recover senders
let transactions = Vec::<TransactionSigned>::decode(&mut raw_transactions.as_ref())?
.into_iter()
.filter(|tx| tx.chain_id() == Some(CHAIN_ID))
.map(|tx| {
let raw_transactions: Vec<Vec<u8>> = alloy_rlp::decode_exact(raw_transactions.as_ref())?;
let mut transactions = Vec::with_capacity(raw_transactions.len());
for raw_transaction in raw_transactions {
let tx = TransactionSigned::decode_2718(&mut &raw_transaction[..])?;
if tx.chain_id() == Some(CHAIN_ID) {
let sender = tx.recover_signer().ok_or(eyre::eyre!("failed to recover signer"))?;
Ok((tx, sender))
})
.collect::<eyre::Result<_>>()?;
transactions.push((tx, sender));
}
}

Ok(transactions)
}
Expand Down Expand Up @@ -266,10 +267,6 @@ mod tests {
use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::{bytes, keccak256, BlockNumber, TxKind, U256};
use alloy_sol_types::{sol, SolCall};
use reth::transaction_pool::{
test_utils::{testing_pool, MockTransaction},
TransactionOrigin, TransactionPool,
};
use reth_primitives::{
constants::ETH_TO_WEI,
public_key_to_address,
Expand All @@ -278,6 +275,10 @@ mod tests {
};
use reth_revm::Evm;
use reth_testing_utils::generators::{self, sign_tx_with_key_pair};
use reth_transaction_pool::{
test_utils::{testing_pool, MockTransaction},
TransactionOrigin, TransactionPool,
};
use rusqlite::Connection;
use secp256k1::{Keypair, Secp256k1};

Expand Down

0 comments on commit 94fd9e5

Please sign in to comment.