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

R4R: Reset slashing periods on export #3189

Merged
merged 7 commits into from
Jan 2, 2019

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Dec 21, 2018

closes: #3187


  • 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 entries in PENDING.md with issue #

  • 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)

@codecov
Copy link

codecov bot commented Dec 21, 2018

Codecov Report

Merging #3189 into develop will decrease coverage by 0.03%.
The diff coverage is 80%.

@@             Coverage Diff             @@
##           develop    #3189      +/-   ##
===========================================
- Coverage    54.85%   54.82%   -0.04%     
===========================================
  Files          133      133              
  Lines         9559     9552       -7     
===========================================
- Hits          5244     5237       -7     
  Misses        3994     3994              
  Partials       321      321

@alexanderbez
Copy link
Contributor Author

alexanderbez commented Dec 21, 2018

Running this with a 500 block variant of import/export simulation.

EDIT: Never mind, I do not have adequate memory on my machine to run such a simulation.

@alexanderbez alexanderbez changed the title WIP: Reset slashing periods on export R4R: Reset slashing periods on export Dec 21, 2018
}
app.slashingKeeper.SetValidatorSlashingPeriod(ctx, sp)
}

Copy link
Member

Choose a reason for hiding this comment

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

So @cwgoes had the perspective that the correct behavior would be to have initChain actually set the slashing period for validator in state at the beginning of the chain.

This fix puts the responsibility on the export function to ensure that this invariant is maintained. Just checking that this is the best approach?

Copy link
Contributor

Choose a reason for hiding this comment

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

initChain already does this - usually - it just doesn't do it in the case when state was exported (which is a mistake). I think either mechanism is OK, it has to be "special-cased" either way.

Copy link
Member

Choose a reason for hiding this comment

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

Doing reseting the slashing periods via the state export is more "backwards compatible"

@zmanian
Copy link
Member

zmanian commented Dec 26, 2018

I made a branch where this change was applied to v0.29.0 over here for testing the genki-4000-> genki-4001 upgrade

https://github.com/zmanian/cosmos-sdk/tree/v0.29.1

@alexanderbez
Copy link
Contributor Author

How did the results turn out @zmanian?

@zmanian
Copy link
Member

zmanian commented Dec 26, 2018

Check it out.
certusone/genki-4000#4

Copy link
Contributor

@rigelrozanski rigelrozanski left a comment

Choose a reason for hiding this comment

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

looks good, minor comment,

one question: does the export function actually affect the state of the blockchain (seems bad)? or does it just affect a cached state before the export? As in, if I was to run a transaction after running an export, the slashing period should still be maintained on the committed state correct?

cmd/gaia/app/export.go Show resolved Hide resolved
@cwgoes
Copy link
Contributor

cwgoes commented Jan 2, 2019

one question: does the export function actually affect the state of the blockchain (seems bad)?

Presently it runs on the CheckTx state (which we could change to a cached state), but it doesn't matter since the export command exits immediately after exporting data (it's a gaiad command, not callable through the RPC or CLI).

Copy link
Member

@jackzampolin jackzampolin left a comment

Choose a reason for hiding this comment

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

This looks good to me!

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

tACK

@cwgoes cwgoes merged commit 15bd1f6 into develop Jan 2, 2019
@cwgoes cwgoes deleted the bez/3187-slashing-period-export branch January 2, 2019 23:57
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 C:x/slashing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GoS Upgrade 2 Halt Stacktrace
5 participants