-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from ethereum-optimism/refcell/attributes-queu…
…e-fixes fix(derive): Abstractions and Testing
- Loading branch information
Showing
10 changed files
with
290 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//! Testing utilities for the attributes queue stage. | ||
use crate::{ | ||
stages::attributes_queue::AttributesBuilder, | ||
types::{BlockID, L2BlockInfo, PayloadAttributes}, | ||
}; | ||
use alloc::vec::Vec; | ||
|
||
/// A mock implementation of the [`AttributesBuilder`] for testing. | ||
#[derive(Debug, Default)] | ||
pub struct MockAttributesBuilder { | ||
/// The attributes to return. | ||
pub attributes: Vec<anyhow::Result<PayloadAttributes>>, | ||
} | ||
|
||
impl AttributesBuilder for MockAttributesBuilder { | ||
/// Prepares the [PayloadAttributes] for the next payload. | ||
fn prepare_payload_attributes( | ||
&mut self, | ||
_l2_parent: L2BlockInfo, | ||
_epoch: BlockID, | ||
) -> anyhow::Result<PayloadAttributes> { | ||
self.attributes.pop().ok_or(anyhow::anyhow!("missing payload attribute"))? | ||
} | ||
} |
Oops, something went wrong.