-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ibc-core): copy substitute consensus state during client recovery (…
…#1197) * Pass substitute consensus state into client recovery methods * Fix update_on_recovery call in ibc-clients/cw-context * refactor encode_vec to into_any * consume new_client_state later * update ibc_derive * update mock client state * cargo format * Change `use` statement formatting * add store_update_meta at MockClientState::initialise * consistent naming * Remove `into_any` trait methods * rm ConsensusState::into_any from ibc-derive * test consensus state recovery * link on doc strings --------- Co-authored-by: Ranadeep Biswas <[email protected]>
- Loading branch information
1 parent
7e50323
commit 6deec18
Showing
13 changed files
with
82 additions
and
31 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
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 |
---|---|---|
@@ -1,22 +1,25 @@ | ||
//! Defines the trait to be implemented by all concrete consensus state types | ||
use ibc_core_client_types::error::ClientError; | ||
use ibc_core_commitment_types::commitment::CommitmentRoot; | ||
use ibc_primitives::prelude::*; | ||
use ibc_primitives::proto::Any; | ||
use ibc_primitives::Timestamp; | ||
|
||
/// Convenient trait to decode a consensus state from an [`Any`] type and obtain | ||
/// a handle to the local instance of [`ConsensusState`]. | ||
pub trait ConsensusStateDecoder: Into<Any> + TryFrom<Any, Error = ClientError> {} | ||
|
||
impl<T> ConsensusStateDecoder for T where T: Into<Any> + TryFrom<Any, Error = ClientError> {} | ||
|
||
/// Defines methods that all `ConsensusState`s should provide. | ||
/// | ||
/// One can think of a "consensus state" as a pruned header, to be stored on chain. In other words, | ||
/// a consensus state only contains the header's information needed by IBC message handlers. | ||
pub trait ConsensusState: Send + Sync { | ||
pub trait ConsensusState: Send + Sync + ConsensusStateDecoder { | ||
/// Commitment root of the consensus state, which is used for key-value pair verification. | ||
fn root(&self) -> &CommitmentRoot; | ||
|
||
/// The timestamp of the consensus state | ||
fn timestamp(&self) -> Timestamp; | ||
|
||
/// Serializes the `ConsensusState`. This is expected to be implemented as | ||
/// first converting to the raw type (i.e. the protobuf definition), and then | ||
/// serializing that. | ||
fn encode_vec(self) -> Vec<u8>; | ||
} |
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
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
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