-
Notifications
You must be signed in to change notification settings - Fork 89
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
Static ClientState
API
#683
Conversation
…-client-interface
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #683 +/- ##
==========================================
+ Coverage 72.32% 73.21% +0.88%
==========================================
Files 116 124 +8
Lines 15527 16101 +574
==========================================
+ Hits 11230 11788 +558
- Misses 4297 4313 +16
☔ View full report in Codecov by Sentry. |
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.
Further to our discussions on this PR, I went over the changes once again and left a few questions to ensure some other parts of the design.
/// | ||
/// Note that the `Protobuf` trait in `tendermint-proto` provides convenience methods | ||
/// to do this automatically. | ||
fn encode_vec(&self) -> Result<Vec<u8>, tendermint_proto::Error>; |
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.
Couldn't we go with Protobuf
trait from ibc-proto-rs
instead? by which encode_vec
can return Vec<u8>
instead of Result<Vec<u8, tendermint_proto::Error>
.
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.
The Protobuf
trait in ibc-proto-rs is trait object safe, which it trades off with being more complex, such as having Self: erased::TryFrom<Raw>
instead of just Self: TryFrom<Raw>
. Now that we no longer need trait object safety, we no longer need this additional complexity.
We can just bring the same changes and make tendermint_proto::Protobuf::encode_vec()
return Vec<u8>
?
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.
Hmm. We can do so but also was thinking of not being dependent on tendermint-specific things in the "core" module.
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.
Indeed that would be desirable, but we should do this in another PR
Reminder to add unclogs :) |
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.
From my end, nothing else remains. Looks solid. Excellent work on this PR 👌🏻
* StaticClientState * Static{Validation,Execution}Context * improve static clientstate & contexts * StaticTmClientState scaffold * tentative separation of `ClientState` * remove chain_id * move `zero_custom_fields()` * adjust comment * changelog * Remove methods from staticclientstate * static client state for tendermint WIP * `ClientStateValidation` for tendermint `ClientState` * `StaticClientStateExecution` tendermint * use static contexts in handlers * `StaticConsensusState` trait for tm `ConsensusState` * Move `MockClientRecord` to context file * mock: make records use enums instead of dyn * mock context works * bunch of errors fixed * fix tm consensus state * clippy * fix todos * use derive_more * Remove old types * Remove old `ClientState` * move things around * Rename tendermint's ClientState * Rename ValidationContext * Rename ExecutionContext * rename ClientState traits * fix doc * Rename ConsensusState * ClientState derive macro scaffold * macro improvements + test setup * fmt * remove ibc dev-dependency * implement validate_proof_height * fix previous merge from main * crate-level `allow(non_snake_case)` * `Imports` struct * move ClientStateBase impl to a module * extern crate trick * outdated comments * latest_height * implement more `ClientStateBase` methods * finish `ClientStateBase` impl * rustdoc ignore * comment line * introduce darling * ClientStateInitializer impl * export attribute * ClientStateInitializer done * fmt * add mock mode * use `ClientState` macro in tests * no long path * clippy rust 1.70 * remove useless cruft * comment * impl ClientStateValidation * use core::result::Result * ClientStateExecution impl in macro * Supported -> Any * host -> generics * rename derive macro attrs * Remove `PartialEq` from `ClientState` traits * Remove `Debug` supertrait from `ClientState` * Remove `Clone` requirement on `ClientState` traits * Remove `Send + Sync` from `ClientStateBase` * Remove `Debug + Clone` from `ConsensusState` * Remove `EncodeError` associated type (ConsensusState) * client-state-derive: move to submodule client_state * client-state-derive -> ibc-derive * `ConsensusState` macro * move `ClientState` re-export * Fix `ConsensusState` macro * add `ConsensuState` to ibc-derive-test * remove ibc-derive-test * Remove `ClientStateInitializer` * Finish removing `ClientStateInitializer` * docs * Remove `store_update_{height,time}` from `ExecutionContext` * Revert "Remove `store_update_{height,time}` from `ExecutionContext`" This reverts commit 282424f. * update client: store update time/height in core * create client: store update height/time in core * Remove store_update_time/height from Tm Client Execution context * remove `store_{client,consensus}_state` from `ExecutionContext` * docs * tm client: `context` module * Rename tm client types * Rename TmConsensusState * Remove `dyn-clone` dependency * Remove erased-serde dependency * Remove `ErasedPartialEq` from `Header` * ClientStateCommon * `ClientExecutionContext` trait * Complete ClientExecutionContext * Rename Host{Consensus,Client}State * Move `ClientExecutionContext` * Use `ContextError` in `ClientExecutionContext` methods * mock: remove stale time/height update * mock: clients submodule * mock: application impls submodule * mock context: file reorg * ClientExecutionContext docs * `ClientState` derive macro docs * `ConsensusState` docs * `ClientState` docstring * docs * Remove unused method * tm docs * core context traits docs * refine tm client's contexts * move `get_client_execution_context` * Move `verify_consensus_state` * Remove useless match in recv_packet * fix typo in `UpgradeValidationContext` * blanket impl for TmExecutionContext * ClientState derive macro: document generic limitation * Upgrade Contexts associated types * fix * add ClientType test * chore: organize import calls * changelog * Add `CommonContext::ConversionError` --------- Co-authored-by: Farhad Shabani <farhad.shabani@gmail.com>
Closes: #296
Closes: #534
Closes: #614
Description
ClientState
ConsensusState
ClientExecutionContext
CommonContext
as a supertrait toValidation/ExecutionContext
consensus_state()
. All otherValidationContext
methods are not needed in execution.PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.