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

v0.36 supply changes to genesis migration #4686

Merged
merged 127 commits into from
Jul 18, 2019
Merged

v0.36 supply changes to genesis migration #4686

merged 127 commits into from
Jul 18, 2019

Conversation

fedekunze
Copy link
Collaborator

  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added a relevant changelog entry: clog add [section] [stanza] [message]

  • rereviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

sabau and others added 30 commits June 3, 2019 15:20
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Once done need to experiment with go plugins to switch types as make parameters

Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Co-Authored-By: Alexander Bezobchuk <[email protected]>
Co-Authored-By: Alexander Bezobchuk <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Co-Authored-By: Alexander Bezobchuk <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Co-Authored-By: Alexander Bezobchuk <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
// Migrate accepts exported genesis state from v0.34 and migrates it to v0.36
// genesis state. All entries are identical except for validator slashing events
// which now include the period.
func Migrate(oldGenState v034auth.GenesisState) GenesisState {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should have a test case:

Given oldGenState as input
When Migrate(oldGenState) is called
Then output == expected

Copy link
Contributor

@sabau sabau Jul 10, 2019

Choose a reason for hiding this comment

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

I just added a basic test, I haven't tested the no-op, in this case Params is just forwarded, I was thinking to apply the same logic all over the migrate tests.

This won't hold if we decide to fix this https://github.com/cosmos/cosmos-sdk/pull/4686/files#r301969445

// Migrate accepts exported genesis state from v0.34 and migrates it to v0.36
// genesis state. It deletes the governance base accounts and creates the new module accounts.
// The remaining accounts are updated to the new GenesisAccount type from 0.36
func Migrate(
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto - testing is needed here


// Migrate accepts exported genesis state from v0.34 and migrates it to v0.36
// genesis state. All entries are identical except for validator slashing events
// which now include the period.
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is the period added?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that comment doesn't apply here, the only change to auth was removing the FeeCollectorKeeper

sabau and others added 5 commits July 10, 2019 17:11
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
…ed was present or not

Signed-off-by: Karoly Albert Szabo <[email protected]>
Addressing this comment:
#4686 (comment)

Merged to latest commit of master, then made change in
only migrate.go and types.go o fx/genaccounts/legacy/v0_36
@fedekunze fedekunze added this to the v0.36.0 milestone Jul 11, 2019
fedekunze and others added 4 commits July 11, 2019 22:48
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
The simulation used ModuleAccount addresses for
standard operations such as delegate, send, etc.
To fix this the module account addresses were added
to a map in simapp. Then random accounts are checked
against this map to ensure the address does not match.
Also, after pulling from genesis, accounts who have a
module account address are removed from the accounts
used for random activity.
@mircea-c
Copy link

I got two failed seeds running the long sim (1000 blocks) today.

Genesis file used (exported from mainnet at height 1017669):
genesis-zero.zip

gaiad compiled from:

commit ef036fe9913dbe948f4d5288b135e50faeed9fdf (HEAD -> colin/supply-genesis-testing, origin/colin/supply-genesis-testing)
Author: Colin Axner <[email protected]>
Date:   Mon Jul 15 09:30:18 2019 -0700

    update build errors in sim and go mod

genesis.json migration:

gaiad migrate v0.36 /home/mircea/genesis-zero.json --chain-id=cosmoshub-3 --genesis-time=2019-04-22T17:00:00Z > /home/mircea/genesis.json

cosmos-sdk commit:

commit a8f5a5f93ee295774f5455dcf5ab999ff7f6d2ed (HEAD -> supply-genesis, origin/supply-genesis)
Author: Federico Kunze <[email protected]>
Date:   Tue Jul 16 11:31:37 2019 +0200

    fix test

Run log:
seed 174
seed 297

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

Few minor nits, but otherwise LGTM.

simapp/app.go Outdated Show resolved Hide resolved
simapp/sim_test.go Outdated Show resolved Hide resolved
simapp/sim_test.go Outdated Show resolved Hide resolved
simapp/sim_test.go Outdated Show resolved Hide resolved
@@ -179,6 +169,18 @@ func (k Keeper) withdrawDelegationRewards(ctx sdk.Context, val exported.Validato
}
}

// update the outstanding rewards and the community pool only if the
Copy link
Contributor

Choose a reason for hiding this comment

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

These changes aren't necessary, but I don't see them causing any harm.

x/simulation/simulate.go Outdated Show resolved Hide resolved
x/simulation/simulate.go Outdated Show resolved Hide resolved
x/simulation/simulate.go Outdated Show resolved Hide resolved
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

ACK

@alexanderbez
Copy link
Contributor

Merging PR. Simulation passes on most seeds. Any subsequent failures should be followed up in new issues/PRs.

@alexanderbez alexanderbez merged commit a922dad into master Jul 18, 2019
@alexanderbez alexanderbez deleted the supply-genesis branch July 18, 2019 12:44
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:genesis relating to chain genesis
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants