Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sdk): SealedBlock generic over header and body #11430

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 40 additions & 28 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 crates/consensus/beacon/src/engine/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ mod tests {
);

let client = TestFullBlockClient::default();
insert_headers_into_client(&client, SealedHeader::default(), 0..10);
insert_headers_into_client(&client, SealedHeader::<Header>::default(), 0..10);
// force the pipeline to be "done" after 5 blocks
let pipeline = TestPipelineBuilder::new()
.with_pipeline_exec_outputs(VecDeque::from([Ok(ExecOutput {
Expand Down
2 changes: 2 additions & 0 deletions crates/engine/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@ reth-exex-types.workspace = true
reth-primitives.workspace = true
reth-chainspec.workspace = true

alloy-consensus.workspace = true

tokio = { workspace = true, features = ["sync"] }
tokio-stream.workspace = true
9 changes: 6 additions & 3 deletions crates/engine/service/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ pub struct EngineServiceError {}
#[cfg(test)]
mod tests {
use super::*;
use alloy_consensus::Header;
use reth_beacon_consensus::EthBeaconConsensus;
use reth_chainspec::{ChainSpecBuilder, MAINNET};
use reth_engine_tree::{test_utils::TestPipelineBuilder, tree::NoopInvalidBlockHook};
Expand Down Expand Up @@ -174,9 +175,11 @@ mod tests {
let provider_factory = create_test_provider_factory_with_chain_spec(chain_spec.clone());

let executor_factory = EthExecutorProvider::ethereum(chain_spec.clone());
let blockchain_db =
BlockchainProvider2::with_latest(provider_factory.clone(), SealedHeader::default())
.unwrap();
let blockchain_db = BlockchainProvider2::with_latest(
provider_factory.clone(),
SealedHeader::<Header>::default(),
)
.unwrap();

let (_tx, rx) = watch::channel(FinishedExExHeight::NoExExs);
let pruner = Pruner::new_with_factory(provider_factory.clone(), vec![], 0, 0, None, rx);
Expand Down
1 change: 1 addition & 0 deletions crates/net/downloaders/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
alloy-rlp.workspace = true
itertools.workspace = true
rand.workspace = true
alloy-consensus.workspace = true

tempfile.workspace = true

Expand Down
2 changes: 1 addition & 1 deletion crates/net/downloaders/src/file_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ mod tests {
async fn download_headers_at_fork_head() {
reth_tracing::init_test_tracing();

let p3 = SealedHeader::default();
let p3 = SealedHeader::<Header>::default();
let p2 = child_header(&p3);
let p1 = child_header(&p2);
let p0 = child_header(&p1);
Expand Down
12 changes: 6 additions & 6 deletions crates/net/downloaders/src/headers/reverse_headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ mod tests {
fn test_sync_target_update() {
let client = Arc::new(TestHeadersClient::default());

let genesis = SealedHeader::default();
let genesis = SealedHeader::<Header>::default();

let mut downloader = ReverseHeadersDownloaderBuilder::default()
.build(Arc::clone(&client), Arc::new(TestConsensus::default()));
Expand Down Expand Up @@ -1310,7 +1310,7 @@ mod tests {
fn test_head_update() {
let client = Arc::new(TestHeadersClient::default());

let header = SealedHeader::default();
let header = SealedHeader::<Header>::default();

let mut downloader = ReverseHeadersDownloaderBuilder::default()
.build(Arc::clone(&client), Arc::new(TestConsensus::default()));
Expand Down Expand Up @@ -1348,7 +1348,7 @@ mod tests {
fn test_next_request() {
let client = Arc::new(TestHeadersClient::default());

let genesis = SealedHeader::default();
let genesis = SealedHeader::<Header>::default();

let batch_size = 99;
let start = 1000;
Expand Down Expand Up @@ -1396,7 +1396,7 @@ mod tests {

let client = Arc::new(TestHeadersClient::default());

let p3 = SealedHeader::default();
let p3 = SealedHeader::<Header>::default();
let p2 = child_header(&p3);
let p1 = child_header(&p2);
let p0 = child_header(&p1);
Expand Down Expand Up @@ -1427,7 +1427,7 @@ mod tests {
#[tokio::test]
async fn download_one_by_one() {
reth_tracing::init_test_tracing();
let p3 = SealedHeader::default();
let p3 = SealedHeader::<Header>::default();
let p2 = child_header(&p3);
let p1 = child_header(&p2);
let p0 = child_header(&p1);
Expand Down Expand Up @@ -1470,7 +1470,7 @@ mod tests {
#[tokio::test]
async fn download_one_by_one_larger_request_limit() {
reth_tracing::init_test_tracing();
let p3 = SealedHeader::default();
let p3 = SealedHeader::<Header>::default();
let p2 = child_header(&p3);
let p1 = child_header(&p2);
let p0 = child_header(&p1);
Expand Down
3 changes: 2 additions & 1 deletion crates/net/downloaders/src/headers/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ mod tests {
use crate::headers::{
reverse_headers::ReverseHeadersDownloaderBuilder, test_utils::child_header,
};
use alloy_consensus::Header;
use reth_consensus::test_utils::TestConsensus;
use reth_network_p2p::test_utils::TestHeadersClient;
use std::sync::Arc;
Expand All @@ -191,7 +192,7 @@ mod tests {
async fn download_one_by_one_on_task() {
reth_tracing::init_test_tracing();

let p3 = SealedHeader::default();
let p3 = SealedHeader::<Header>::default();
let p2 = child_header(&p3);
let p1 = child_header(&p2);
let p0 = child_header(&p1);
Expand Down
2 changes: 1 addition & 1 deletion crates/net/network/src/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ mod tests {
},
response: tx,
};
let mut header = SealedHeader::default().unseal();
let mut header = SealedHeader::<Header>::default().unseal();
header.number = 0u64;
(req, header)
};
Expand Down
6 changes: 3 additions & 3 deletions crates/net/p2p/src/full_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ mod tests {
#[tokio::test]
async fn download_single_full_block() {
let client = TestFullBlockClient::default();
let header = SealedHeader::default();
let header = SealedHeader::<Header>::default();
let body = BlockBody::default();
client.insert(header.clone(), body.clone());
let client = FullBlockClient::test_client(client);
Expand All @@ -712,7 +712,7 @@ mod tests {
#[tokio::test]
async fn download_single_full_block_range() {
let client = TestFullBlockClient::default();
let header = SealedHeader::default();
let header = SealedHeader::<Header>::default();
let body = BlockBody::default();
client.insert(header.clone(), body.clone());
let client = FullBlockClient::test_client(client);
Expand All @@ -727,7 +727,7 @@ mod tests {
client: &TestFullBlockClient,
range: Range<usize>,
) -> (SealedHeader, BlockBody) {
let mut sealed_header = SealedHeader::default();
let mut sealed_header = SealedHeader::<Header>::default();
let body = BlockBody::default();
for _ in range {
let (mut header, hash) = sealed_header.split();
Expand Down
2 changes: 1 addition & 1 deletion crates/net/p2p/src/test_utils/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl Stream for TestDownload {
return Poll::Ready(None)
}

let empty = SealedHeader::default();
let empty = SealedHeader::<Header>::default();
if let Err(error) = this.consensus.validate_header_against_parent(&empty, &empty) {
this.done = true;
return Poll::Ready(Some(Err(DownloadError::HeaderValidation {
Expand Down
Loading
Loading