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

Move channel back to counterparty #7842

Draft
wants to merge 8 commits into
base: feat/ibc-eureka
Choose a base branch
from

Conversation

AdityaSripal
Copy link
Member

@AdityaSripal AdityaSripal commented Jan 13, 2025

Description

closes: #7739


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

@AdityaSripal AdityaSripal changed the base branch from main to feat/ibc-eureka January 13, 2025 16:10
Copy link
Contributor

@gjermundgaraba gjermundgaraba left a comment

Choose a reason for hiding this comment

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

Thanks! This is going to be very nice! 🙌

The general structure and logic seems straightforward and understandable. I have some questions on naming that I left in comments.

// client identifier
string client_id = 1;
// counterparty merkle prefix
repeated bytes merkle_prefix = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

To avoid confusion, I would also name this counterparty_merkle_prefix.
Or restructure the message like this:

string client_id = 1;
CounterpartyInfo counterparty = 2;

// resolveV2Identifiers returns the client identifier and the counterpartyInfo for the client given the packetId
// Note: For fresh eureka channels, the client identifier and packet identifier are the same.
// For aliased channels, the packet identifier will be the original channel ID and the counterpartyInfo will be constructed from the channel
func (k *Keeper) resolveV2Identifiers(ctx context.Context, portId string, packetId string) (string, clienttypes.CounterpartyInfo, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think maybe the name could be better here. If I have to read the comment to understand what the function does for me, I consider it a code smell :)

Copy link
Contributor

Choose a reason for hiding this comment

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

After seeing it used further down I am even more confused. Is it taking in packetId or a client id?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea this was because it could also be an original channelID for aliasing, in which case I still need to retrieve the original clientiD

@@ -14,9 +14,9 @@ message Packet {
// with a later sequence number.
uint64 sequence = 1;
// identifies the sending chain.
string source_channel = 2;
string source_id = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

It will be the last time I bring this up (I hope), but what is the reason we don't want to name source and destination identifier client_id (as in source_client_id)? Can it be anything else?

return 0, "", errorsmod.Wrap(types.ErrChannelNotFound, sourceChannel)
}
// lookup counterparty and clientid from packet identifiers
clientID, counterparty, err := k.resolveV2Identifiers(ctx, payloads[0].SourcePort, sourceId)
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought this function was taking in a packet identifier? But it is taking in the source (client) identifier?

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.

2 participants