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

feat: allow custom client ids #362

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Conversation

srdtrk
Copy link
Member

@srdtrk srdtrk commented Mar 4, 2025

Description

closes: #360


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.

  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Wrote unit and integration tests.
  • Added relevant natspec and godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

Copy link

codecov bot commented Mar 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.86%. Comparing base (6bb8fcf) to head (a6294c2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #362   +/-   ##
=======================================
  Coverage   99.85%   99.86%           
=======================================
  Files          14       14           
  Lines         706      730   +24     
=======================================
+ Hits          705      729   +24     
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@srdtrk srdtrk marked this pull request as ready for review March 5, 2025 07:57
@srdtrk srdtrk requested a review from gjermundgaraba as a code owner March 5, 2025 07:57
// The following test cases are based on the test cases of ibc-go:
// https://github.com/cosmos/ibc-go/blob/e443a88e0f2c84c131c5a1de47945a5733ff9c91/modules/core/24-host/validate_test.go#L57
ValidatePortIdentifierTestCase[] memory testCases = new ValidatePortIdentifierTestCase[](12);
ValidatePortIdentifierTestCase[] memory testCases = new ValidatePortIdentifierTestCase[](14);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we also pass the app address to this function now, we should add a test case for that.

Copy link
Member Author

Choose a reason for hiding this comment

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

We have always passed the app address into this. Probably should have a test case

function _addIBCApp(string memory portId, address app) private {
ICS26RouterStorage storage $ = _getICS26RouterStorage();
require(address($._apps[portId]) == address(0), IBCPortAlreadyExists(portId));
require(IBCIdentifiers.validateCustomIdentifier(bytes(portId)), IBCInvalidPortIdentifier(portId));
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 the previous name was better, since we still use this for non-custom port identifiers.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just validateIBCIdentifier? Or maybe we just have separate functions. Not sure if these has to always be the same (even if they are right now)

onlyRole(CLIENT_ID_CUSTOMIZER_ROLE)
returns (string memory)
{
require(bytes(clientId).length != 0, IBCInvalidClientId(clientId));
Copy link
Contributor

Choose a reason for hiding this comment

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

Should‘t we also check that the custom name is not in use? Because we'll just overwrite it here otherwise.

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.

Add support for custom client ids
2 participants