-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement ValidationContext and ExecutionContext for connections (IC…
…S-3) (#257) * `ConnOpenInit::validate` * conn_open_init: execute * conn_open_try `validate` and `execute` * conn_open_ack::validate * conn_open_ack::execute * conn_open_confirm::validate * conn_open_confirm::execute * changelog * LocalVars * validate_impl and execute_impl * Remove useless clone * fix ConnOpenInit::validate * fix conn_open_ack (as in #272) * conn_open_try: LocalVars * conn_open_try validate/execute impl * conn_open_ack LocalVars * conn_open_ack impl * Track code coverage with `cargo-llvm-cov` and codecov.io (#277) * Track code coverage with `cargo-llvm-cov` * Add changelog entry * Add coverage badge to the README * Misbehaviour handling implementation (#215) * Add ClientState::check_misbehaviour_and_update_state() * Implement misbehaviour handler * impl Protobuf<Any> for Misbehaviour * Remove redundant definition of decode_header() * Implement ChainId::with_version() * Getters for Tm Misbehaviour * Add missing checks for conversion from RawMisbehaviour * Make TmClientState::with_frozen_height() infallible * Implement TmClientState::check_misbehaviour_and_update_state() * Cleanup inner functions * Cleanup errors * Clippy fix * Ctor for TmMisbehaviour * Use git dependencies for tendermint crates * Add VerifyCommitLightTrusting check * Add VerifyCommit check * Clippy fix * Patch tendermint deps for no-std-check * Convert Tendermint VerificationError * Add helpers `Header::as_{un}trusted_block_state()` * Reorder untrusted verification logic * Reorder trusted verification logic * Misbehavior -> misbehaviour * Check for matching chain-ids * cargo update ci/no-std-check * Fix build failure after merge with main * Update for API changes in tm PR * Delete ci/no-std-check/Cargo.lock * Add changelog entry * Cleanup (naming & comments) * Rename check_trusted_header() -> check_header_validator_set() * Rename check_misbehaviour_header() -> check_header_and_validator_set() * Rename MisbehaviourConsensusStateTimestampGteTrustingPeriod -> ConsensusStateTimestampGteTrustingPeriod * Rename verify_misbehaviour_header_commit() -> verify_header_commit_against_trusted() * Remove redundant client state expired check * Impl Protobuf conversions for mock Misbehaviour * Impl check_misbehaviour_and_update_state() for mock Misbehaviour * Remove cargo patches * Fixes after tendermint-rs bump * Fix typo * Add tests * MockClientState::with_frozen_height() * Provide MockContext helper to set client chain-id * Conversions from HostBlock -> TmLightBlock -> TmHeader * Fix tests * Clippy fix * Cleanup tests * Add comments for tests * Clippy fix * Rustfmt * Fix wrong main branch name in code coverage job (#280) * implement `ValidationContext` for `MockContext` * conn_open_init: test validate() * Add `execute` entrypoint * re-export validate and execute * test validate() in connection handlers * Use into() instead of ContextError directly * reexport ContextError * fmt Co-authored-by: Romain Ruetschi <romain@informal.systems> Co-authored-by: Shoaib Ahmed <sufialhussaini@gmail.com>
- Loading branch information
1 parent
4848db0
commit f887725
Showing
10 changed files
with
961 additions
and
22 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
.changelog/unreleased/breaking-changes/251-validation-execution-ics3.md
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,2 @@ | ||
- Implement `ValidationContext::validate` and `ExecutionContext::execute` for connections (ICS-3) | ||
([#251](https://github.com/cosmos/ibc-rs/issues/251)) |
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,24 @@ | ||
use ibc_proto::google::protobuf::Any; | ||
|
||
use super::{ | ||
ics26_routing::{error::RouterError, msgs::MsgEnvelope}, | ||
ExecutionContext, ValidationContext, | ||
}; | ||
|
||
/// Entrypoint which only performs message validation | ||
pub fn validate<Ctx>(ctx: &Ctx, message: Any) -> Result<(), RouterError> | ||
where | ||
Ctx: ValidationContext, | ||
{ | ||
let envelope: MsgEnvelope = message.try_into()?; | ||
ctx.validate(envelope) | ||
} | ||
|
||
/// Entrypoint which only performs message execution | ||
pub fn execute<Ctx>(ctx: &mut Ctx, message: Any) -> Result<(), RouterError> | ||
where | ||
Ctx: ExecutionContext, | ||
{ | ||
let envelope: MsgEnvelope = message.try_into()?; | ||
ctx.execute(envelope) | ||
} |
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
Oops, something went wrong.