Skip to content
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

[ibc-client-tendermint-types] properly handle fallible conversion between prost Duration and core Duration #1376

Open
rnbguy opened this issue Nov 12, 2024 · 0 comments
Labels
A: bug Admin: something isn't working

Comments

@rnbguy
Copy link
Collaborator

rnbguy commented Nov 12, 2024

Bug Summary

This PR informalsystems/tendermint-rs#1456 makes the conversion between tendermint-rs's auto-compiled Google's Duration and core::time::Duration fallible in both direction.

Because of this, our From<DomainClientState> for ProtoClientState pattern fails for Tendermint light client state implementations.

Details

The below is the current fix for Tendermint light client fields which use Duration type.

trusting_period: value.trusting_period.try_into().ok(),
unbonding_period: value.unbonding_period.try_into().ok(),
max_clock_drift: value.max_clock_drift.try_into().ok(),

Ideally, the following implementation

impl From<ClientState> for RawTmClientState {

should be refactored to,

impl TryFrom<ClientState> for RawTmClientState

with

 trusting_period: Some(value.trusting_period.try_into()?), 
 unbonding_period: Some(value.unbonding_period.try_into()?), 
 max_clock_drift: Some(value.max_clock_drift.try_into()?),

For this, we need a refactor of Protobuf trait in tendermint-rs repo -- which should use TryFrom<Self>.

pub trait Protobuf<T: Message + TryFrom<Self> + Default>
where ...

Version

@rnbguy rnbguy added the A: bug Admin: something isn't working label Nov 12, 2024
@rnbguy rnbguy added this to ibc-rs Nov 12, 2024
@github-project-automation github-project-automation bot moved this to 📥 To Do in ibc-rs Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: bug Admin: something isn't working
Projects
Status: 📥 To Do
Development

No branches or pull requests

1 participant