-
Notifications
You must be signed in to change notification settings - Fork 39
feat(ledger): ledger 8->9 hardfork on-chain migration #1925
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
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
9fce148
feat(ledger): add v8->v9 storage migration for the ledger 8->9 hardfork
ozgb 17e541f
test(ledger): add v8->v9 state translation table + smoke tests
ozgb 8597b9a
fix(node): version-aware ledger genesis seeding for the 8->9 hardfork
ozgb 58fe004
refactor(ledger): use serialize peek_tag for genesis version detection
ozgb 7cbaaf7
fix(ledger): restore ledger-8 construct_distribute_treasury host fn
ozgb b00dc97
fix(toolkit): runtime-upgrade robust to the ledger 8->9 metadata switch
ozgb ce08d45
feat(toolkit): real v8->v9 fork translation at the tx-generation boun…
ozgb 0ee9e29
chore(toolkit): TEMP hardfork_debug log for replay_blocks partition
ozgb 43808b2
fix(toolkit): runtime-upgrade waits for the new runtime to EXECUTE, n…
ozgb af7ed4f
chore(toolkit): remove TEMP hardfork_debug replay_blocks log
ozgb 4265e2b
docs: add change files for the ledger 8->9 hardfork migration
ozgb e30976c
chore: cargo fmt
ozgb 2c76e05
Merge branch 'main' into ozgb-ledger-hf
ozgb 08671ba
chore: fix clippy errors
ozgb e8c1427
chore: npm audit fix (toolkit-js)
ozgb 0f8f03d
Merge branch 'main' into ozgb-ledger-hf
ozgb 679a1a5
feat: add perf prints to track migration time elapsed
ozgb fbbfe1c
feat: use ledger cost model for storage migration
ozgb 7c16094
chore(local-environment): npm audit fix
ozgb 2027d5e
fix: no-op ledger v8->v9 migration when state is already ledger-9
ozgb 1b82adb
docs: update change file
ozgb b6d8bfd
Merge branch 'main' into ozgb-ledger-hf
gilescope File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
changes/runtime/changed/ledger-8-to-9-hardfork-migration.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #node #runtime #ledger | ||
|
|
||
| # On-chain ledger 8->9 hardfork state migration | ||
|
|
||
| Lets a ledger-8 chain (e.g. `1.0.1`) runtime-upgrade in place to the current | ||
| ledger-9 runtime. A new host fn, `migrate_state_v8_to_v9`, runs the | ||
| `StateTranslationTable` (ported from `midnight-ledger` PR #539) to translate | ||
| the on-chain `LedgerState` from v13 to v18. It's wired in as | ||
| `pallet_midnight::migrations::v2::MigrateV1ToV2`, a `VersionedMigration<1,2,..>` | ||
| that fires once when a ledger-8 chain (pallet-midnight storage version 1) | ||
| upgrades to this runtime (storage version 2); a fresh ledger-9 genesis starts | ||
| at version 2 and skips it. The migration's weight is derived from the ledger | ||
| cost model rather than a hand-tuned estimate. | ||
|
|
||
| Also includes two fixes needed to support both ledger-8 and ledger-9 chains: | ||
| version-aware genesis seeding (detected via `serialize::peek_tag` instead of | ||
| hardcoding the v9 deserializer), and restoring the ledger-8 | ||
| `construct_distribute_treasury_system_tx` host fn, which the `1.0.1` WASM | ||
| still imports. | ||
|
|
||
| PR: https://github.com/midnightntwrk/midnight-node/pull/1925 | ||
| Issue: https://github.com/midnightntwrk/midnight-node/issues/1580 | ||
18 changes: 18 additions & 0 deletions
18
changes/toolkit/changed/hardfork-fork-aware-tx-generation.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #toolkit #ledger9 | ||
|
|
||
| # Fork-aware transaction generation across the ledger 8->9 hardfork | ||
|
|
||
| `replay_blocks` now detects the v8->v9 fork boundary and runs the same | ||
| `StateTranslationTable` translation used by the on-chain migration | ||
| (`fork_context_8_to_9` / `fork_8_to_9_if_needed`), so transactions generated | ||
| after the fork are built against the correctly-translated ledger-9 context | ||
| instead of a stale ledger-8 one. | ||
|
|
||
| The `runtime-upgrade` command now waits for the new runtime to actually | ||
| *execute* at a finalized block, not just be applied/stored. The stored spec | ||
| version flips at the apply block, but that block still executes under the | ||
| old runtime, so polling only the stored spec left transaction generation | ||
| reading a block short of any ledger-9-classified block. | ||
|
|
||
| PR: https://github.com/midnightntwrk/midnight-node/pull/1925 | ||
| Issue: https://github.com/midnightntwrk/midnight-node/issues/1580 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.