Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ercecan committed Dec 17, 2024
1 parent bb24a36 commit cb58a85
Show file tree
Hide file tree
Showing 25 changed files with 40 additions and 27 deletions.
5 changes: 5 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion bin/citrea/tests/bitcoin_e2e/batch_prover_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::net::SocketAddr;
use std::sync::Arc;
use std::time::{Duration, Instant};

use alloy_primitives::{Address, U64};
use anyhow::bail;
use async_trait::async_trait;
use bitcoin_da::service::{BitcoinService, BitcoinServiceConfig, FINALITY_DEPTH};
Expand All @@ -18,7 +19,6 @@ use citrea_e2e::test_case::{TestCase, TestCaseRunner};
use citrea_e2e::traits::NodeT;
use citrea_e2e::Result;
use citrea_primitives::{TO_BATCH_PROOF_PREFIX, TO_LIGHT_CLIENT_PREFIX};
use reth_primitives::{Address, U64};
use sov_ledger_rpc::LedgerRpcClient;
use sov_rollup_interface::da::{DaData, SequencerCommitment};
use sov_rollup_interface::rpc::VerifiedBatchProofResponse;
Expand Down
2 changes: 1 addition & 1 deletion bin/citrea/tests/bitcoin_e2e/bitcoin_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::time::Duration;

use alloy_primitives::U64;
use anyhow::bail;
use async_trait::async_trait;
use bitcoin::Txid;
Expand All @@ -13,7 +14,6 @@ use citrea_e2e::framework::TestFramework;
use citrea_e2e::test_case::{TestCase, TestCaseRunner};
use citrea_e2e::traits::Restart;
use citrea_e2e::Result;
use reth_primitives::U64;
use sov_ledger_rpc::LedgerRpcClient;
use tokio::time::sleep;

Expand Down
2 changes: 1 addition & 1 deletion bin/citrea/tests/bitcoin_e2e/light_client_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::time::Duration;

use alloy_primitives::U64;
use async_trait::async_trait;
use bitcoin_da::service::FINALITY_DEPTH;
use citrea_batch_prover::rpc::BatchProverRpcClient;
Expand All @@ -12,7 +13,6 @@ use citrea_e2e::framework::TestFramework;
use citrea_e2e::test_case::{TestCase, TestCaseRunner};
use citrea_e2e::Result;
use citrea_light_client_prover::rpc::LightClientProverRpcClient;
use reth_primitives::U64;
use sov_ledger_rpc::LedgerRpcClient;

use super::batch_prover_test::wait_for_zkproofs;
Expand Down
2 changes: 1 addition & 1 deletion bin/citrea/tests/bitcoin_e2e/sequencer_commitments.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::time::{Duration, Instant};

use alloy_primitives::U64;
use anyhow::bail;
use async_trait::async_trait;
use bitcoin::hashes::Hash;
Expand All @@ -14,7 +15,6 @@ use citrea_e2e::sequencer::Sequencer;
use citrea_e2e::test_case::{TestCase, TestCaseRunner};
use citrea_e2e::Result;
use citrea_primitives::TO_BATCH_PROOF_PREFIX;
use reth_primitives::U64;
use rs_merkle::algorithms::Sha256;
use rs_merkle::MerkleTree;
use sov_ledger_rpc::LedgerRpcClient;
Expand Down
2 changes: 1 addition & 1 deletion bin/citrea/tests/bitcoin_e2e/sequencer_test.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use alloy_primitives::U64;
use anyhow::bail;
use async_trait::async_trait;
use citrea_e2e::config::SequencerConfig;
use citrea_e2e::framework::TestFramework;
use citrea_e2e::test_case::{TestCase, TestCaseRunner};
use citrea_e2e::traits::Restart;
use citrea_e2e::Result;
use reth_primitives::U64;
use sov_ledger_rpc::LedgerRpcClient;

