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

imp(ibc-testkit): refactor HostBlock with a trait #1044

Closed
rnbguy opened this issue Jan 18, 2024 · 2 comments · Fixed by #1109
Closed

imp(ibc-testkit): refactor HostBlock with a trait #1044

rnbguy opened this issue Jan 18, 2024 · 2 comments · Fixed by #1109
Assignees

Comments

@rnbguy
Copy link
Collaborator

rnbguy commented Jan 18, 2024

Details

Currently, HostBlock is implemented as an enum of different host variants.

pub enum HostBlock {
Mock(Box<MockHeader>),
SyntheticTendermint(Box<SyntheticTmBlock>),
}

This made its implementation a manual dispatching of methods from MockHeader and SyntheticTmBlock. We can avoid this by implementing a HostBlock trait for these two and generalizing an IBC context with a generic with the HostBlock trait bound.

Also, this allows a downstream project to reuse our MockContext with their host block variant.

This was blocked before because the ClientState derive didn't support generics. Since #1016 is resolved, we can use generics with trait bounds in an IBC context.

Version

<= v0.50.0

@rnbguy rnbguy self-assigned this Jan 18, 2024
@rnbguy rnbguy changed the title refactor(ibc-testkit): remove unnecessary Boxing imp(ibc-testkit): remove unnecessary Boxing Jan 18, 2024
@rnbguy rnbguy changed the title imp(ibc-testkit): remove unnecessary Boxing imp(ibc-testkit): remove unnecessary Boxing in HostBlock Jan 18, 2024
@github-project-automation github-project-automation bot moved this to 📥 To Do in ibc-rs Jan 19, 2024
@rnbguy rnbguy changed the title imp(ibc-testkit): remove unnecessary Boxing in HostBlock imp(ibc-testkit): refactor HostBlock with a trait Jan 29, 2024
@rnbguy
Copy link
Collaborator Author

rnbguy commented Jan 29, 2024

This is an improvement over HostType removal as part of #677

@rnbguy
Copy link
Collaborator Author

rnbguy commented May 4, 2024

closed by #1109

@rnbguy rnbguy closed this as completed May 4, 2024
@github-project-automation github-project-automation bot moved this from 📥 To Do to ✅ Done in ibc-rs May 4, 2024
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.

1 participant