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

MockClientState to RawMockClientState conversion ignores frozen_height #1052

Closed
rnbguy opened this issue Jan 23, 2024 · 4 comments · Fixed by #1109
Closed

MockClientState to RawMockClientState conversion ignores frozen_height #1052

rnbguy opened this issue Jan 23, 2024 · 4 comments · Fixed by #1109
Assignees

Comments

@rnbguy
Copy link
Collaborator

rnbguy commented Jan 23, 2024

Bug Summary

The following implementation ignores frozen_height of MockClientState.

impl From<MockClientState> for RawMockClientState {
fn from(value: MockClientState) -> Self {
RawMockClientState {
header: Some(RawMockHeader {
height: Some(value.header.height().into()),
timestamp: value.header.timestamp.nanoseconds(),
}),
}
}
}

So, the serialization-deserialization may not work as expected.

Details

For example, the following fails,

let header = MockHeader::new(Height::new(0, 1).unwrap());
let client_state = MockClientState::new(header).with_frozen_height(Height::min(0));
let raw_client_state = RawMockClientState::from(client_state);
let client_state_back = MockClientState::try_from(raw_client_state).unwrap();
assert_eq!(client_state, client_state_back);

We need to update the original ibc.mock definitions on ibc-proto-rs repo and fix the From implementation in this repo.

Version

<= v0.49.1

Tracked by https://github.com/cosmos/ibc-rs/tree/feat/refactor-testkit

Will be fixed by #1068

@rnbguy
Copy link
Collaborator Author

rnbguy commented Jan 23, 2024

Note: the same happens with MockConsensusState and RawMockConsensusState where it ignores the commitment root.

@gr4yha7
Copy link
Contributor

gr4yha7 commented Feb 29, 2024

@rnbguy I can pick this up.

@rnbguy rnbguy self-assigned this Feb 29, 2024
@rnbguy
Copy link
Collaborator Author

rnbguy commented Feb 29, 2024

sorry, I am already working on this on the feature branch https://github.com/cosmos/ibc-rs/tree/feat/refactor-testkit

@rnbguy
Copy link
Collaborator Author

rnbguy commented May 4, 2024

closed by #1109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants