Skip to content

Commit

Permalink
chore: relax arb for sealedwithsenders (paradigmxyz#13715)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 7, 2025
1 parent 818eb7d commit ccaf9da
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions crates/primitives/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,17 +503,22 @@ impl<B: reth_primitives_traits::Block> SealedBlockWithSenders<B> {
}

#[cfg(any(test, feature = "arbitrary"))]
impl<'a> arbitrary::Arbitrary<'a> for SealedBlockWithSenders {
impl<'a, B> arbitrary::Arbitrary<'a> for SealedBlockWithSenders<B>
where
B: reth_primitives_traits::Block + arbitrary::Arbitrary<'a>,
{
fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
let block: SealedBlock = SealedBlock::arbitrary(u)?;
let block = B::arbitrary(u)?;

let senders = block
.body
.transactions
.body()
.transactions()
.iter()
.map(|tx| tx.recover_signer().unwrap())
.collect::<Vec<_>>();

let (header, body) = block.split();
let block = SealedBlock::new(SealedHeader::seal(header), body);
Ok(Self { block, senders })
}
}
Expand Down

0 comments on commit ccaf9da

Please sign in to comment.