Skip to content

chore(arion): drop legacy zero FamilyActiveChildren rows in a v4 migr… - #77

Open
faizsarwar wants to merge 2 commits into
mainfrom
chore/arion-drop-zero-family-rows-v4
Open

faizsarwar wants to merge 2 commits into
mainfrom
chore/arion-drop-zero-family-rows-v4

Conversation

@faizsarwar

Copy link
Copy Markdown
Collaborator

chore(arion): drop legacy zero FamilyActiveChildren rows in a v4 migration

Closes the remaining open item of #75 (nit 2). Parts 1 (atomic deregister_family,
ec44fab) and 3 (redundant try-runtime check, 7f20e13) already landed; this finishes it.

What & why

migrate_v2_to_v3 recomputed FamilyCount but left behind the legacy
Fa Idempotent; FamilyCountis unaffected since only> 0` families are counted.

  • post_upgrade now also asserts no zero row survived
    (check_no_zero_family_rows), alongside the existing check_family_count.
  • Tests: new migration_v4_drops_legacy_zero_family_rows (seeds 3 zero rows +
    2 active families, asserts the zero rows are dropped, active families and
    FamilyCount are untouched, and a re-run is a no-op); the existing v3 test is
    updated for the bumped version and the now-cleared zero row.

Testing

  • cargo check -p pallet-arion and --features try-runtime: clean.
  • cargo test -p hippius-mainnet-runtime --test arion_family_count_and_unbond:
    11/11 pass.

Release note

This bumps the arion storage version, so it runs a migration on the next runtime
upgrade. It must not ride along with the frozen 92021 srtool wasm from #74 —
it belongs in a later spec bump, which should also carry the corresponding
spec_version increment.

…ation (#75 nit)

migrate_v2_to_v3 recomputed FamilyCount but left behind the legacy
FamilyActiveChildren rows holding 0 (families that dropped out before the
drop-to-zero decrement existed; 142 of 619 on mainnet). They were already
treated as uncounted everywhere, so this is a pure cleanup that shrinks the
map and the per-upgrade recount scan.

- bump STORAGE_VERSION to 4 and add migrate_v3_to_v4 (collect-then-remove,
  idempotent, FamilyCount unaffected)
- post_upgrade now also asserts no zero row survived (check_no_zero_family_rows)
- test migration_v4_drops_legacy_zero_family_rows; v3 test updated for the
  bumped version and the now-cleared zero row
The v4 migration (drop legacy zero FamilyActiveChildren rows) advances the
arion pallet's on-chain StorageVersion to 4, but two tests still asserted 3
after on_runtime_upgrade and failed in CI:

- miner_payments.rs: migration_builds_uid_reverse_index_and_drops_duplicates
- uid_bootstrap_poc.rs: bulk_bind_runs_on_a_chain_already_at_storage_version_one

Both now assert 4. The v3 fixtures in arion_family_count_and_unbond.rs are
left as-is: they set the pre-migration version on purpose to exercise v3->v4.

Full runtime integration suite passes; the only failure is the pre-existing
runtime_integrity_tests staking slash/bond assertion, unchanged from main.
@faizsarwar

Copy link
Copy Markdown
Collaborator Author

bumped the storage-version assertions to v4 and ran the full runtime suite.

The v4 migration (drop legacy zero FamilyActiveChildren rows) advances arion's on-chain StorageVersion to 4, but two tests still asserted 3 after on_runtime_upgrade:

  • miner_payments.rs — migration_builds_uid_reverse_index_and_drops_duplicates (the one you flagged, :588)
  • uid_bootstrap_poc.rs — bulk_bind_runs_on_a_chain_already_at_storage_version_one (:552, same root cause — surfaced once I ran the whole suite)

Both now assert StorageVersion::new(4). Left the v3 .put::() fixtures in arion_family_count_and_unbond.rs as-is — those set the pre-migration version on purpose to exercise v3→v4 (that test already asserts it reaches 4).

Full runtime integration suite is green: miner_payments 39, uid_bootstrap_poc 10, arion_family_count_and_unbond 11, date_to_date_billing 37, hourly_storage_billing 31, referral_mechanics 42, usage_v2 33, and the rest. The only failure is the pre-existing runtime_integrity_tests staking slash-defer / bonding-duration assertion (pallets/staking/src/pallet/mod.rs:966), which fails identically on main and is unrelated to this PR.

@faizsarwar
faizsarwar requested a review from masterdubs November 2, 2026 18:14
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.

1 participant