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(genesis bridge): genesis transfers #449

Merged
merged 127 commits into from
Jun 19, 2024
Merged

feat(genesis bridge): genesis transfers #449

merged 127 commits into from
Jun 19, 2024

Conversation

danwt
Copy link
Contributor

@danwt danwt commented Jun 12, 2024

PR Standards

See

https://github.com/dymensionxyz/research/issues/278 for the master issue.

There are a few outstanding items, that this PR does not try to solve.

This PR

  • removes concept of whitelisted genesis triggerer
  • adds genesis accounts to the hub genesis rollapp state
  • adds an ibc module to send tokens on OnChanOpenConfirm to the hub, containing a special memo which the hub will respect to skip eibc
  • adds an ics4 wrapper to stop any user from using the special memo

Opening a pull request should be able to meet the following requirements


Closes #448

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.

For Author:

  • Targeted PR against correct branch
  • included the correct type prefix in the PR title
  • Linked to Github issue with discussion and accepted design
  • Targets only one github issue
  • Wrote unit and integration tests
  • All CI checks have passed
  • Added relevant godoc comments

For Reviewer:

  • confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • confirmed all author checklist items have been addressed

After reviewer approval:

  • In case targets main branch, PR should be squashed and merged.
  • In case PR targets a release branch, PR should be rebased.

Summary by CodeRabbit

  • New Features

    • Introduced IBCModule for handling channel opening confirmations and genesis account transfers.
  • Improvements

    • Enhanced the State validation logic with specific checks for Amount and Address.
  • Refactor

    • Updated module configurations and permissions for better alignment with the latest specifications.
    • Renamed several components for consistency and clarity.
    • Removed redundant functionalities to streamline the codebase.

@danwt danwt requested a review from zale144 June 17, 2024 13:32
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 686400f and e6aec5a.

Files selected for processing (1)
  • x/hub-genesis/keeper/ibc_module.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • x/hub-genesis/keeper/ibc_module.go

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e6aec5a and 3645a64.

Files selected for processing (1)
  • x/hub-genesis/keeper/ibc_module.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • x/hub-genesis/keeper/ibc_module.go

srene
srene previously approved these changes Jun 18, 2024
x/hub-genesis/types/state.go Outdated Show resolved Hide resolved
@danwt
Copy link
Contributor Author

danwt commented Jun 18, 2024

Thanks @srene
I just fixed the validate func
Please could you green again?

srene
srene previously approved these changes Jun 18, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3645a64 and 9f0d503.

Files selected for processing (1)
  • x/hub-genesis/types/state.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • x/hub-genesis/types/state.go

Copy link
Contributor

@zale144 zale144 left a comment

Choose a reason for hiding this comment

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

lgtm

@danwt danwt merged commit b3343e1 into main Jun 19, 2024
7 checks passed
@danwt danwt deleted the danwt/448-genesis-bridge branch June 19, 2024 12:57
@@ -1,6 +1,7 @@
package keeper_test

import (
_ "embed"
Copy link
Collaborator

Choose a reason for hiding this comment

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

what for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see #458

func (w IBCModule) mintAndTransfer(
ctx sdk.Context,
n int,
a types.GenesisAccount,
Copy link
Collaborator

Choose a reason for hiding this comment

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

better name for a?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see #458

l.Info("Sent genesis transfer.", "index", i, "receiver", a.GetAddress(), "coin", a)
}

state.GenesisAccounts = nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't u prefer to have additional bool flag?
now when querying the hub-genesis state it seems as no allocation were registered

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see #458

channelID string,
) error {
coin := a.GetAmount()
err := w.mintCoins(ctx, types.ModuleName, sdk.Coins{coin})
Copy link
Collaborator

Choose a reason for hiding this comment

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

what about validating the minted denom is the actual native denom of the RA?
otherwise u can mint whatever

Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we also support rollapps operating with exclusively 3rd party tokens?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have an opinion on this
Last I spoke to Omri on the product perspective, the rollapp can only hurt himself here, so it's fine
cc (@omritoptix wdyt? )

Copy link
Contributor

Choose a reason for hiding this comment

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

As I see it, @mtsitrin is correct in the fact that you could potentially fake denoms on the rollapp, i.e set the coin to channel-0/adym which would than mint it on the rollapp, however in terms of implications, I believe it will fail the transfer, as on the hub it will try to unescrow adym from the vault (i.e ibc channel of this rollapp), and since adym was never escrowed (as the bridge is only open after this phase is completed successfully) it will not be able to complete the transfer (ackErr) and the bridge will forever be closed.

Assuming what I'm saying is correct, I think we can skip the validation on the security level. However with that being said, I think we can easily add a validation on the hub-genesis/keeper.go/genesis.go when importing the genesis accounts that the denom is indeed a valid non-ibc denom (e.g only alpha numeric letter).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see #458
#462

@mtsitrin
Copy link
Collaborator

merged in the middle of review

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

Successfully merging this pull request may close these issues.

Genesis bridge v2 : first milestone
5 participants