|
1 | 1 | //! Test utilities for the block header. |
2 | 2 |
|
3 | | -use crate::BlockHeader; |
4 | 3 | use alloy_consensus::Header; |
5 | | -use alloy_primitives::{BlockHash, BlockNumber, B256, U256}; |
| 4 | +use alloy_primitives::B256; |
6 | 5 | use proptest::{arbitrary::any, prop_compose}; |
7 | 6 | use proptest_arbitrary_interop::arb; |
8 | 7 |
|
9 | | -/// A helper trait for [`Header`]s that allows for mutable access to the headers values. |
10 | | -/// |
11 | | -/// This allows for modifying the header for testing purposes. |
12 | | -pub trait TestHeader: BlockHeader { |
13 | | - /// Updates the parent block hash. |
14 | | - fn set_parent_hash(&mut self, hash: BlockHash); |
15 | | - |
16 | | - /// Updates the block number. |
17 | | - fn set_block_number(&mut self, number: BlockNumber); |
18 | | - |
19 | | - /// Updates the block state root. |
20 | | - fn set_state_root(&mut self, state_root: B256); |
21 | | - |
22 | | - /// Updates the block difficulty. |
23 | | - fn set_difficulty(&mut self, difficulty: U256); |
24 | | -} |
25 | | - |
26 | | -impl TestHeader for Header { |
27 | | - fn set_parent_hash(&mut self, hash: BlockHash) { |
28 | | - self.parent_hash = hash |
29 | | - } |
30 | | - |
31 | | - fn set_block_number(&mut self, number: BlockNumber) { |
32 | | - self.number = number; |
33 | | - } |
34 | | - |
35 | | - fn set_state_root(&mut self, state_root: B256) { |
36 | | - self.state_root = state_root; |
37 | | - } |
38 | | - |
39 | | - fn set_difficulty(&mut self, difficulty: U256) { |
40 | | - self.difficulty = difficulty; |
41 | | - } |
42 | | -} |
| 8 | +/// Re-export `HeaderMut` for backward compatibility in tests. |
| 9 | +pub use super::HeaderMut as TestHeader; |
43 | 10 |
|
44 | 11 | /// Generates a header which is valid __with respect to past and future forks__. This means, for |
45 | 12 | /// example, that if the withdrawals root is present, the base fee per gas is also present. |
|
0 commit comments