-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
multi: implement testnet4 and add support for soft forks that are always active #2339
base: master
Are you sure you want to change the base?
Conversation
b2172bd
to
c5ea1cc
Compare
Pull Request Test Coverage Report for Build 13818768992Details
💛 - 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.
I think some tuning of the CONVENTIONS.md
file is in order for Aider to be useful in this repo. Otherwise it feels like the workload is shifted from the author to the reviewer...
@@ -175,6 +175,10 @@ func (c customDeploymentChecker) Condition(_ *blockNode) (bool, error) { | |||
return c.conditionTrue, nil | |||
} | |||
|
|||
func (c customDeploymentChecker) ForceActive(_ *blockNode) bool { |
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.
nit: Godoc comment missing.
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.
It's a mock version, none of the other existing methods have a godoc?
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.
Ah, yes. Missed that, sorry. Only looked at the diff and not the larger context of the file.
Add robust property-based tests for the assertNoTimeWarp function using the rapid testing library. The tests verify the following scenarios: - Basic property tests: - Only retarget blocks (block height divisible by blocksPerRetarget) are checked - Valid timestamps (within maxTimeWarp of previous block) pass validation - Invalid timestamps (too early) fail with appropriate ErrTimewarpAttack - Correct boundary behavior (exactly at maxTimeWarp limit) - Invariant tests: - Function never panics with valid inputs - Non-retarget blocks always return nil regardless of timestamps - Security tests: - All retarget blocks are protected from timewarp attacks - Non-retarget blocks are not affected by the timewarp check
…tion This commit introduces the concept of `AlwaysActiveHeight` to the deployment mechanism, allowing a deployment to be forced into the active state if the next block's height meets or exceeds this threshold. This is intended primarily to be used alongside the new Testnet4 deployment, as the past major soft forks are meant to be active from the very first block height.
Def, things like |
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.
LGTM 🎉
Was able to successfully sync a btcd
node from scratch and also a Neutrino node referencing the changes in this PR.
@@ -175,6 +175,10 @@ func (c customDeploymentChecker) Condition(_ *blockNode) (bool, error) { | |||
return c.conditionTrue, nil | |||
} | |||
|
|||
func (c customDeploymentChecker) ForceActive(_ *blockNode) bool { |
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.
Ah, yes. Missed that, sorry. Only looked at the diff and not the larger context of the file.
AlwaysActiveHeight: 1, | ||
}, | ||
DeploymentCSV: { | ||
BitNumber: 29, |
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.
You mentioned the other day that the bit numbers probably shouldn't be the same for CSV and Segwit. Not sure if that's relevant given the AlwaysActiveHeight
though.
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.
❤️
@@ -684,6 +689,12 @@ func compareScript(height int32, script []byte) error { | |||
func CheckBlockHeaderContext(header *wire.BlockHeader, prevNode HeaderCtx, | |||
flags BehaviorFlags, c ChainCtx, skipCheckpoint bool) error { | |||
|
|||
// The height of this block is one more than the referenced previous | |||
// block. | |||
blockHeight := prevNode.Height() + 1 |
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.
nit: kinda weird this code block is moved here since blockHeight
isn't used until line 729
Taken over from: #2318
Only the last commit is new.