-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[CHIA-786] simplify hard-fork consensus rules #18208
Conversation
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
227ee61
to
23d24eb
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
…updated consensus rules to apply unconditionally to block height
23d24eb
to
f5044f4
Compare
Pull Request Test Coverage Report for Build 9610120052Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
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.
Looks reasonable. Was this tested with a full sync from scratch? I'm assuming that's the link in test notes but that is not loading for me, so I thought to confirm.
yes, it has successfully synced from scratch |
Purpose:
Now that the hard fork has activated, some of the new rules can be applied unconditionally, even on older blocks.
Doing so simplifies the code and tests.
Specifically, these flags (affecting the behavior of
chia_rs
'srun_block_generator()
) are moved to be set unconditionally, where they were previously only set for block heights >=HARD_FORK_HEIGHT
.ENABLE_SOFTFORK_CONDITION
Enable 3 features:
* the
SOFTFORK
condition code, which mimics thesoftfork
operator. You specify its cost as the first argument. This allows soft-forking in new condition codes.* Unknown condition codes with cost. Certain condition codes are reserved to have a pre-defined cost, but are no-ops. This enables soft-forking in meaning to thes condition codes.
* Enables the new
AGG_SIG_*
conditions (e.g.AGG_SIG_PUZZLE
,AGG_SIG_AMOUNT
, etc.)ENABLE_BLS_OPS_OUTSIDE_GUARD
Enables the BLS operators directly in chialisp programs. Previously they were only enabled under the softfork guard
ENABLE_FIXED_DIV
Allows operator
/
to have negative operands.AGG_SIG_ARGS
Harmonizes the argument parsing of the
AGG_SIG_ME
andAGG_SIG_UNSAFE
conditions. Previously they required exactly 2 parameters and the terminator did not have to beNIL
. With this flag, they behave like all other conditions, additional parameters are ignored in consensus mode and disallowed in mempool mode.ALLOW_BACKREFS
Allows the block generator blob to be serialized using back-refs.
The main change of this PR is in
chia/full_node/mempool_check_conditions.py
. The other changes are to update tests that previously ensured these feature would not activate until the hard-fork height.Setting these flags unconditionally is safe based on the assumption that no block prior to the hard fork activation issued any of these conditions or had programs include any of these operators. It's theoretically possible for a block to issue conditions or execute operators unknown at the time, and consensus rules effectively ignore them.
The validity of this PR hinges on all blocks prior to the hard fork activation remain valid.
Current Behavior:
The consensus rules are slightly different for blocks whose height is <
HARD_FORK_HEIGHT
.New Behavior:
The consensus rules are uniform across all blocks (except for other soft-forks still in flight).
Testing Notes:
https://grafana.fmt.chiatechlab.com/d/oBgwkDI7z/blockchain-sync-tests?orgId=1&var-ref=hard-fork-has-activated&var-repo=All&from=now-7d&to=now&var-network=mainnet&var-network=testnet11&var-network=testneta&refresh=1h