Skip to content

Upgrade Moonbeam to Polkadot SDK stable2512#3633

Open
arturgontijo wants to merge 71 commits intomasterfrom
artur/moonbeam-polkadot-stable2512
Open

Upgrade Moonbeam to Polkadot SDK stable2512#3633
arturgontijo wants to merge 71 commits intomasterfrom
artur/moonbeam-polkadot-stable2512

Conversation

@arturgontijo
Copy link
Contributor

@arturgontijo arturgontijo commented Jan 16, 2026

Summary

Upgrades all Polkadot SDK dependencies from moonbeam-polkadot-stable2506 to moonbeam-polkadot-stable2512, along with the necessary adaptations across the node, runtime, precompiles, and tests.

Related PRs

Changes

Dependency Upgrades

  • All polkadot-sdk workspace dependencies updated from branch moonbeam-polkadot-stable2506moonbeam-polkadot-stable2512
  • Moonkit updated from moonbeam-polkadot-stable2506moonbeam-polkadot-stable2512
  • Frontier (EVM) updated from moonbeam-polkadot-stable2506moonbeam-polkadot-stable2512
  • Added pallet-author-slot-filter dependency to runtime/common
  • Added rocksdb feature to Frontier dependencies

Runtime API Changes

  • execute_block and check_inherents now use <Block as BlockT>::LazyBlock instead of Block
  • Removed GetCoreSelectorApi implementation (no longer required by the SDK)
  • XcmPaymentApi::query_delivery_fees now accepts an additional asset_id: VersionedAssetId parameter and uses AssetExchanger
  • Added new weigh_message() weight function to pallet_xcm weights (moonbase, moonbeam, moonriver)

Node Service Changes

  • Removed cumulus_primitives_core::GetCoreSelectorApi trait bound from runtime API requirements
  • Replaced Proposer wrapper with direct use of ProposerFactory
  • Added collator_peer_id: PeerId parameter to collator/consensus startup
  • Added ParachainTracingExecuteBlock support via new tracing_execute_block field in spawn_tasks
  • Renamed additional_relay_keysadditional_relay_state_keys in lookahead collator params

Parachain Inherent Data Refactor

  • ParachainInherentData split into BasicParachainInherentData + InboundMessagesData
  • set_validation_data call now takes separate data and inbound_messages_data parameters
  • Updated all runtime test helpers (moonbase, moonbeam, moonriver) accordingly

Precompile Updates

  • Removed SelectCore config from cumulus_pallet_parachain_system::Config in mock runtimes (crowdloan-rewards, relay-encoder)
  • Removed unnecessary dummy precompile code insertion in proxy precompile tests

Weight Updates

  • cumulus_pallet_xcmp_queue::take_first_concatenated_xcm now takes a n: u32 component parameter (all runtimes)

Test Fixes

  • Adjusted event indices in multiple Moonwall TypeScript tests to account for upstream event ordering changes (proxy, author-mapping, balance, sudo, randomness, XCM payment API, storage-growth tests)
  • Fixed XCM mock tests (statemint/statemine-like configurations)
  • Added using_fake_author() to initialize_pending_block()

Relevant Upstream PRs (polkadot-sdk)

PR Description
#9480 Lazy decode block extrinsics — introduces LazyBlock type used in execute_block and check_inherents
#8860 XCMP and DMP improvements — splits ParachainInherentData into BasicParachainInherentData + InboundMessagesData, adds offchain processing of inbound messages
#9002 Forward CoreInfo via a digest to the runtime — moves core selection to collator side, removes GetCoreSelectorApi / SelectCore
#8903 ParachainSystem: Do not emit the SelectCore digest — preparation for core selection rework
#9756 FRAME: Register on_initialize after each pallet — changes event ordering (explains shifted event indices in tests)
#10145 Send PeerId via UMP — adds collator_peer_id parameter to collator consensus
#9871 trace_block: Support overwriting execute_block — introduces ParachainTracingExecuteBlock
#9963 Query delivery fees v2 — reworks XCM delivery fee querying
#10243 pallet-xcm: API changes to use VersionedAssetId instead of u32 to specify asset for fees
#9539 take_first_concatenated_xcm() improvements — adds n parameter to weight function
#9869 Remove deprecated/unused consensus code — removes Proposer wrapper
#9732 Remove the deprecated CheckInherents logic
#9662 Remove deprecated collator-related code in cumulus
#9262 Adds support for additional relay state keys in parachain validation data inherent — renames additional_relay_keysadditional_relay_state_keys

