Skip to content

dotns-gateway: add a maintainer account and bounded limits for dotNS maintenance - #253

Open
re-gius wants to merge 14 commits into
mainfrom
feat/195-gr-dotns-maintainer-account
Open

re-gius wants to merge 14 commits into
mainfrom
feat/195-gr-dotns-maintainer-account

Conversation

@re-gius

@re-gius re-gius commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #195

The dotNS contracts will accept a maintainer account that tunes their bounded operational values, such as the reservation duration or the claim window (paritytech/dotns#238). This PR gives the gateway pallet that account and lets a configurable MaintenanceOrigin act through it, limited to the contract functions that Root allows. Upgrades, revocations and other critical operations stay on Root.

MaintenanceOrigin also sets the gateway's limits, each within bounds that the runtime fixes. The limits replace the per-runtime constants on Paseo and the pallet-parameters keys on Asset Hub Polkadot.

On Asset Hub Polkadot, MaintenanceOrigin will accept Root or the dotns_maintenance track (polkadot-fellows/runtimes#1350), and MaintainerCallsManager will be Root. Both are set in polkadot-fellows/runtimes after this pallet is released. Paseo uses Root for both.

Changes

  • call_as_maintainer calls a contract as the pallet's keyless maintainer account, derived from PalletId. Only MaintenanceOrigin may call it, and only for a contract address and selector in AllowedMaintainerCalls.

  • allow_maintainer_call and disallow_maintainer_call add and remove entries in AllowedMaintainerCalls. Only MaintainerCallsManager may call them. The list starts empty.

  • Before its first call, the maintainer account gets a provider reference, so pallet-revive maps it to an EVM address without a balance.

  • set_limits sets the contract call weight, signature validity and future clock skew within MinLimits and MaxLimits. The limits are stored in Limits, which holds DefaultLimits until set, so no migration runs.

  • integrity_test checks that DefaultLimits is within the bounds and that a gateway call with the maximum contract call weight fits one normal extrinsic.

  • Paseo sets both origins to EnsureRoot, derives the account from py/dotns and uses these limits:

    Minimum Default Maximum
    Contract call weight 32 G ref time, 2 MiB proof 100 G, 2 MiB 128 G, 4 MiB
    Signature validity 60 s 1 day (was 3 days) 1 day
    Future clock skew 0 30 s 5 minutes
  • docs/operations.md lists the new extrinsics.

@re-gius
re-gius requested a review from a team November 18, 2026 10:38
@re-gius

re-gius commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

/cmd bench --pallet indiv_pallet_dotns_gateway

@re-gius
re-gius marked this pull request as draft November 18, 2026 10:44
@github-actions

Copy link
Copy Markdown
Contributor

Command "bench --pallet indiv_pallet_dotns_gateway" has started 🚀 See logs here

@github-actions

Copy link
Copy Markdown
Contributor

Command "bench --pallet indiv_pallet_dotns_gateway" has failed ❌! See logs here

@re-gius re-gius changed the title dotns-gateway: add a keyless maintainer account for the dotNS contracts dotns-gateway: a maintainer account and bounded limits for dotNS maintenance Nov 18, 2026
@re-gius

re-gius commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

/cmd bench --pallet indiv_pallet_dotns_gateway

@re-gius re-gius added D5-nice to have audit optional to have, meant to express "audit it if there is bandwidth" C2-runtime-config This PR implies new config items to a pallet labels Nov 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Command "bench --pallet indiv_pallet_dotns_gateway" has started 🚀 See logs here

@command-bot-individuality-commun

Copy link
Copy Markdown

Command "bench --pallet indiv_pallet_dotns_gateway" has finished ✅ See logs here

Runtime weight deviation:
Base:    upstream/main @ be0c2863169c  (merge-base)
Current: HEAD

1 file scanned · 0 extrinsics above 10% threshold
measured at documented component maxima - pass --max NAME=VALUE for charge-site maxima

@re-gius re-gius changed the title dotns-gateway: a maintainer account and bounded limits for dotNS maintenance dotns-gateway: add a maintainer account and bounded limits for dotNS maintenance Nov 18, 2026
@re-gius
re-gius marked this pull request as ready for review November 18, 2026 13:57
@re-gius

re-gius commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

/cmd bench --pallet indiv_pallet_dotns_gateway

@github-actions

Copy link
Copy Markdown
Contributor

Command "bench --pallet indiv_pallet_dotns_gateway" has started 🚀 See logs here

@command-bot-individuality-commun

Copy link
Copy Markdown

Command "bench --pallet indiv_pallet_dotns_gateway" has finished ✅ See logs here

Runtime weight deviation:
Base:    upstream/main @ 77d29ab41642  (merge-base)
Current: HEAD

1 file scanned · 0 extrinsics above 10% threshold
measured at documented component maxima - pass --max NAME=VALUE for charge-site maxima

re-gius added a commit to paritytech/dotns that referenced this pull request Nov 25, 2026
…tenance values (#371)

## Description

Maintenance values move from the bootstrap owner to Root and a
maintainer account. Root must set the account explicitly under the new
`maintainer` key of the protocol registry, and can remove it again;
until it is set, no account can act as maintainer.

The maintainer only tunes values, and never in a direction that disrupts
what is under way. Root can set any value within the existing bounds.

| Setter | Maintainer |
|---|---|
| Escrow `updateCooldown`, `updateRedeemWindow` | Either direction |
| Whitelist `setGrantDuration` | Either direction: a grant now keeps the
expiry it was given |
| Whitelist `setMaxClaimants`, `setMaxReasonBytes` | Either direction
with no window live; raise only while a window is open or scheduled |
| PoP controller `setReservationDuration`, whitelist `setMaxGrantBatch`
| Raise only |
| Whitelist `setWindow` | Never opens a window; only lengthens one Root
opened or scheduled, up to 90 days from its opening |

## Type

- [ ] Bug fix
- [x] Feature
- [x] Breaking change
- [x] Documentation
- [ ] Chore
- [ ] Refactor
- [x] Security

## Scope

- [x] Registration
- [ ] Resolver
- [ ] Store
- [x] Proof of Personhood
- [x] Deployment scripts
- [x] Tests

## Related Issues

#370, paritytech/individuality-community#253,
polkadot-fellows/runtimes#1350

## Fixes

Completes the smart contracts side of #238

## Checklist

### Code

- [x] Follows project style
- [x] `forge build` passes
- [x] `forge test` passes
- [x] No new compiler warnings

### Testing

- [x] New tests added for changed behavior
- [ ] Fuzz tests added where applicable
- [x] Invariant tests verified

### Security

- [x] No new `selfdestruct` or `delegatecall`
- [x] Access control reviewed
- [x] No storage layout conflicts (for upgradeable contracts)

### Documentation

- [x] NatSpec updated on changed interfaces
- [x] README updated if needed

### Breaking Changes

- [ ] No breaking changes
- [x] Breaking changes documented below

**Breaking changes:**

- The bootstrap owner can no longer call any maintenance setter.
- `DotnsConstants.registryKeys()` gains `maintainer`.
- A whitelist grant stores its expiry when it is made, so
`setGrantDuration` applies only to later grants. The grant record's
`grantedAt` field becomes `expiresAt`.

## How to test

```bash
forge clean && forge build
forge test --match-path 'test/{unit,intergration}/**'
forge test --match-path 'test/{invariant,fuzz}/whitelist/**'
```

## Notes

- Raising the reservation duration can still revive an expired queue
head that nobody has cleared. `DotnsPopController` has 7 bytes to spare,
so this is recorded in `KNOWN_ISSUES.md` §7.
- `release-metadata.mjs verify` reports the `maintainer` key without
failing, because it holds an account and not a contract.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C2-runtime-config This PR implies new config items to a pallet D5-nice to have audit optional to have, meant to express "audit it if there is bandwidth"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotns-gateway: a keyless pallet account that can own the dotNS contracts on behalf of the system

1 participant