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

imp(dymns): persist EIP-155 part only, for RollApp-related configs, to avoid migration when RollApp chain-id changed #1285

Conversation

VictorTrustyDev
Copy link
Contributor

@VictorTrustyDev VictorTrustyDev commented Oct 4, 2024

Description


Closes #1078

To avoid data migration when a RollApp chain-id changed due to fraud,... x/dymns now adjust logic to save only EIP-155 part (ra_100-1 => 100) instead of Full chain-id.

This PR contains:

  • Persist only EIP-155 part for Dym-Name config if the chain is a RollApp.
    • Adjustment to the ChainID field of Dym-Name config.
  • Persist only EIP-155 part for Alias <=> RollApp linking.
    • Adjustment to the underlying store value, now EIP-155 instead of Full chain-id.
  • Improve performance by adding 2 methods into x/rollapp keeper:
    • IsRollAppExists(string) bool
    • GetRollAppIdByEIP155(string) string
  • Add data migration for Playground-only.

cc: @omritoptix @danwt


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.

@VictorTrustyDev VictorTrustyDev marked this pull request as ready for review October 4, 2024 13:46
@VictorTrustyDev VictorTrustyDev requested a review from a team as a code owner October 4, 2024 13:46
@VictorTrustyDev VictorTrustyDev changed the title imp: persist EIP-155 part only, for RollApp-related configs, to avoid migration when RollApp chain-id changed imp(dymns): persist EIP-155 part only, for RollApp-related configs, to avoid migration when RollApp chain-id changed Oct 4, 2024
if anyUpdated {
err := k.SetDymName(ctx, dymName)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
Comment on lines +159 to +161
for alias := range unique {
uniqueAliases = append(uniqueAliases, alias)
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
// TODO DymNS: delete this
am.keeper.BeginBlockMigrationForPlayground(ctx)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
@VictorTrustyDev
Copy link
Contributor Author

No need for now.

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.

fraud: Impact of fraud submission on x/dymns alias records
1 participant