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

Fix Pass ChannelId by value instead of reference since it impls Copy #542

Closed
wants to merge 6 commits into from

Conversation

DaviRain-Su
Copy link
Contributor

Closes: #537

Description


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests.
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

@codecov
Copy link

codecov bot commented Mar 17, 2023

Codecov Report

Patch coverage: 69.76% and project coverage change: -0.17 ⚠️

Comparison is base (2d64819) 72.70% compared to head (1bd3cab) 72.53%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #542      +/-   ##
==========================================
- Coverage   72.70%   72.53%   -0.17%     
==========================================
  Files         126      126              
  Lines       15550    15523      -27     
==========================================
- Hits        11306    11260      -46     
- Misses       4244     4263      +19     
Impacted Files Coverage Δ
crates/ibc/src/applications/transfer/relay.rs 0.00% <0.00%> (ø)
.../src/applications/transfer/relay/on_recv_packet.rs 0.00% <0.00%> (ø)
...src/core/ics04_channel/events/packet_attributes.rs 10.30% <0.00%> (-0.53%) ⬇️
crates/ibc/src/core/ics24_host/error.rs 0.00% <ø> (ø)
.../ibc/src/core/ics04_channel/handler/send_packet.rs 84.78% <33.33%> (-0.49%) ⬇️
...ates/ibc/src/core/ics04_channel/handler/timeout.rs 89.26% <33.33%> (ø)
crates/ibc/src/core/ics24_host/identifier.rs 60.61% <37.03%> (-1.77%) ⬇️
.../src/core/ics04_channel/handler/acknowledgement.rs 86.89% <50.00%> (-0.19%) ⬇️
...c/src/applications/transfer/relay/send_transfer.rs 92.70% <57.14%> (-3.14%) ⬇️
.../src/core/ics04_channel/handler/chan_close_init.rs 81.48% <66.66%> (ø)
... and 20 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines +415 to +416
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ChannelId(u64);
Copy link
Contributor

@kevinji kevinji Mar 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this break compatibility with other IBC chains? I don't think the spec requires that the channel ID be a u64, only that it's an Identifier, which is defined as

An Identifier is a bytestring used as a key for an object stored in state, such as a connection, channel, or light client.

Identifiers MUST be non-empty (of positive integer length).

Identifiers MUST consist of characters in one of the following categories only:

  • Alphanumeric
  • ., _, +, -, #
  • [, ], <, >

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes indeed, I did some digging into the history of this issue. It was created when ChannelId was a u64. However we changed it to String in this PR, for exactly these reasons. I will close this PR and the issue as "won't do".

Thank you @DaviRain-Su for ultimately bringing this to light; sorry for needing to throw away all this code.

@plafer
Copy link
Contributor

plafer commented Mar 22, 2023

See #542 (comment)

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

Successfully merging this pull request may close these issues.

[Crate] Pass ChannelId by value instead of reference since it impls Copy
3 participants