pub struct MockHost {
pub chain_id: ChainId,
pub history: Vec<MockHeader>,
}Fields§
§chain_id: ChainIdUnique identifier for the chain.
history: Vec<MockHeader>The chain of blocks underlying this context.
Implementations§
Trait Implementations§
Source§impl TestHost for MockHost
impl TestHost for MockHost
Source§type Block = MockHeader
type Block = MockHeader
The type of block produced by the host.
Source§type ClientState = MockClientState
type ClientState = MockClientState
The type of client state produced by the host.
Source§type BlockParams = ()
type BlockParams = ()
The type of block parameter to produce a block.
Source§type LightClientParams = ()
type LightClientParams = ()
The type of light client parameters to produce a light client state.
Source§fn push_block(&mut self, block: Self::Block)
fn push_block(&mut self, block: Self::Block)
Add a block to the host chain.
Source§fn generate_block(
&self,
_commitment_root: Vec<u8>,
height: u64,
timestamp: Timestamp,
_params: &Self::BlockParams,
) -> Self::Block
fn generate_block( &self, _commitment_root: Vec<u8>, height: u64, timestamp: Timestamp, _params: &Self::BlockParams, ) -> Self::Block
Generate a block at the given height and timestamp, using the provided parameters.
Source§fn generate_client_state(
&self,
latest_height: &Height,
_params: &Self::LightClientParams,
) -> Self::ClientState
fn generate_client_state( &self, latest_height: &Height, _params: &Self::LightClientParams, ) -> Self::ClientState
Generate a client state using the block at the given height and the provided parameters.
Source§fn latest_height(&self) -> Height
fn latest_height(&self) -> Height
The latest height of the host chain.
Source§fn latest_block(&self) -> Self::Block
fn latest_block(&self) -> Self::Block
The latest block of the host chain.
Source§fn get_block(&self, target_height: &Height) -> Option<Self::Block>
fn get_block(&self, target_height: &Height) -> Option<Self::Block>
Get the block at the given height.
Source§fn commit_block(
&mut self,
commitment_root: Vec<u8>,
block_time: Duration,
params: &Self::BlockParams,
)
fn commit_block( &mut self, commitment_root: Vec<u8>, block_time: Duration, params: &Self::BlockParams, )
Commit a block with commitment root to the blockchain, by extending the history of blocks.
fn validate(&self) -> Result<(), String>
Auto Trait Implementations§
impl Freeze for MockHost
impl RefUnwindSafe for MockHost
impl Send for MockHost
impl Sync for MockHost
impl Unpin for MockHost
impl UnwindSafe for MockHost
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
Mutably borrows from an owned value. Read more
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request