Forbid changing staker's destination in ProduceBlockFromStake after a fork #1898
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some notes:
The changes in
consensus
are cosmetical (I reverted the code that needed them, but decided to keep the cleanup part).I removed the used trait
Activate
incommon
.I also movedChainstateUpgradeBuilder
to a separate cratecommon-test-helpers
in "common/test-helpers" to be able to re-use it in other places.Why it's called "helpers":1) We already have thep2p-test-utils
crate in "p2p/test-utils", which does NOT depend onp2p
. Andcommon-test-helpers
DOES depend oncommon
. So I felt like they need to use different naming schemes, so that one kind of crate is distinguishable from the other one and so that it's possible to have both kinds in the same "parent" crate.2) We also have the "test_helpers" module inp2p
, which lives inside production code, but is intended to be used by tests. The module does use stuff fromp2p
, obviously, so I decided to re-use the word "helpers" for the new crate too.I suggest using this naming approach for the future crates too:1) "xxx-test-helpers" - can use "xxx" (and therefore cannot be used in xxx's unit tests).2) "xxx-test-utils" - cannot use "xxx" (and therefore can be used in xxx's unit tests).And a test-only module inside production code should be named just "test-helpers"Edit: I'm now actually thinking about movingChainstateUpgradeBuilder
to production code, so that in can be re-used incommon/src/chain/config/builder.rs
. I don't want to do it in this PR (to avoid merge conflicts inmake_token_id
should not generate id from account inputs #1908), but I think I'll do it in a subsequent PR. In that case thecommon-test-helpers
crate will become empty and will be removed.The general suggestion about the naming scheme still stands.
But I moved
ChainstateUpgradeBuilder
to the production code and removed thecommon-test-helpers
crate for now.I also introduced ChainstateUpgradesBuilder that uses ChainstateUpgradeBuilder to build the upgrades incrementally. IMO now it's a bit easier to see what exactly was changes at each particular height.