Coin Brief ENDE

Polkadot SDK now rejects duplicate pallet indices and stops losing statements it cannot route

Two changes merged into the Polkadot SDK in the past few days fix cases where code or data was silently discarded.

The first, pull request 13752, merged on 13 November, makes FRAME's macros reject duplicate attributes instead of letting a later declaration overwrite an earlier one. A second #[pallet::view_functions] block in a pallet now fails to compile at the duplicate attribute. Until now only the last block contributed functions to the metadata and to runtime view dispatch, so view functions in earlier blocks disappeared without an error. Repeated #[runtime::pallet_index] attributes on one pallet also fail now, even when the values are the same.

Teams affected have to merge their view functions into one block and keep exactly one pallet index. The pull request advises keeping the last index that was specified, because that is the one the existing call and event encoding already uses. No storage migration is needed. Because declarations that used to compile now fail, the release notes record major version bumps for frame-support-procedural and frame-support.

The second, pull request 13828, merged on 15 November, concerns the statement store on the v2 DHT path. When a node was not a replica for a statement's topics and had no connected peer closer to them, it dropped the statement and banned its hash, so it never reached subscribers. One node restart was enough to cause this. In two test runs on an eight-node network, 5 of 2,372 statements were lost that way. Now the node sends such a statement on a detour, to its farthest connected full peer that did not send it, or holds it until a routing target appears. A 900-second test in CI with 40 nodes delivered 14,050 of 14,050 statements. One loss window remains, if the detour peer disconnects before the send goes out. Nodes that run with the v2 DHT path on get the change without any action.

Polkadot SDK now rejects duplicate pallet indices and stops losing statements it cannot route
Polkadot SDK now rejects duplicate pallet indices and stops losing statements it cannot route — Coin Brief

Why it matters

Both bugs failed quietly: a runtime whose earlier view functions vanished from metadata, and a network that lost a small share of messages after a restart. Runtime developers will see the first fix as a compile error after upgrading, which is the point of it.

Primary source
polkadot-sdk pull requests
https://github.com/paritytech/polkadot-sdk/pull/13752
Written by Victoria Shinder.