-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Light client extraction #2483
Merged
Merged
Light client extraction #2483
Conversation
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
* Make ConsensusState object-safe * Make ClientState trait object safe * Extract ConsensusReader * Fix clippy errors * Remove all Any* usages from clients * Remove client specific errors from Ics02Error * Extract ChannelMetaReader * Fix Ci * Remove unnecessary Clone supertrait from Header & Misbehaviour * Fix bad std import * Remove redundant Clone supertrait from ClientDef * Rename ConsensusReader -> LightClientReader * Add docstring for LightClientReader * Add docstring for ChannelMetaReader * Remove unused LightClientReader trait bound * AnyTrait -> CoreAny * Remove ClientReader::maybe_consensus_state() * Rename LightClientReader -> ClientReaderLightClient and ChannelReaderLightClient Co-authored-by: Philippe Laferriere <[email protected]>
* Define protobuf error * Implement object safe Protobuf trait * Add test for object safety * Provide blanket impls for ToBoxed and TryFromIfSized * Add blanket impl test * Use more specific bounds * Seal Protobuf supertraits * Add mod erased * Rename erased traits * Doc comments for Protobuf * Update code to use ibc_proto::protobuf::Protobuf * Fix no_std check * Address review feedback * Rename Protobuf<T> to Protobuf<Raw> * Remove Sealed mod * Rename Into -> CloneInto and return T instead of Box<T>
* Define protobuf error * Implement object safe Protobuf trait * Add test for object safety * Provide blanket impls for ToBoxed and TryFromIfSized * Add blanket impl test * Use more specific bounds * Seal Protobuf supertraits * Add mod erased * Rename erased traits * Doc comments for Protobuf * Update code to use ibc_proto::protobuf::Protobuf * Fix no_std check * Address review feedback * Rename Protobuf<T> to Protobuf<Raw> * commit before dealing with Serialize * Implement erased_serde Serialize on Header * comment redacted * Made `Header` trait object safe * error * Impl Protobuf<Any> for TmHeader * Impl Protobuf<Any> for MockHeader * Change Header supertrait to `Protobuf<Any>`` instead of `Protobuf<RawHeader>` * ErasedProtobuf * Fix encode_to_string compile error * implement downcast_header * Move AsAny to dynamic_typing module * fix 1 more compile error: clone * Make UpdateClient `PartialEq` again by making `dyn Header` PartialEq * Add `Header::into_box` * Use `Any` in place of `MsgUpdateAnyClient.header` * Update relayer for MsgUpdateAnyClient `Any` header changes * Avoid using `Header` methods in update_client handler * Remove AnyHeader from ClientDef * Update tests for ClientDef changes * Remove redundant clone * Remove AnyHeader usage from mock * MsgUpdateClient -> RawMsgUpdateClient * MsgUpdateAnyClient -> MsgUpdateClient * Remove use of AnyHeader * Move MisbehaviourEvidence to the relayer * Remove use of AnyHeader in mock * Remove AnyHeader from modelator * Fix MockHeader test * Move AnyHeader into the relayer * use alloc String in protobuf * fix no-std issue * Cleanup SyntheticTmBlock impl * Rename EqualsHeader and move to sealed module * Remove unused Error=Error * Remove Deref impl for SyntheticTmBlock * Fix default `trusted_height` in `HostBlock::generate_tm_block()` * fix test * fix errors Co-authored-by: hu55a1n1 <[email protected]>
* Implement PartialEq for dyn Misbehaviour * Add DynClone to Misbehaviour * MsgSubmitMisbehaviour now uses Any * Move AnyMisbehaviour to the relayer * Header: move sealed module at the end of file * Rename misbehavior -> misbehaviour * Misbehaviour: mark Mock stuff cfg(test) * Header: put Mock stuff behind cfg(test)
* Update Cargo.lock * Fix header comment * Implement Erased traits for ConsensusState * Implement supertraits for concrete `ConsensusState`s * Remove AnyConsensusState from ClientDef * Remove check for matching ClientTypes in MsgCreateAnyClient domain type conv * Remove AnyConsensusState from client handlers * Fix tests compile * Fix typo in comment * Add ConsensusState::timestamp() * Remove `AnyConsensusState` from readers & keepers * Remove `AnyConsensusState` from mock context * Fix tests * Impl conversions for Host block to dyn ConsensusState * Treat Tm light client as first class citizen and allow Mock impl to depend on it's data structures * Fix no-std check * Replace AnyConsensusState in Messages with Box<dyn ConsensusState> * Modify `verify_upgrade_and_update_state()` to accept `Any` consensus state * Remove redundant conversion from MockHeader to AnyConsensusState * Remove any remnants of AnyConsensusState from tests * Move `AnyConsensusState` to the relayer crate * Move type url consts to the light client mods * Extract mock::consensus_state mod * Rename client_consensus.rs to consensus_state.rs * Move header type url consts to the light client mods * Minor refactoring and doc comments * Move misbehaviour type url consts to the light client mods * Rename Clientdef::validate_consensus_state -> initialise
* dyn UpgradeOptions * Object safe ClientState * Add PartialEq for ClientState * Remove AnyClientState * Update remaining handlers and relayer code * Fix tests * Remove AnyClientState from ICS03 * Remove AnyClientState from mock * Fix typos * Fix CI * Move AnyClientState to relayer crate * Move client state type URLs to light clients * Remove ClientReaderLightClient * Fix comment
* add verification functions to ClientState * Implement tendermint clientstate * Implemented verification functions for MockClientState * Remove ClientDef * MsgCreateAnyClient -> MsgCreateClient * MsgUpgradeAnyClient -> MsgUpgradeClient * fix test * Cleanup fully qualified imports * Rename TmClientState * Remove ChannelReaderLightClient (#2572) Co-authored-by: hu55a1n1 <[email protected]>
romac
changed the title
Light client extraction (long-lived branch)
Light client extraction
Aug 25, 2022
6 tasks
romac
approved these changes
Aug 26, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 tasks
hu55a1n1
added a commit
to hu55a1n1/hermes
that referenced
this pull request
Sep 13, 2022
* Remove all occurences of Any* enums from light-clients (informalsystems#2332) * Make ConsensusState object-safe * Make ClientState trait object safe * Extract ConsensusReader * Fix clippy errors * Remove all Any* usages from clients * Remove client specific errors from Ics02Error * Extract ChannelMetaReader * Fix Ci * Remove unnecessary Clone supertrait from Header & Misbehaviour * Fix bad std import * Remove redundant Clone supertrait from ClientDef * Rename ConsensusReader -> LightClientReader * Add docstring for LightClientReader * Add docstring for ChannelMetaReader * Remove unused LightClientReader trait bound * AnyTrait -> CoreAny * Remove ClientReader::maybe_consensus_state() * Rename LightClientReader -> ClientReaderLightClient and ChannelReaderLightClient Co-authored-by: Philippe Laferriere <[email protected]> * Object safe Protobuf (informalsystems#2412) * Define protobuf error * Implement object safe Protobuf trait * Add test for object safety * Provide blanket impls for ToBoxed and TryFromIfSized * Add blanket impl test * Use more specific bounds * Seal Protobuf supertraits * Add mod erased * Rename erased traits * Doc comments for Protobuf * Update code to use ibc_proto::protobuf::Protobuf * Fix no_std check * Address review feedback * Rename Protobuf<T> to Protobuf<Raw> * Remove Sealed mod * Rename Into -> CloneInto and return T instead of Box<T> * Remove `AnyHeader` from the modules (informalsystems#2524) * Define protobuf error * Implement object safe Protobuf trait * Add test for object safety * Provide blanket impls for ToBoxed and TryFromIfSized * Add blanket impl test * Use more specific bounds * Seal Protobuf supertraits * Add mod erased * Rename erased traits * Doc comments for Protobuf * Update code to use ibc_proto::protobuf::Protobuf * Fix no_std check * Address review feedback * Rename Protobuf<T> to Protobuf<Raw> * commit before dealing with Serialize * Implement erased_serde Serialize on Header * comment redacted * Made `Header` trait object safe * error * Impl Protobuf<Any> for TmHeader * Impl Protobuf<Any> for MockHeader * Change Header supertrait to `Protobuf<Any>`` instead of `Protobuf<RawHeader>` * ErasedProtobuf * Fix encode_to_string compile error * implement downcast_header * Move AsAny to dynamic_typing module * fix 1 more compile error: clone * Make UpdateClient `PartialEq` again by making `dyn Header` PartialEq * Add `Header::into_box` * Use `Any` in place of `MsgUpdateAnyClient.header` * Update relayer for MsgUpdateAnyClient `Any` header changes * Avoid using `Header` methods in update_client handler * Remove AnyHeader from ClientDef * Update tests for ClientDef changes * Remove redundant clone * Remove AnyHeader usage from mock * MsgUpdateClient -> RawMsgUpdateClient * MsgUpdateAnyClient -> MsgUpdateClient * Remove use of AnyHeader * Move MisbehaviourEvidence to the relayer * Remove use of AnyHeader in mock * Remove AnyHeader from modelator * Fix MockHeader test * Move AnyHeader into the relayer * use alloc String in protobuf * fix no-std issue * Cleanup SyntheticTmBlock impl * Rename EqualsHeader and move to sealed module * Remove unused Error=Error * Remove Deref impl for SyntheticTmBlock * Fix default `trusted_height` in `HostBlock::generate_tm_block()` * fix test * fix errors Co-authored-by: hu55a1n1 <[email protected]> * Remove `AnyMisbehaviour` from modules (informalsystems#2527) * Implement PartialEq for dyn Misbehaviour * Add DynClone to Misbehaviour * MsgSubmitMisbehaviour now uses Any * Move AnyMisbehaviour to the relayer * Header: move sealed module at the end of file * Rename misbehavior -> misbehaviour * Misbehaviour: mark Mock stuff cfg(test) * Header: put Mock stuff behind cfg(test) * Remove `AnyConsensusState` from modules (informalsystems#2528) * Update Cargo.lock * Fix header comment * Implement Erased traits for ConsensusState * Implement supertraits for concrete `ConsensusState`s * Remove AnyConsensusState from ClientDef * Remove check for matching ClientTypes in MsgCreateAnyClient domain type conv * Remove AnyConsensusState from client handlers * Fix tests compile * Fix typo in comment * Add ConsensusState::timestamp() * Remove `AnyConsensusState` from readers & keepers * Remove `AnyConsensusState` from mock context * Fix tests * Impl conversions for Host block to dyn ConsensusState * Treat Tm light client as first class citizen and allow Mock impl to depend on it's data structures * Fix no-std check * Replace AnyConsensusState in Messages with Box<dyn ConsensusState> * Modify `verify_upgrade_and_update_state()` to accept `Any` consensus state * Remove redundant conversion from MockHeader to AnyConsensusState * Remove any remnants of AnyConsensusState from tests * Move `AnyConsensusState` to the relayer crate * Move type url consts to the light client mods * Extract mock::consensus_state mod * Rename client_consensus.rs to consensus_state.rs * Move header type url consts to the light client mods * Minor refactoring and doc comments * Move misbehaviour type url consts to the light client mods * Rename Clientdef::validate_consensus_state -> initialise * Remove `AnyClientState` from the modules (informalsystems#2559) * dyn UpgradeOptions * Object safe ClientState * Add PartialEq for ClientState * Remove AnyClientState * Update remaining handlers and relayer code * Fix tests * Remove AnyClientState from ICS03 * Remove AnyClientState from mock * Fix typos * Fix CI * Move AnyClientState to relayer crate * Move client state type URLs to light clients * Remove ClientReaderLightClient * Fix comment * Avoid decoding expected client state on counterparty (informalsystems#2569) * Merge `Clientdef` into `Clientstate` (informalsystems#2570) * add verification functions to ClientState * Implement tendermint clientstate * Implemented verification functions for MockClientState * Remove ClientDef * MsgCreateAnyClient -> MsgCreateClient * MsgUpgradeAnyClient -> MsgUpgradeClient * fix test * Cleanup fully qualified imports * Rename TmClientState * Remove ChannelReaderLightClient (informalsystems#2572) Co-authored-by: hu55a1n1 <[email protected]> * Re-add Deserialize on Any enums in relayer crate where possible * Impl From<&dyn> for AnyClientState and AnyConsensusState * Remove redundant line Co-authored-by: Philippe Laferriere <[email protected]> Co-authored-by: Romain Ruetschi <[email protected]>
This was referenced Oct 6, 2022
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #2335
Description
This is the PR for merging the long-lived branch for ADR011 impl.
Make sure the following points are addressed before merging ->
ChannelReaderLightClient
is a supertrait ofChannelReader
. (see comment -> Remove all occurences of Any* enums from light-clients #2332 (comment))encode_vec()
Add CI test for dummy light client that is hosted in an external crate (similar to https://github.com/informalsystems/ibc-rs/tree/master/ci/no-std-check).Component PRs
AnyHeader
from the modules #2524AnyMisbehaviour
from modules #2527AnyConsensusState
from modules #2528AnyClientState
from the modules #2559Clientdef
intoClientstate
#2570Follow-up work (improvements)
AsAny
andAsAnyMut
code we currently have. It also provides a way for going from boxed trait objects to boxed concrete types without cloning, something that isn't possible with the current API. eg.Box<dyn ClientState>
->Box<TmClientState>
.ErasedPartialEq
defs and impls.into_box()
. (downcast-rs might already have a solution for this)PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.