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: channel-v2 genesis #7933

Merged
merged 8 commits into from
Feb 10, 2025
Merged

feat: channel-v2 genesis #7933

merged 8 commits into from
Feb 10, 2025

Conversation

aljo242
Copy link
Collaborator

@aljo242 aljo242 commented Feb 7, 2025

Description

Wire up the genesis for the channel/v2 module
Create keeper functions for getting all of the state per Client ID
Keeper-level testing

closes: #7922


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.

)

// TestInitExportGenesis tests the import and export flow for the channel v2 keeper.
func (suite *KeeperTestSuite) TestInitExportGenesis() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This testing setup is what I feel the least confident about. There was not a previous testing setup in the v1 module for genesis, so this is what I rolled with.

The intricacy is that the ibctesting suite already has initialized genesis for things like the client keeper and some actions have led to state existing. So for creating a valid genesis that will be exported properly, we have to use existing state to set it

Base automatically changed from feat/ibc-eureka to main February 7, 2025 17:48
@aljo242 aljo242 force-pushed the feat/channel-v2-genesis branch from 3360b99 to 6459667 Compare February 7, 2025 18:52
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.

After checking this more carefully, I believe it needs some changes to work the same way as v1.
If you look at how genesis and the whole module is set up in v1, it is all done through the core IBC module. So InitGenesis and all of that is called from there. This is also where it is tested in v1.

Copy link
Member

@AdityaSripal AdityaSripal left a comment

Choose a reason for hiding this comment

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

Generally looks good!! Think the testing setup can be improved either here or in subsequent PR

var commitments []types.PacketState
for ; iterator.Valid(); iterator.Next() {
sequenceBz := bytes.TrimPrefix(iterator.Key(), storePrefix)
sequence := sdk.BigEndianToUint64(sequenceBz)
Copy link
Member

Choose a reason for hiding this comment

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

What happens if this byte slice is more than 64 bytes? Should never happen but perhaps we should add a defensive check

modules/core/04-channel/v2/keeper/genesis_test.go Outdated Show resolved Hide resolved
@aljo242
Copy link
Collaborator Author

aljo242 commented Feb 10, 2025

refactor

Addressed here

Copy link
Member

@AdityaSripal AdityaSripal left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks

Copy link

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.

Nice! Thank you 🙏🦸🚀

@AdityaSripal AdityaSripal added this pull request to the merge queue Feb 10, 2025
Merged via the queue into main with commit 4f3c2d8 Feb 10, 2025
69 of 70 checks passed
@AdityaSripal AdityaSripal deleted the feat/channel-v2-genesis branch February 10, 2025 23:32
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.

Wire up genesis for 04-channel v2
3 participants