Skip to content

Bump P2P protocol version and guard Toccata IBD#997

Open
michaelsutton wants to merge 3 commits into
kaspanet:toccatafrom
michaelsutton:p2p-toccata-version
Open

Bump P2P protocol version and guard Toccata IBD#997
michaelsutton wants to merge 3 commits into
kaspanet:toccatafrom
michaelsutton:p2p-toccata-version

Conversation

@michaelsutton
Copy link
Copy Markdown
Contributor

Bumps the P2P protocol version for Toccata while preserving TN12 launch compatibility by normalizing its protocol 9 peers locally.

Adds pre-activation version filtering for synced nodes and an IBD pruning point freshness guard so fresh nodes avoid syncing from outdated or stale pre-Toccata peers.

Advertise protocol 10 for Toccata while normalizing TN12 peers that still advertise protocol 9 into the same Toccata flow set (now named 10).
Start rejecting outdated peer protocol versions one day before toccata activation
Reject stale pre-activation pruning points after Toccata should have produced a newer pruning point, and reject post-activation pruning points from peers not using the Toccata protocol version.
Copy link
Copy Markdown
Collaborator

@coderofstuff coderofstuff left a comment

Choose a reason for hiding this comment

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

minor comments

// No activation is configured:
// PP(pre-activation by score) ---- estimated activation ---- pruning period + margin ---- now
assert!(
validate_pruning_point_freshness_for_toccata(&MAINNET_PARAMS, V, pp_hash, pp_timestamp, pp_daa_score, stale_after + 1)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This shouldn't use MAINNET_PARAMS, because MAINNET_PARAMS will eventually have the param activated.

Instead, just create a dedicated params set with toccata_activation set to never


#[test]
fn test_toccata_pruning_point_staleness_guard() {
const V: u32 = PROTOCOL_VERSION;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please rename V to a clearer name like TOCCATA_INCLUSIVE_VERSION, or add a comment explaining that this explicitly should be the protocol version including toccata.

PROTOCOL_VERSION may change in the future. If it does, how is this test affected?

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.

2 participants