Relevant Moonkit PRs

PR Description
#89 Update to polkadot-sdk stable2512
#92 [author-slot-filter] Add using_fake_author logic
#86 Add slot based collator

⚠️ Breaking Changes ⚠️

Runtime API

  • Core::execute_block signature changed (#9480): The execute_block runtime API now accepts <Block as BlockT>::LazyBlock instead of Block. Extrinsics are lazily decoded, deferring deserialization until needed. The same applies to check_inherents. Downstream tools that call these APIs directly must be updated.

  • GetCoreSelectorApi removed (#9002, #8903): The GetCoreSelectorApi runtime API and the SelectCore config type on cumulus_pallet_parachain_system::Config have been fully removed. Core selection is now handled on the collator side and forwarded to the runtime via a digest. Any runtime implementing this API or configuring SelectCore must remove it.

  • XcmPaymentApi bumped to v2 (#9963, #10243): query_delivery_fees now requires an additional asset_id: VersionedAssetId parameter, allowing fee estimation in non-native assets. The v1 signature is retained as #[changed_in(2)]. Clients querying delivery fees must pass the new parameter.

Node / Collator

  • Proposer wrapper removed (#9869): cumulus_client_consensus_proposer::Proposer has been removed. Use sc_basic_authorship::ProposerFactory directly.

  • collator_peer_id now required (#10145): Collator startup functions (start_consensus, lookahead params) now require a PeerId parameter. The peer ID is sent via UMP for protocol-level identification.

  • tracing_execute_block field added to SpawnTasksParams (#9871): sc_service::SpawnTasksParams now includes a tracing_execute_block field. Parachains should pass Some(Arc::new(ParachainTracingExecuteBlock::new(client))) to support trace_block RPC.

  • additional_relay_keys renamed (#9262): The lookahead collator parameter additional_relay_keys has been renamed to additional_relay_state_keys.

Parachain Inherent Data

  • ParachainInherentData split (#8860): The monolithic ParachainInherentData struct has been split into BasicParachainInherentData (validation data, relay chain state, collator peer ID, relay parent descendants) and InboundMessagesData (downward + horizontal messages). The set_validation_data inherent call now takes both as separate parameters. This enables offchain pre-processing of inbound messages before passing them to the runtime.

  • CheckInherents logic removed (#9732): The CheckInherents parameter in register_validate_block has been removed. Inherent validation is now handled via ConsensusHook and pallet logic. Runtimes no longer need to implement CheckInherents.

Event Ordering

  • Event indices shifted by +1 (#9756): FRAME now registers on_initialize weight after each pallet's execution rather than batching them. This emits an additional weight-related event early in the block, shifting all subsequent event indices by one. Any off-chain code or tests that reference events by index must be updated.

Weights

  • take_first_concatenated_xcm signature changed (#9539): The weight function now takes a n: u32 component parameter instead of being a zero-argument function. Weight implementations must be updated to match the new trait signature.

  • pallet_xcm::WeightInfo::weigh_message added: A new required method on the pallet_xcm::WeightInfo trait. Custom weight implementations must add this function.

@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Workspace-wide migration to Polkadot/Substrate stable2512, API and weight signature updates (LazyBlock, parametric XCM weights), removal of explicit SelectCore/GetCoreSelectorApi usages, node service changes to pass collator_peer_id and wire tracing, JS/frontend patch, test expectation updates, and small CI/package tweaks.

Changes

Cohort / File(s) Summary
Workspace & Build
Cargo.toml, Makefile, .github/workflows/build.yml, package.json, test/package.json
Bumped many workspace deps/branches 2506→2512, updated POLKADOT/BRIDGE pins in Makefile, added libclang-dev to CI, added pnpm patchedDependencies, and bumped test chopsticks.
Runtime API & Traits
runtime/common/src/apis.rs
Core/BlockBuilder/TryRuntime execute_block and check_inherents now accept <Block as BlockT>::LazyBlock; removed GetCoreSelectorApi impl; query_delivery_fees now takes an asset_id and delegates via AssetExchanger.
SelectCore Removal
runtime/*/src/lib.rs, precompiles/*/src/mock.rs
Removed explicit type SelectCore = DefaultCoreSelector<Runtime> across multiple runtimes and mocks (rely on default selector).
XCM Weight Changes
runtime/*/src/weights/cumulus_pallet_xcmp_queue.rs, runtime/*/src/weights/pallet_xcm.rs
take_first_concatenated_xcm now accepts n: u32 and returns base + per-n linear weight; added weigh_message() -> Weight.
Node Service & Tracing
node/service/src/lib.rs, node/service/src/lazy_loading/mod.rs, node/cli/src/command.rs
Added collator_peer_id: PeerId into consensus/start flows and params, simplified RuntimeApi trait bounds, wired ParachainTracingExecuteBlock into spawned tasks, updated parachain account derivation to polkadot_primitives::v9::AccountId.
RPC Adjustment
node/service/src/rpc.rs
Removed graph.clone() argument from Eth::new in create_full (Eth RPC construction no longer takes graph).
Frontend/JS Patch
patches/@acala-network__chopsticks-core.patch, dist/.../blockchain/*
Added private extrinsicMeta field/getter on Block and switched parachain validation-data to use parent.extrinsicMeta.
Tests: Event & Gas Expectations
test/suites/dev/**, test/.../test-*
Adjusted many test event index expectations (mostly +1 shifts) and updated several gas/inline-snapshot values to match runtime changes.
Parachain Inherent Restructure
runtime/*/tests/common/mod.rs
Replaced ParachainInherentData with BasicParachainInherentData + InboundMessagesData; updated set_validation_data calls.
Assets / Benchmarks
runtime/*/tests/xcm_mock/*
Added pub type ReserveId = u128, extended BenchmarkHelper generics to include ReserveIdParameter, and added ReserveData = ReserveId to pallet_assets::Config.
Primitives & Precompiles
primitives/account/src/lib.rs, precompiles/proxy/src/tests.rs, precompiles/*/src/mock.rs
Extended EthereumSignature::From<MultiSignature> to handle Eth variant; removed dummy precompile code setup in one proxy test; removed explicit SelectCore in several mocks.
Misc & Infra
.gitignore, scripts/verify-licenses.sh, zombienet/configs/*, docs/cherry-picks/*
Ignored .pi/, added "BSD-3-Clause OR GPL-2.0" to license checks, replaced chain_spec_path with named chain in zombienet configs, and added cherry-picks docs.
Other Runtime Tooling
runtime/common/Cargo.toml
Added pallet-author-slot-filter to workspace deps, features, try-runtime and cargo-udeps ignore.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Node as Node
participant Consensus as Consensus
participant Relay as RelayChainTasks
participant Tracing as ParachainTracingExecuteBlock
participant RPC as RPC

Node->>Consensus: start_consensus(collator_peer_id)
Consensus->>Relay: spawn relay tasks (with collator_peer_id)
Relay->>Tracing: ParachainTracingExecuteBlock::new(client.clone())
Relay->>RPC: include tracing instance in RPC task spawn
RPC->>Tracing: use tracing to execute block tracing

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

D9-needsaudit👮, agent-review, weights-updates

Suggested reviewers

  • arturgontijo
  • librelois
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Upgrade Moonbeam to Polkadot SDK stable2512' directly and clearly describes the primary change—a dependency upgrade from stable2506 to stable2512 across all Polkadot SDK dependencies.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The pull request description comprehensively describes the changeset, covering dependency upgrades, runtime API changes, node service changes, parachain inherent data refactor, precompile updates, weight updates, and test fixes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch artur/moonbeam-polkadot-stable2512

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2026

Moonbase Weight Difference Report

File Extrinsic Old New Change Percent
runtime/moonbase/src/weights/cumulus_pallet_xcmp_queue.rs take_first_concatenated_xcm 5.44us 4.02us -26.08%

Moonriver Weight Difference Report

File Extrinsic Old New Change Percent
runtime/moonriver/src/weights/cumulus_pallet_xcmp_queue.rs take_first_concatenated_xcm 5.76us 4.02us -30.18%

Moonbeam Weight Difference Report

File Extrinsic Old New Change Percent
runtime/moonbeam/src/weights/cumulus_pallet_xcmp_queue.rs take_first_concatenated_xcm 5.76us 4.02us -30.18%

@RomarQ RomarQ added dependencies Pull requests that update a dependency file B5-clientnoteworthy Changes should be mentioned in any downstream projects' release notes B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes labels Jan 16, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2026

WASM runtime size check:

Compared to target branch

Moonbase runtime: 2056 KB (-44 KB) ✅

Moonbeam runtime: 2188 KB (-24 KB) ✅

Moonriver runtime: 2188 KB (-24 KB) ✅

Compared to latest release (runtime-4202)

Moonbase runtime: 2056 KB (+120 KB compared to latest release) ⚠️

Moonbeam runtime: 2188 KB (+156 KB compared to latest release) ⚠️

Moonriver runtime: 2188 KB (+156 KB compared to latest release) ⚠️

@arturgontijo arturgontijo force-pushed the artur/moonbeam-polkadot-stable2512 branch from a13b535 to ebc8ddd Compare January 16, 2026 22:13
# Conflicts:
#	Cargo.lock
#	test/suites/dev/moonbase/test-pov/test-precompile-over-pov2.ts
# Conflicts:
#	runtime/moonbase/src/weights/cumulus_pallet_xcmp_queue.rs
#	runtime/moonbeam/src/weights/cumulus_pallet_xcmp_queue.rs
#	runtime/moonriver/src/weights/cumulus_pallet_xcmp_queue.rs
#	test/suites/dev/moonbase/test-randomness/test-randomness-babe-lottery2.ts
@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

Coverage Report

@@                          Coverage Diff                           @@
##           master   artur/moonbeam-polkadot-stable2512      +/-   ##
======================================================================
- Coverage   77.14%                               77.12%   -0.02%     
  Files         389                                  389              
+ Lines       77176                                77207      +31     
======================================================================
+ Hits        59537                                59544       +7     
+ Misses      17639                                17663      +24     
Files Changed Coverage
/node/service/src/lib.rs 56.71% (-0.02%) 🔽
/node/service/src/rpc.rs 82.31% (-0.06%) 🔽
/precompiles/proxy/src/tests.rs 96.87% (-0.01%) 🔽
/primitives/account/src/lib.rs 62.93% (-0.55%) 🔽
/runtime/common/src/apis.rs 52.57% (-0.30%) 🔽
/runtime/moonbase/src/weights/cumulus_pallet_xcmp_queue.rs 67.21% (-2.28%) 🔽
/runtime/moonbase/src/weights/pallet_xcm.rs 4.90% (-0.20%) 🔽
/runtime/moonbase/tests/common/mod.rs 94.46% (+0.05%) 🔼
/runtime/moonbeam/src/weights/cumulus_pallet_xcmp_queue.rs 67.21% (-2.28%) 🔽
/runtime/moonbeam/tests/common/mod.rs 92.58% (+0.07%) 🔼
/runtime/moonriver/src/weights/cumulus_pallet_xcmp_queue.rs 67.21% (-2.28%) 🔽
/runtime/moonriver/tests/common/mod.rs 93.87% (+0.06%) 🔼

Coverage generated Tue Mar 24 14:23:44 UTC 2026

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	test/suites/dev/moonbase/test-author/test-author-failed-association.ts
#	test/suites/dev/moonbase/test-author/test-author-non-author-clearing.ts
#	test/suites/dev/moonbase/test-author/test-author-registered-clear.ts
#	test/suites/dev/moonbase/test-author/test-author-simple-association.ts
#	test/suites/dev/moonbase/test-author/test-author-unregistered-clear.ts
#	test/suites/dev/moonbase/test-randomness/test-randomness-babe-lottery3.ts
#	test/suites/dev/moonbase/test-randomness/test-randomness-vrf-lottery4.ts
#	test/suites/dev/moonbase/test-xcm-v4/test-xcm-payment-api.ts
#	test/suites/dev/moonbase/test-xcm-v5/test-xcm-payment-api.ts
@manuelmauro manuelmauro self-assigned this Mar 9, 2026
@manuelmauro manuelmauro force-pushed the artur/moonbeam-polkadot-stable2512 branch from 1f54a45 to 16b16d7 Compare March 17, 2026 12:54
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 17, 2026
Change expect(result!.events.length === 7).to.be.true to
expect(result!.events.length).to.equal(7) for consistent assertion
pattern and better error messages on failure.
manuelmauro
manuelmauro previously approved these changes Mar 18, 2026
Copy link
Contributor

@manuelmauro manuelmauro left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@librelois librelois left a comment

Choose a reason for hiding this comment

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

1. Make query_delivery_fees return zero instead of failing

Update the runtime API implementation in runtime/common/src/apis.rs so Moonbeam returns a successful zero-fee result when no delivery fees are configured, instead of propagating an error from the generic AssetExchanger path.

Update the corresponding tests in:

  • test/suites/dev/moonbase/test-xcm-v4/test-xcm-payment-api.ts
  • test/suites/dev/moonbase/test-xcm-v5/test-xcm-payment-api.ts

They should assert a successful response representing zero delivery fees, not Err.

Moonbeam’s intended behavior is “delivery fees are zero,” not “the API cannot answer.” Returning Err changes the meaning of the API:

  • Err implies unsupported or misconfigured behavior
  • a successful zero result correctly expresses policy
  • clients can treat Moonbeam like a normal chain without special-casing an error path

2. Revisit zombienet bridge relay-chain config substitution

Review the switch in:

  • zombienet/configs/moonbeam-polkadot.toml
  • zombienet/configs/moonriver-kusama.toml

If these scenarios are meant to validate Polkadot/Kusama-specific bridge behavior, restore generated polkadot-local / kusama-local specs. Otherwise, rename or clearly scope the scenarios/documentation to reflect that they now run against rococo-local.

Moonbeam does not charge delivery fees. Previously, query_delivery_fees
propagated an error from the generic AssetExchanger path, which implies
unsupported or misconfigured behavior. Now it returns a successful
zero-fee result so clients can treat Moonbeam like any other chain
without special-casing an error path.

Update the corresponding TypeScript tests to assert a successful
response with an empty fee list.
@manuelmauro manuelmauro force-pushed the artur/moonbeam-polkadot-stable2512 branch 5 times, most recently from 044c83e to 55ab7f8 Compare March 19, 2026 14:59
@manuelmauro
Copy link
Contributor

1. Make query_delivery_fees return zero instead of failing

Update the runtime API implementation in runtime/common/src/apis.rs so Moonbeam returns a successful zero-fee result when no delivery fees are configured, instead of propagating an error from the generic AssetExchanger path.

Update the corresponding tests in:

* `test/suites/dev/moonbase/test-xcm-v4/test-xcm-payment-api.ts`

* `test/suites/dev/moonbase/test-xcm-v5/test-xcm-payment-api.ts`

They should assert a successful response representing zero delivery fees, not Err.

Moonbeam’s intended behavior is “delivery fees are zero,” not “the API cannot answer.” Returning Err changes the meaning of the API:

* `Err` implies unsupported or misconfigured behavior

* a successful zero result correctly expresses policy

* clients can treat Moonbeam like a normal chain without special-casing an error path

Addressed in 55ab7f8

manuelmauro and others added 15 commits March 20, 2026 11:11
Replace dangerous rococo-local fallback with proper chain specs
generated from polkadot-fellows/runtimes at 422623dbf (SDK 2512-2).

Restore chain_spec_path in zombienet bridge configs to match master.
Update BRIDGE_RELAY_VERSION to match the new substrate-relay built from
parity-bridges-common branch moonbeam-polkadot-stable2512.

Requires publishing a release at:
  moonbeam-foundation/parity-bridges-common @ moonbeam-polkadot-stable2512
Upgrade upload-artifact from v7 to v8 to match download-artifact v8
used within the same workflow run.

Keep cross-run downloads (Twiggy target branch artifacts) at v7 to
remain compatible with artifacts uploaded by the target branch's
existing builds.
- @polkadot/api, api-base, api-derive, rpc-provider, types, types-codec: 16.4.8 -> 16.5.4
- @polkadot/keyring, util, util-crypto: 13.5.6 -> 14.0.2
- @polkadot/apps-config: 0.165.1 -> 0.170.1
until reference-machine benchmarks are rerun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B5-clientnoteworthy Changes should be mentioned in any downstream projects' release notes B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants