Skip to content

Refactor/runtime config modules - #121

Merged
nol4lej merged 3 commits into
mainfrom
refactor/runtime-config-modules
Aug 7, 2026
Merged

Refactor/runtime config modules#121
nol4lej merged 3 commits into
mainfrom
refactor/runtime-config-modules

Conversation

@nol4lej

@nol4lej nol4lej commented Aug 7, 2026

Copy link
Copy Markdown
Member

What's in here

Three independent changes, one commit each, each compiling on its own.

1. Runtime configs split into modules (83d64c04)

template/runtime/src/lib.rs drops from 1444 to 1053 lines. The impl Config blocks move to template/runtime/src/configs/, grouped by concern:

Module Lines Contents
system.rs 108 frame_system, timestamp, balances, transaction payment, sudo
consensus.rs 124 aura, grandpa, session, validator-set, authorship
evm.rs 112 pallet_evm, ethereum, base fee, chain id, precompiles
privacy.rs 80 shielded-pool, zk-verifier, relayer

lib.rs keeps construct_runtime!, the version, the Executive types, and the inline pallet_manual_seal config (the macro requires it in the crate root).

Two details that aren't cosmetic: modules use crate::* rather than super::*, because Runtime is generated by construct_runtime! after the module declarations; and the re-export is explicit per module, since a plain glob over configs does not forward submodule items — that omission broke SS58Prefix in the node and BlockWeights under try-runtime.

No functional change: same pallets, same parameters, same weights.

2. Minimum shield amount removed (d3a89361)

Drops the MinShieldAmount constant (1 ORB in the runtime) and the AmountTooSmall error. shield accepts any non-zero amount.

The floor kept small deposits out of the pool without buying much: it does not bound storage, since one leaf costs the same at 1 planck as at 1 ORB, and the transaction fee already prices the write. What it did do is force a user holding a fractional balance to leave it unshielded.

Zero is still rejected, through the existing InvalidAmount — a zero-value note takes a leaf and a memo slot while carrying nothing. The EVM precompile keeps its own zero-value guard at the ABI boundary.

3. Validator registration bond removed (8ff67f4e)

Drops the ValidatorBond and Currency Config items, the ValidatorBondOf storage map, both bond events, InsufficientBond, and the release_bond helper. register_validator is now free.

What gates registration is unchanged and was always the part doing the work: session keys plus a registered EVM relayer, a pending queue bounded by MaxPendingValidators, and no account entering the active set without an explicit approve_validator from sudo. A bond deters spam that governance approval already blocks, and on a testnet where operators are onboarded by hand it only added a funding step.

Consensus is expected to change before mainnet; a staking-based scheme will bring its own economic gate.

Compatibility

No migration. ValidatorBondOf was queried on testnet before removal: 0 entries, empty pending queue, 3 validators all added via sudo. Nothing is left reserved. A chain with live bonds would need one.

Error indices shift. AmountTooSmall sat at index 6 in the shielded-pool Error enum, so every variant after it moves down one. Verified that app matches on the error name, not the index — unaffected. Anything decoding by index needs fresh metadata.

Precompile ABI unchanged. Same selectors, parameters and layout; only the set of calls the chain accepts widened.

Versions

pallet-validator-set 0.1.0 → 0.2.0 and pallet-evm-precompile-shielded-pool 0.3.0 → 0.4.0. Both breaking, but 0.x carries breakage in the minor.

spec_version stays at 7 — it was never deployed, so these collapse into that bump. transaction_version does not move; no call signature changed.

Verification

83d64c04 compiles alone ✅ 9m 06s
d3a89361 compiles alone ✅ 5m 39s
Unit tests ✅ 423 (308 shielded-pool, 65 precompile, 50 validator-set)
Runtime + try-runtime + runtime-benchmarks
Dev-node E2E ✅ 11/11

Each commit was verified in isolation by extracting its tree and building it separately. Not ceremony: an earlier version of this branch had all three commits broken, because the refactor commit carried a Config assignment belonging to an uncommitted change while the pallet did not declare it (error[E0437]). Caught and fixed with a rebase.

The new E2E (ts-tests/no-bond-no-min-shield.test.cjs) covers both removals: constants, storage, events and errors absent from metadata; a 1-planck shield reaching the pool balance; zero still refused; and an account holding 1 ORB — a thousandth of the old bond — reaching the prerequisite gate instead of failing on funds, reserving nothing.

Out of scope

app is left with dead code that does not break it (degrades to null, a case already handled) and should be cleaned separately: services/shielded-pool/limits.ts, its test, the validation in ShieldPanel.tsx:44, and the AmountTooSmall entry in chainErrors.ts:27.

@nol4lej
nol4lej merged commit ab3518f into main Aug 7, 2026
6 checks passed
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