-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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: Add a flag to export for zero-height start #2827
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #2827 +/- ##
==========================================
Coverage ? 56.73%
==========================================
Files ? 120
Lines ? 8333
Branches ? 0
==========================================
Hits ? 4728
Misses ? 3286
Partials ? 319 |
@@ -21,8 +21,8 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) (res [ | |||
|
|||
// We need to pretend to be "n blocks before genesis", where "n" is the validator update delay, | |||
// so that e.g. slashing periods are correctly initialized for the validator set | |||
// e.g. with a one-block offset - the first TM block is at height 0, so state updates applied from genesis.json are in block -1. | |||
ctx = ctx.WithBlockHeight(-types.ValidatorUpdateDelay) | |||
// e.g. with a one-block offset - the first TM block is at height 1, so state updates applied from genesis.json are in block 0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tendermint used to start at block height 0, now it starts at 1, so we needed to update this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woot! - few comments herein - Also did a push for some formatting and a missing Close()
Retargeted on #2825 for the new invariants. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Chris!
OK, there's a latent distribution oddity somewhere. It isn't introduced by this PR, but it seems to have been discovered only now. I've added the invariant to the general simulation, which now fails on some seeds. |
To debug this, I'm improving the simulator a bit... @rigelrozanski I've verified on my branch above that the bugfixes do not address chris's new bug. NOTE: chris's new invariance has been added to the above PR. It changes usage of rand, so we'll need to find new seeds that cause the problem. |
Closes #2812
Depends on #2807 and #2825, can be retargeted to develop once those PRs are merged.
This PR adds the flag
--for-zero-height
togaiad export
, which runs several alterations to the application state to prepare for restarting a new chain in a consistent fashion.It also:
cmd/gaia/app/export.go
for cleaner separation.initChainer
as happening at height -1 - it should now happen at height 0, since the first header sent by Tendermint has height 1.initChainer
)Height
field fromDelegation
objects inx/stake
, which was not used anywhereStandard checklist:
docs/
)PENDING.md
with issue #Files changed
in the github PR explorerFor Admin Use: