Skip to content

chore(registry): [CON-1671] backfill cup_types of CatchUpPackageContents records + invariant ensuring their presence - #11578

Draft
pierugo-dfinity wants to merge 6 commits into
masterfrom
pierugo/backfill-cup-type
Draft

pierugo-dfinity wants to merge 6 commits into
masterfrom
pierugo/backfill-cup-type

Conversation

@pierugo-dfinity

@pierugo-dfinity pierugo-dfinity commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Each node in each subnet looks at their catch_up_package_contents_{subnet_id} record to find so-called "registry CUPs", used for

  • Genesis
  • Recovery
  • Subnet Splitting

The height, time and state_hash fields in those records are really only useful for Recovery CUPs. Both Genesis and Subnet Splitting set them to 0, 0 and vec![] respectively. This is why a cup_type field was introduced, containing the required information specific to each scenario.

This means that the three fields are redundant with the ones in RecoveryArgs, can be removed, and we can make the consumers (including the protocol stack) read cup_type instead. This PR adds an invariant that cup_type must always be set. It also adapts various locations to fill that cup_type if currently set to None.

Though in the production registry, all subnets whose genesis and last recovery (if any) predate the introduction of cup_type have that field unset and would break the invariant. Thus, this PR backfills all records' cup_type with a suitable variant: if all three fields are 0, 0 and vec![], this is a Genesis, otherwise it is a Recovery. At the time of writing, no SubnetSplitting was ever made.

This PR does not change the protocol stack yet, it still reads height, time and state_hash outside the cup_type.

@pierugo-dfinity
pierugo-dfinity added this pull request to stack #11579 September 15, 2026 15:08
@github-actions github-actions Bot added the chore label Sep 15, 2026
@pierugo-dfinity pierugo-dfinity changed the title chore(registry): [CON-1671] backfill cup_types of existing records + invariant ensuring their presence chore(registry): [CON-1671] backfill cup_types of CatchUpContents records + invariant ensuring their presence Sep 15, 2026
@pierugo-dfinity
pierugo-dfinity force-pushed the pierugo/backfill-cup-type branch from 7ae7b71 to 5397f21 Compare September 15, 2026 16:42
@pierugo-dfinity pierugo-dfinity changed the title chore(registry): [CON-1671] backfill cup_types of CatchUpContents records + invariant ensuring their presence chore(registry): [CON-1671] backfill cup_types of CatchUpPackageContents records + invariant ensuring their presence Sep 15, 2026
@pierugo-dfinity
pierugo-dfinity force-pushed the pierugo/backfill-cup-type branch from cd80a80 to 27714ad Compare September 16, 2026 11:33
@pierugo-dfinity
pierugo-dfinity removed this pull request from stack #11579 September 16, 2026 11:34
@pierugo-dfinity
pierugo-dfinity added this pull request to stack #11590 September 16, 2026 11:35
Base automatically changed from pierugo/remove-genesis-height to master September 23, 2026 15:09
@pierugo-dfinity
pierugo-dfinity force-pushed the pierugo/backfill-cup-type branch from 5908386 to 0d55517 Compare September 23, 2026 15:09

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant