|
1 | | -use alloy_primitives::{B256, B64}; |
| 1 | +use alloy_primitives::B64; |
2 | 2 | use reth_primitives_traits::{AlloyBlockHeader, Block, BlockBody}; |
3 | 3 | use scroll_alloy_rpc_types_engine::ScrollPayloadAttributes; |
4 | 4 |
|
5 | 5 | use tracing::debug; |
6 | 6 |
|
7 | 7 | /// Returns true if the [`Block`] matches the [`ScrollPayloadAttributes`]: |
8 | | -/// - parent hash matches the parent hash of the [`Block`]. |
9 | 8 | /// - all transactions match. |
10 | 9 | /// - timestamps are equal. |
11 | 10 | /// - `prev_randaos` are equal. |
12 | 11 | /// - `block_data_hint` matches the block data if present. |
13 | | -pub fn block_matches_attributes<B: Block>( |
14 | | - attributes: &ScrollPayloadAttributes, |
15 | | - block: &B, |
16 | | - parent_hash: B256, |
17 | | -) -> bool { |
| 12 | +pub fn block_matches_attributes<B: Block>(attributes: &ScrollPayloadAttributes, block: &B) -> bool { |
18 | 13 | let header = block.header(); |
19 | | - if header.parent_hash() != parent_hash { |
20 | | - debug!( |
21 | | - target: "scroll::engine::driver", |
22 | | - expected = ?parent_hash, |
23 | | - got = ?header.parent_hash(), |
24 | | - "reorg: mismatch in parent hash" |
25 | | - ); |
26 | | - return false; |
27 | | - } |
28 | 14 |
|
29 | 15 | let payload_transactions = &block.body().encoded_2718_transactions(); |
30 | 16 | let matching_transactions = |
@@ -109,7 +95,7 @@ mod tests { |
109 | 95 |
|
110 | 96 | use alloy_consensus::Header; |
111 | 97 | use alloy_eips::Encodable2718; |
112 | | - use alloy_primitives::{Bytes, U256}; |
| 98 | + use alloy_primitives::{Bytes, B256, U256}; |
113 | 99 | use arbitrary::{Arbitrary, Unstructured}; |
114 | 100 | use reth_scroll_primitives::ScrollBlock; |
115 | 101 | use reth_testing_utils::{generators, generators::Rng}; |
@@ -154,7 +140,7 @@ mod tests { |
154 | 140 | body: alloy_consensus::BlockBody { transactions, ..Default::default() }, |
155 | 141 | }; |
156 | 142 |
|
157 | | - assert!(block_matches_attributes(&attributes, &block, parent_hash)); |
| 143 | + assert!(block_matches_attributes(&attributes, &block)); |
158 | 144 |
|
159 | 145 | Ok(()) |
160 | 146 | } |
@@ -185,7 +171,7 @@ mod tests { |
185 | 171 | body: alloy_consensus::BlockBody { transactions, ..Default::default() }, |
186 | 172 | }; |
187 | 173 |
|
188 | | - assert!(!block_matches_attributes(&attributes, &block, parent_hash)); |
| 174 | + assert!(!block_matches_attributes(&attributes, &block)); |
189 | 175 |
|
190 | 176 | Ok(()) |
191 | 177 | } |
|
0 commit comments