Refactor/runtime config modules - #121
Merged
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.rsdrops from 1444 to 1053 lines. Theimpl Configblocks move totemplate/runtime/src/configs/, grouped by concern:system.rsconsensus.rsevm.rsprivacy.rslib.rskeepsconstruct_runtime!, the version, theExecutivetypes, and the inlinepallet_manual_sealconfig (the macro requires it in the crate root).Two details that aren't cosmetic: modules use
crate::*rather thansuper::*, becauseRuntimeis generated byconstruct_runtime!after the module declarations; and the re-export is explicit per module, since a plain glob overconfigsdoes not forward submodule items — that omission brokeSS58Prefixin the node andBlockWeightsundertry-runtime.No functional change: same pallets, same parameters, same weights.
2. Minimum shield amount removed (
d3a89361)Drops the
MinShieldAmountconstant (1 ORB in the runtime) and theAmountTooSmallerror.shieldaccepts 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
ValidatorBondandCurrencyConfig items, theValidatorBondOfstorage map, both bond events,InsufficientBond, and therelease_bondhelper.register_validatoris 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 explicitapprove_validatorfrom 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.
ValidatorBondOfwas 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.
AmountTooSmallsat at index 6 in the shielded-poolErrorenum, so every variant after it moves down one. Verified thatappmatches 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-set0.1.0 → 0.2.0 andpallet-evm-precompile-shielded-pool0.3.0 → 0.4.0. Both breaking, but0.xcarries breakage in the minor.spec_versionstays at 7 — it was never deployed, so these collapse into that bump.transaction_versiondoes not move; no call signature changed.Verification
83d64c04compiles aloned3a89361compiles alonetry-runtime+runtime-benchmarksEach 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
appis left with dead code that does not break it (degrades tonull, a case already handled) and should be cleaned separately:services/shielded-pool/limits.ts, its test, the validation inShieldPanel.tsx:44, and theAmountTooSmallentry inchainErrors.ts:27.