Closed Farhad-Shabani closed 3 months ago
Attention: Patch coverage is 95.89041%
with 3 lines
in your changes are missing coverage. Please review.
Project coverage is 64.10%. Comparing base (
ee1107f
) to head (d6cbee7
).
Files | Patch % | Lines |
---|---|---|
.../ics07-tendermint/src/client_state/misbehaviour.rs | 91.42% | 3 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I could make some of the functions touched in this PR completely client-agnostic, reusable by other light client types that could benefit from by importing/calling these functions/methods. However, there is a where
clause bound for most standalone functions like verify_header
and verify_misbehaviour
as below:
V::ConsensusStateRef: ConsensusStateConverter
Which ultimately ties these functions to the Tendermint ConsensusState
type.
Nevertheless, the changes in this PR should still make sense and pave the way for later refactoring custom ICS07 client ValidationContext
and ExecutionContext
to accept either a generic or associated type for the consensus state type, allowing developers to specify their custom type.
Is it correct to conclude that it may make sense to introduce traits to provide these methods for use in these functions, and a customized tendermint client just implements them?
pub trait TendermintClientState {
fn chain_id(&self) -> &ChainId;
fn options(&self) -> &Options;
}
pub trait TendermintConsensusState {
fn timestamp(&self) -> Time;
fn next_validator_hash(&self) -> Hash;
}
Of course, this requires some reworks - so for now, this PR is all right. But my suggestion may be relevant for a future PR.
Exactly, I thought of something similar. I initially tried some ideas to avoid introducing any new traits. However, sounds like that's inevitable. Nevertheless, since deciding on this requires a thorough evaluation to ensure a solid addition, I decided to address it in a separate PR.
Closes: #1149
PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.