pub struct HostBlockSpec {
pub constants: SignetSystemConstants,
pub receipts: Vec<ReceiptEnvelope>,
pub ru_block: Option<RuBlockSpec>,
pub sidecar: Option<BlobTransactionSidecar>,
pub ru_block_receipt: Option<ReceiptEnvelope>,
pub block_number: AtomicU64,
pub events: Vec<Events>,
}Expand description
A block spec for the host chain.
Typically this should be used as follows:
- Instantiate with a
SignetSystemConstantsobject viaSelf::new. - Add Signet events to the block with
Self::enter,Self::enter_tokenSelf::transact, andSelf::fill. - (optional) Add a
RuBlockSpecwithSelf::submit_block. - Convert to a
ChainwithSelf::to_chain, or aNotificationSpecwithSelf::to_commit_notification_spec.
Fields§
§constants: SignetSystemConstantsThe system constants for the block.
receipts: Vec<ReceiptEnvelope>The Zenith-event receipts in the block.
ru_block: Option<RuBlockSpec>The Ru block associated with this host block (if any).
sidecar: Option<BlobTransactionSidecar>The sidecar associated with the Ru block (if any).
ru_block_receipt: Option<ReceiptEnvelope>The receipt for the Ru block (if any).
block_number: AtomicU64The block number. This will be overridden when making chains of blocks.
events: Vec<Events>The events that were used to create this block.
Implementations§
Source§impl HostBlockSpec
impl HostBlockSpec
Sourcepub const fn new(constants: SignetSystemConstants) -> Self
pub const fn new(constants: SignetSystemConstants) -> Self
Make a new block spec
Sourcepub const fn parmigiana() -> Self
pub const fn parmigiana() -> Self
Make a new block spec with Parmigiana constants.
Sourcepub const fn pecorino() -> Self
👎Deprecated: Pecorino is being deprecated in favor of Parmigiana
pub const fn pecorino() -> Self
Pecorino is being deprecated in favor of Parmigiana
Make a new block spec with Pecorino constants.
Sourcepub fn with_block_number(self, block_number: u64) -> Self
pub fn with_block_number(self, block_number: u64) -> Self
Set the block number.
Sourcepub fn enter_token(
self,
recipient: Address,
amount: usize,
token: Address,
) -> Self
pub fn enter_token( self, recipient: Address, amount: usize, token: Address, ) -> Self
Add an enter to the host block.
Sourcepub fn ingnored_enter_token(
self,
recipient: Address,
amount: u64,
token: Address,
) -> Self
pub fn ingnored_enter_token( self, recipient: Address, amount: u64, token: Address, ) -> Self
Add an ignored enter token to the host block
Sourcepub fn enter_tokens<'a, T>(
self,
enter_tokens: impl IntoIterator<Item = T>,
) -> Self
pub fn enter_tokens<'a, T>( self, enter_tokens: impl IntoIterator<Item = T>, ) -> Self
Add an iter of enter tokens to the host block
Sourcepub fn ignored_enter(self, recipient: Address, amount: u64) -> Self
pub fn ignored_enter(self, recipient: Address, amount: u64) -> Self
Add an enter to the host block that is ignored by the Ru chain because it has a mismatched RU chain ID.
Sourcepub fn enters<'a, T>(self, enters: impl IntoIterator<Item = T>) -> Self
pub fn enters<'a, T>(self, enters: impl IntoIterator<Item = T>) -> Self
Add several enters to the host block.
Sourcepub fn simple_transact(
self,
sender: Address,
target: Address,
data: impl AsRef<[u8]>,
value: usize,
) -> Self
pub fn simple_transact( self, sender: Address, target: Address, data: impl AsRef<[u8]>, value: usize, ) -> Self
Add a simple transact to the host block.
Sourcepub fn fill(self, token: Address, recipient: Address, amount: u64) -> Self
pub fn fill(self, token: Address, recipient: Address, amount: u64) -> Self
Add a fill to the host block
Sourcepub fn ignored_fill(
self,
token: Address,
recipient: Address,
amount: u64,
) -> Self
pub fn ignored_fill( self, token: Address, recipient: Address, amount: u64, ) -> Self
Add a fill to the host block that is ignored by the Ru chain because it has a mismatched RU chain ID.
Sourcepub fn submit_block(self, ru_block: RuBlockSpec) -> Self
pub fn submit_block(self, ru_block: RuBlockSpec) -> Self
Add a block submitted to the host block
Sourcepub fn block_number(&self) -> u64
pub fn block_number(&self) -> u64
Get the block number
Sourcepub fn set_block_number(&self, block_number: u64)
pub fn set_block_number(&self, block_number: u64)
Set the block number
Sourcepub fn header(&self) -> SignetHeaderV1
pub fn header(&self) -> SignetHeaderV1
Make a header
Sourcepub fn sealed_block(&self) -> SealedBlock
pub fn sealed_block(&self) -> SealedBlock
Make a block
Sourcepub fn recovered_block(&self) -> RecoveredBlock
pub fn recovered_block(&self) -> RecoveredBlock
Make a block with senders.
Sourcepub fn execution_outcome(&self) -> ExecutionOutcome
pub fn execution_outcome(&self) -> ExecutionOutcome
Make an execution outcome
Sourcepub fn to_chain(&self) -> (Chain, Option<BlobTransactionSidecar>)
pub fn to_chain(&self) -> (Chain, Option<BlobTransactionSidecar>)
Make a chain
Sourcepub fn to_commit_notification_spec(&self) -> NotificationSpec
pub fn to_commit_notification_spec(&self) -> NotificationSpec
Make a commit notification spec
Sourcepub fn to_notification_with_sidecar(&self) -> NotificationWithSidecars
pub fn to_notification_with_sidecar(&self) -> NotificationWithSidecars
Make a reorg notification with sidecars
Sourcepub fn to_revert_notification_spec(&self) -> NotificationSpec
pub fn to_revert_notification_spec(&self) -> NotificationSpec
Make a revert notification spec
Sourcepub fn assert_conforms<C: Extractable>(&self, extracts: &Extracts<'_, C>)
pub fn assert_conforms<C: Extractable>(&self, extracts: &Extracts<'_, C>)
Assert that the block conforms to the spec
Trait Implementations§
Source§impl Clone for HostBlockSpec
impl Clone for HostBlockSpec
Source§impl Debug for HostBlockSpec
impl Debug for HostBlockSpec
Source§impl From<SignetSystemConstants> for HostBlockSpec
impl From<SignetSystemConstants> for HostBlockSpec
Source§fn from(constants: SignetSystemConstants) -> Self
fn from(constants: SignetSystemConstants) -> Self
Source§impl FromStr for HostBlockSpec
impl FromStr for HostBlockSpec
Source§impl TryFrom<KnownChains> for HostBlockSpec
impl TryFrom<KnownChains> for HostBlockSpec
Source§type Error = ParseChainError
type Error = ParseChainError
Auto Trait Implementations§
impl !Freeze for HostBlockSpec
impl RefUnwindSafe for HostBlockSpec
impl Send for HostBlockSpec
impl Sync for HostBlockSpec
impl Unpin for HostBlockSpec
impl UnsafeUnpin for HostBlockSpec
impl UnwindSafe for HostBlockSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.