linera_chain::test

Trait BlockTestExt

Source
pub trait BlockTestExt: Sized {
    // Required methods
    fn with_authenticated_signer(
        self,
        authenticated_signer: Option<AccountOwner>,
    ) -> Self;
    fn with_operation(self, operation: impl Into<Operation>) -> Self;
    fn with_transfer(
        self,
        owner: AccountOwner,
        recipient: Recipient,
        amount: Amount,
    ) -> Self;
    fn with_simple_transfer(self, chain_id: ChainId, amount: Amount) -> Self;
    fn with_incoming_bundle(self, incoming_bundle: IncomingBundle) -> Self;
    fn with_timestamp(self, timestamp: impl Into<Timestamp>) -> Self;
    fn with_epoch(self, epoch: impl Into<Epoch>) -> Self;
    fn into_proposal_with_round(
        self,
        key_pair: &AccountSecretKey,
        round: Round,
    ) -> BlockProposal;

    // Provided method
    fn into_first_proposal(self, key_pair: &AccountSecretKey) -> BlockProposal { ... }
}
Expand description

A helper trait to simplify constructing blocks for tests.

Required Methods§

Source

fn with_authenticated_signer( self, authenticated_signer: Option<AccountOwner>, ) -> Self

Returns the block with the given authenticated signer.

Source

fn with_operation(self, operation: impl Into<Operation>) -> Self

Returns the block with the given operation appended at the end.

Source

fn with_transfer( self, owner: AccountOwner, recipient: Recipient, amount: Amount, ) -> Self

Returns the block with a transfer operation appended at the end.

Source

fn with_simple_transfer(self, chain_id: ChainId, amount: Amount) -> Self

Returns the block with a simple transfer operation appended at the end.

Source

fn with_incoming_bundle(self, incoming_bundle: IncomingBundle) -> Self

Returns the block with the given message appended at the end.

Source

fn with_timestamp(self, timestamp: impl Into<Timestamp>) -> Self

Returns the block with the specified timestamp.

Source

fn with_epoch(self, epoch: impl Into<Epoch>) -> Self

Returns the block with the specified epoch.

Source

fn into_proposal_with_round( self, key_pair: &AccountSecretKey, round: Round, ) -> BlockProposal

Returns a block proposal without any hashed certificate values or validated block.

Provided Methods§

Source

fn into_first_proposal(self, key_pair: &AccountSecretKey) -> BlockProposal

Returns a block proposal in the first round in a default ownership configuration (Round::MultiLeader(0)) without any hashed certificate values or validated block.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§