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

blockchain: Validate early final state is zero. #1031

Merged
merged 2 commits into from
Feb 15, 2018

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Feb 15, 2018

This modifies the checkBlockHeaderSanity function to include an additional check which ensures the final state is zero prior to stake validation height.

It should be noted that this is technically a hard fork since before this change it was possible to use any value for the final state prior to stake validation height. However, no blocks on mainnet nor testnet ever used non-zero final states for blocks in that range and they are buried behind checkpoints in the minimum required version of the software due to the previous consensus votes, so it isn't possible to trigger a reorg that would fork old nodes off the network anyways, so it is safe to retroactively apply this check.

It also adds tests for the new consensus check which ensures the final state is zero prior to stake validation height to the fulllblocktests in order to ensure correctness.

@davecgh davecgh force-pushed the blockchain_validate_early_final_state branch 2 times, most recently from cd27aa9 to 71eeb97 Compare February 15, 2018 15:41
Copy link
Member

@dajohi dajohi left a comment

Choose a reason for hiding this comment

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

ok

This modifies the checkBlockHeaderSanity function to include an
additional check which ensures the final state is zero prior to stake
validation height.

It should be noted that this is technically a hard fork since before
this change it was possible to use any value for the final state prior
to stake validation height.  However, no blocks on mainnet nor testnet
ever used non-zero final states for blocks in that range and they are
buried behind checkpoints in the minimum required version of the
software due to the previous consensus votes, so it isn't possible to
trigger a reorg that would fork old nodes off the network anyways, so it
is safe to retroactively apply this check.
This adds tests for the new consensus check which ensures the final
state is zero prior to stake validation height.
@davecgh davecgh force-pushed the blockchain_validate_early_final_state branch from 71eeb97 to 305a88c Compare February 15, 2018 15:53
@davecgh
Copy link
Member Author

davecgh commented Feb 15, 2018

In additional to manually verify no blocks prior to stake validation height violate this rule, I performed and IBD of both mainnet and testnet as an extra test measure.

@davecgh davecgh merged commit 305a88c into decred:master Feb 15, 2018
@davecgh davecgh deleted the blockchain_validate_early_final_state branch February 15, 2018 17:09
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.

3 participants