Skip to content

Forbid changing staker's destination in ProduceBlockFromStake after a fork #1898

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

Merged
merged 2 commits into from
Apr 21, 2025

Conversation

ImplOfAnImpl
Copy link
Contributor

@ImplOfAnImpl ImplOfAnImpl commented Mar 27, 2025

Some notes:

  1. The changes in consensus are cosmetical (I reverted the code that needed them, but decided to keep the cleanup part).

  2. I removed the used trait Activate in common.

  3. I also moved ChainstateUpgradeBuilder to a separate crate common-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 the p2p-test-utils crate in "p2p/test-utils", which does NOT depend on p2p. And common-test-helpers DOES depend on common. 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 in p2p, which lives inside production code, but is intended to be used by tests. The module does use stuff from p2p, 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 moving ChainstateUpgradeBuilder to production code, so that in can be re-used in common/src/chain/config/builder.rs. I don't want to do it in this PR (to avoid merge conflicts in make_token_id should not generate id from account inputs #1908), but I think I'll do it in a subsequent PR. In that case the common-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 the common-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.

@azarovh azarovh force-pushed the feat/freeze_order branch from 3873c8b to c092766 Compare April 4, 2025 15:13
@ImplOfAnImpl ImplOfAnImpl force-pushed the forbid_staking_destination_change branch 2 times, most recently from 4edb286 to bcd3833 Compare April 7, 2025 09:23
@azarovh azarovh force-pushed the feat/freeze_order branch 2 times, most recently from 3ab75a5 to cc0087c Compare April 8, 2025 11:40
Base automatically changed from feat/freeze_order to master April 9, 2025 09:42
@ImplOfAnImpl ImplOfAnImpl force-pushed the forbid_staking_destination_change branch from bcd3833 to b62ee3a Compare April 9, 2025 14:18
@ImplOfAnImpl ImplOfAnImpl force-pushed the forbid_staking_destination_change branch from 363aa29 to b178e6a Compare April 16, 2025 14:23
@ImplOfAnImpl ImplOfAnImpl marked this pull request as draft April 18, 2025 06:06
…mmon-test-helpers` crate; introduce `ChainstateUpgradesBuilder` and use it in the `ChainConfig` builder
@ImplOfAnImpl ImplOfAnImpl marked this pull request as ready for review April 18, 2025 08:58
@ImplOfAnImpl ImplOfAnImpl merged commit dcce564 into master Apr 21, 2025
18 checks passed
@ImplOfAnImpl ImplOfAnImpl deleted the forbid_staking_destination_change branch April 21, 2025 16:10
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