use super::get_citrea_path;
Expand Down
3 changes: 1 addition & 2 deletions bin/citrea/tests/test_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ use jsonrpsee::http_client::{HttpClient, HttpClientBuilder};
use jsonrpsee::rpc_params;
use jsonrpsee::ws_client::{PingConfig, WsClient, WsClientBuilder};
use reth_primitives::{BlockId, BlockNumberOrTag};
use sequencer_client::GetSoftConfirmationResponse;
use sov_ledger_rpc::client::LedgerRpcClient;
use sov_ledger_rpc::HexHash;
use sov_ledger_rpc::LedgerRpcClient;
use sov_rollup_interface::rpc::{
BatchProofResponse, LastVerifiedBatchProofResponse, SequencerCommitmentResponse,
SoftConfirmationResponse, SoftConfirmationStatus, VerifiedBatchProofResponse,
Expand Down
1 change: 1 addition & 0 deletions crates/batch-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ parking_lot = { workspace = true }
rand = { workspace = true }
rayon = { workspace = true }
reth-primitives = { workspace = true }
alloy-primitives = { workspace = true }
rs_merkle = { workspace = true }
serde = { workspace = true }
tokio = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/batch-prover/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::net::SocketAddr;
use std::sync::Arc;
use std::time::{Duration, Instant};

use alloy_primitives::U64;
use anyhow::{anyhow, bail, Context as _};
use backoff::exponential::ExponentialBackoffBuilder;
use backoff::future::retry as retry_backoff;
Expand All @@ -17,7 +18,6 @@ use jsonrpsee::core::client::Error as JsonrpseeError;
use jsonrpsee::http_client::{HttpClient, HttpClientBuilder};
use jsonrpsee::server::{BatchRequestConfig, ServerBuilder};
use jsonrpsee::RpcModule;
use reth_primitives::U64;
use sov_db::ledger_db::BatchProverLedgerOps;
use sov_db::schema::types::{BatchNumber, SlotNumber};
use sov_ledger_rpc::LedgerRpcClient;
Expand Down
1 change: 1 addition & 0 deletions crates/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ hyper = { workspace = true }
jsonrpsee = { workspace = true, features = ["http-client", "server"] }
lru = { workspace = true }
reth-primitives = { workspace = true }
alloy-primitives = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/da.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::sync::Arc;
use std::time::Duration;

use alloy_primitives::U64;
use anyhow::anyhow;
use backoff::future::retry as retry_backoff;
use backoff::ExponentialBackoffBuilder;
use jsonrpsee::http_client::HttpClient;
use reth_primitives::U64;
use sov_ledger_rpc::LedgerRpcClient;
use sov_rollup_interface::da::{BlockHeaderTrait, SequencerCommitment};
use sov_rollup_interface::services::da::{DaService, SlotData};
Expand Down
3 changes: 2 additions & 1 deletion crates/evm/src/evm/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::str::FromStr;

use reth_primitives::{Address, TransactionSignedEcRecovered, TxKind};
use alloy_primitives::{Address, TxKind};
use reth_primitives::TransactionSignedEcRecovered;
use revm::primitives::{
BlockEnv, CfgEnvWithHandlerCfg, EVMError, ExecutionResult, Output, SpecId, U256,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use citrea_primitives::basefee::calculate_next_block_base_fee;
use revm::primitives::{BlobExcessGasAndPrice, BlockEnv, SpecId};
use sov_modules_api::hooks::HookSoftConfirmationInfo;
use sov_modules_api::prelude::*;
use sov_modules_api::{AccessoryWorkingSet, Spec, WorkingSet};
use sov_modules_api::{AccessoryWorkingSet, WorkingSet};
use sov_rollup_interface::spec::SpecId as CitreaSpecId;
use sov_state::Storage;
#[cfg(feature = "native")]
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/tests/call_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ fn test_block_gas_limit() {
.unwrap()
.unwrap();

assert_eq!(block.header.gas_limit, ETHEREUM_BLOCK_GAS_LIMIT as _);
assert_eq!(block.header.gas_limit, ETHEREUM_BLOCK_GAS_LIMIT);
assert_eq!(block.header.gas_used, 29997634);
assert_eq!(block.transactions.hashes().len(), 1130);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/tests/fork_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::str::FromStr;

use reth_primitives::{address, keccak256, Address, TxKind};
use alloy_primitives::{address, keccak256, Address, TxKind};
use revm::primitives::U256;
use sov_modules_api::default_context::DefaultContext;
use sov_modules_api::hooks::HookSoftConfirmationInfo;
Expand Down
13 changes: 8 additions & 5 deletions crates/evm/src/tests/hooks_tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloy_consensus::BlockHeader;
use alloy_primitives::hex_literal::hex;
use alloy_primitives::{Address, Bloom, Bytes, Sealable, B256, B64, U256};
use lazy_static::lazy_static;
Expand Down Expand Up @@ -109,7 +110,7 @@ fn end_soft_confirmation_hook_sets_head() {
beneficiary: config.coinbase,
state_root: KECCAK_EMPTY,
transactions_root: B256::from(hex!(
"fdf1049f7decef904ffdc7d55f8ca9c9c52ad655c8ddb7435025d86c97a253c0"
"31f0a536f543dd3068c2e90c7770606680c223504a62d354994f3cc19c1d5c5b"
)),
receipts_root: B256::from(hex!(
"e8271759b66c13c70ad0726ee34c9fd2574d429fd77d95f95b22f988565a1469"
Expand Down Expand Up @@ -322,7 +323,7 @@ fn finalize_hook_creates_final_block() {
beneficiary: config.coinbase,
state_root: B256::from(root_hash),
transactions_root: B256::from(hex!(
"fdf1049f7decef904ffdc7d55f8ca9c9c52ad655c8ddb7435025d86c97a253c0"
"31f0a536f543dd3068c2e90c7770606680c223504a62d354994f3cc19c1d5c5b"
)),
receipts_root: B256::from(hex!(
"e8271759b66c13c70ad0726ee34c9fd2574d429fd77d95f95b22f988565a1469"
Expand All @@ -345,12 +346,14 @@ fn finalize_hook_creates_final_block() {
parent_beacon_block_root: None,
requests_root: None,
};
let sealed = header.seal_slow();
let (header, seal) = sealed.into_parts();

let hash = header.hash_slow();
// let sealed = header.seal_slow();
// let (header, seal) = sealed.into_parts();
assert_eq!(
block,
SealedBlock {
header: reth_primitives::SealedHeader::new(header, seal),
header: reth_primitives::SealedHeader::new(header, hash),
l1_fee_rate: 0,
l1_hash: B256::from(DA_ROOT_HASH.0),
transactions: 3..6
Expand Down
7 changes: 3 additions & 4 deletions crates/evm/src/tests/test_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ impl TestSigner {

let reth_tx = RethTransaction::Eip1559(reth_tx);
let signed = self.signer.sign_transaction(reth_tx, self.address)?;

Ok(RlpEvmTransaction {
rlp: signed.envelope_encoded().to_vec(),
})
let mut buf = vec![];
signed.encode_2718(&mut buf);
Ok(RlpEvmTransaction { rlp: buf })
}

/// Signs default Eip1559 transaction with to, data and nonce overridden.
Expand Down
1 change: 1 addition & 0 deletions crates/fullnode/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ metrics-derive = { workspace = true }
once_cell = { workspace = true, default-features = true }
rand = { workspace = true }
reth-primitives = { workspace = true }
alloy-primitives = { workspace = true }
rs_merkle = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/fullnode/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::net::SocketAddr;
use std::sync::Arc;
use std::time::Instant;

use alloy_primitives::U64;
use anyhow::{bail, Context as _};
use backoff::future::retry as retry_backoff;
use backoff::ExponentialBackoffBuilder;
Expand All @@ -17,7 +18,6 @@ use jsonrpsee::core::client::Error as JsonrpseeError;
use jsonrpsee::http_client::{HttpClient, HttpClientBuilder};
use jsonrpsee::server::{BatchRequestConfig, RpcServiceBuilder, ServerBuilder};
use jsonrpsee::RpcModule;
use reth_primitives::U64;
use sov_db::ledger_db::NodeLedgerOps;
use sov_db::schema::types::{BatchNumber, SlotNumber};
use sov_ledger_rpc::LedgerRpcClient;
Expand Down
2 changes: 2 additions & 0 deletions crates/light-client-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ metrics = { workspace = true, optional = true }
metrics-derive = { workspace = true, optional = true }
once_cell = { workspace = true, default-features = true, optional = true }
reth-primitives = { workspace = true, optional = true }
alloy-primitives = { workspace = true, optional = true }
tokio = { workspace = true, optional = true }
tokio-util = { workspace = true, optional = true }
tower = { workspace = true, optional = true }
Expand All @@ -44,6 +45,7 @@ tempfile = { workspace = true }
[features]
default = []
native = [
"dep:alloy-primitives",
"dep:citrea-primitives",
"dep:citrea-common",
"dep:sov-db",
Expand Down
2 changes: 1 addition & 1 deletion crates/light-client-prover/src/da_block_handler.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use std::collections::{HashMap, VecDeque};
use std::sync::Arc;

use alloy_primitives::U64;
use anyhow::anyhow;
use borsh::BorshDeserialize;
use citrea_common::cache::L1BlockCache;
use citrea_common::da::get_da_block_at_height;
use citrea_common::LightClientProverConfig;
use citrea_primitives::forks::FORKS;
use jsonrpsee::http_client::HttpClient;
use reth_primitives::U64;
use sov_db::ledger_db::{LightClientProverLedgerOps, SharedLedgerOps};
use sov_db::schema::types::{SlotNumber, StoredLightClientProofOutput};
use sov_ledger_rpc::LedgerRpcClient;
Expand Down
1 change: 1 addition & 0 deletions crates/sovereign-sdk/full-node/sov-ledger-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ sov-modules-api = { path = "../../module-system/sov-modules-api", features = [
"native",
], optional = true }
reth-primitives = { workspace = true }
alloy-primitives = { workspace = true }

[dev-dependencies]
tempfile = "3"
Expand Down
2 changes: 1 addition & 1 deletion crates/sovereign-sdk/full-node/sov-ledger-rpc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![forbid(unsafe_code)]

use alloy_primitives::U64;
use jsonrpsee::core::RpcResult;
use jsonrpsee::proc_macros::rpc;
use reth_primitives::U64;
use sov_rollup_interface::rpc::{
BatchProofResponse, LastVerifiedBatchProofResponse, SequencerCommitmentResponse,
SoftConfirmationResponse, SoftConfirmationStatus, VerifiedBatchProofResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! A JSON-RPC server implementation for any [`LedgerRpcProvider`].
use alloy_primitives::U64;
use jsonrpsee::core::RpcResult;
use jsonrpsee::types::ErrorObjectOwned;
use jsonrpsee::RpcModule;
use reth_primitives::U64;
use sov_modules_api::utils::to_jsonrpsee_error_object;
use sov_rollup_interface::rpc::{
BatchProofResponse, LastVerifiedBatchProofResponse, LedgerRpcProvider,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::net::SocketAddr;
use std::sync::Arc;

use reth_primitives::U64;
use alloy_primitives::U64;
use sov_db::ledger_db::LedgerDB;
use sov_db::rocks_db_config::RocksdbConfig;
use sov_ledger_rpc::server::create_rpc_module;
Expand Down

0 comments on commit cb58a85

Please sign in to comment.