cosmos / ibc-rs

Rust implementation of the Inter-Blockchain Communication (IBC) protocol.
Apache License 2.0
182 stars 74 forks source link

feat: allow custom `HostFunctionsProvider` in `MerkleProof` #1158

Closed Farhad-Shabani closed 3 months ago

Farhad-Shabani commented 3 months ago

Closes: #1147

Integration tests: https://github.com/informalsystems/basecoin-rs/pull/174


PR author checklist:

Reviewer checklist:

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 41.42857% with 41 lines in your changes are missing coverage. Please review.

Project coverage is 63.79%. Comparing base (91bee67) to head (fdab306).

Files Patch % Lines
...lients/ics07-tendermint/src/client_state/common.rs 0.00% 27 Missing :warning:
ibc-core/ics23-commitment/types/src/merkle.rs 0.00% 13 Missing :warning:
ibc-clients/ics07-tendermint/types/src/header.rs 85.71% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1158 +/- ## ========================================== + Coverage 63.76% 63.79% +0.03% ========================================== Files 219 219 Lines 21387 21391 +4 ========================================== + Hits 13638 13647 +9 + Misses 7749 7744 -5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Farhad-Shabani commented 3 months ago

Hey @mina86, See please changes in this PR meet your requirements?

This follows a similar approach we took for enabling a custom Tendermint Verifier. Meaning that, so far, we've been using a concrete HostFunctionsManager (as seen with the ProdVerifier), with this, you now have the option to introduce your custom object that implements the HostFunctionsProvider. However, admittedly, this requires defining a similar ClientState wrapper type on your end and implementing the ClientState traits using standalone functions under the ibc-client-tendermint crate. Following that, you should be able to inject your custom HostFunctionsManager here (same as the way a custom Tendermint verifier can be passed).

Note that to enable the ClientState newtype to be generic over the HostFunctionsProvider (And even perhaps over the TmVerifier), we need to devise a thoughtful solution that involves making adjustments in upstream libraries such as tendermint-rs and ics23 (like this), ensuring relevant changes keep the ibc-derive working, and as well, won’t cause disruptions for other users.

Therefore, take this as an interim solution. Let us know your thoughts. Happy to help in any way we can.