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 #933

Merged
merged 459 commits into from
Jun 19, 2024
Merged

Conversation

danwt
Copy link
Contributor

@danwt danwt commented Jun 12, 2024

Description

See

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

Recommended to start reviewing with https://github.com/dymensionxyz/dymension/blob/danwt/932-genesis-bridge/x/rollapp/transfergenesis/doc.go and https://github.com/dymensionxyz/dymension-rdk/blob/danwt/448-genesis-bridge/x/hub-genesis/keeper/ibc_module.go#L39-L77

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

This PR:

  • Adds a new ante handler to see if ibc transfers are allowed for the rollapp
  • fixes naming for our 'middlewares' to make them clearly one of ibc module / ics4 wrapper / middleware
  • adds a new temporary ibc module to set the canonical channel id, since we no longer do that using a whitelisted addr
  • adds a new ibc module to handle incoming 'genesis transfers'. It validates the special memo and registers a denom. It will not allow any regular transfers if transfers are not enabled
  • adds genesis transfers bookkeeping to the rollapp genesis state
  • renames is_genesis_event on the rollapp gensis state to 'transfers_enabled' this is backwards compatible
  • removes concept of passing genesis accounts and denoms in the create rollapp message
  • moves our various utils to properly namespaced packages under utils/
  • adds a gerr (google error ) and derr (dymension error) packages for idiomatic error handling. (In future we will consolidate across dymint/rdk)
  • dry out existing middlewares to make use of new .GetValidTransfer* functions which take care of parsing and validating the fungible packet, and querying and validating any associated rollapp and finalizations
  • removes the obsolete ValidateRollappId func and sub funcs
  • adds the notion of skipctx to delayedack, to skip it with a special sdk context value
  • adds a transfersenabled flag to createRollapp (might be changed in future)
  • simplify GetAllBlockHeightToFinalizationQueue

Closes #932

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.

PR review checkboxes:

I have...

  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Targeted PR against the correct branch
  • included the correct type prefix in the PR title
  • Linked to the GitHub issue with discussion and accepted design
  • Targets only one GitHub issue
  • Wrote unit and integration tests
  • Wrote relevant migration scripts if necessary
  • All CI checks have passed
  • Added relevant godoc comments
  • Updated the scripts for local run, e.g genesis_config_commands.sh if the PR changes parameters
  • Add an issue in the e2e-tests repo if necessary

SDK Checklist

  • Import/Export Genesis
  • Registered Invariants
  • Registered Events
  • Updated openapi.yaml
  • No usage of go map
  • No usage of time.Now()
  • Used fixed point arithmetic and not float arithmetic
  • Avoid panicking in Begin/End block as much as possible
  • No unexpected math Overflow
  • Used sendCoin and not SendCoins
  • Out-of-block compute is bounded
  • No serialized ID at the end of store keys
  • UInt to byte conversion should use BigEndian

Full security checklist here

----;

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 the PR targets the main branch, PR should not be squash merge in order to keep meaningful git history.
  • In case the PR targets a release branch, PR must be rebased.

@danwt danwt requested a review from mtsitrin June 19, 2024 09:39
@danwt
Copy link
Contributor Author

danwt commented Jun 19, 2024

@mtsitrin I made an issue to replace the ante handler with an ics4 module #957

@mtsitrin mtsitrin merged commit 4565f34 into main Jun 19, 2024
8 checks passed
@mtsitrin mtsitrin deleted the danwt/932-genesis-bridge branch June 19, 2024 10:56
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
3 participants