feat: verify Root authority in the controller and remove the gateway dispatcher - #258
feat: verify Root authority in the controller and remove the gateway dispatcher#258re-gius wants to merge 9 commits into
Conversation
CI Summary
4naly3er AnalysisMedium (5)
Low (8)
Gas (14)
Informational (11)
Slither AnalysisHigh (3)
Medium (42)
Low (72)
Informational (57)
Contract Tests (Unit + Fuzz)BasicDotnsIntegrationReverts (test/intergration/BasicDotns.reverts.t.sol)
BasicDotnsIntegration (test/intergration/BasicDotns.t.sol)
DeployCreate3FactoryTest (test/unit/deploy/DeployCreate3Factory.t.sol)
DeterministicDeploymentTest (test/unit/deploy/DeterministicDeployment.t.sol)
DotnsContentResolverTests (test/unit/resolver/DotnsContentResolver.t.sol)
DotnsCostModelRegistryTests (test/unit/pop/DotnsCostModelRegistry.t.sol)
DotnsFlatPricingTests (test/unit/pop/DotnsFlatPricing.t.sol)
DotnsNameEscrowTest (test/unit/escrow/DotnsNameEscrow.t.sol)
DotnsNameEscrowFuzzTest (test/fuzz/escrow/DotnsNameEscrowFuzz.t.sol)
DotnsNameEscrowRedeemTest (test/unit/escrow/DotnsNameEscrowRedeem.t.sol)
DotnsNameEscrowRefundsTest (test/unit/escrow/DotnsNameEscrowRefunds.t.sol)
DotnsNameWhitelistTests (test/unit/whitelist/DotnsNameWhitelist.t.sol)
DotnsNameWhitelistFuzz (test/fuzz/whitelist/DotnsNameWhitelistFuzz.t.sol)
DotnsPopControllerTests (test/unit/registrar/DotnsPopController.t.sol)
DotnsPopControllerFuzz (test/fuzz/registrar/DotnsPopControllerFuzz.t.sol)
DotnsPopResolverTests (test/unit/resolver/DotnsPopResolver.t.sol)
DotnsProtocolRegistryTldTests (test/unit/registry/DotnsProtocolRegistry.t.sol)
DotnsProtocolRegistryFuzzTest (test/fuzz/registry/DotnsProtocolRegistryFuzz.t.sol)
DotnsRegistrarTests (test/unit/registrar/DotnsRegistrar.t.sol)
DotnsRegistrarControllerTest (test/unit/registrar/DotnsRegistrarController.t.sol)
DotnsRegistrarControllerFuzzTest (test/fuzz/registrar/DotnsRegistrarControllerFuzz.t.sol)
DotnsRegistrarControllerLifecycleTest (test/unit/registrar/DotnsRegistrarControllerLifecycle.t.sol)
DotnsRegistryTests (test/unit/registry/DotnsRegistry.t.sol)
DotnsRegistryFuzzTest (test/fuzz/registry/DotnsRegistryFuzz.t.sol)
DotnsResolverTests (test/unit/resolver/DotnsResolver.t.sol)
DotnsReverseResolverTests (test/unit/resolver/DotnsReverseResolver.t.sol)
DotnsScarcityPricingTests (test/unit/pop/DotnsScarcityPricing.t.sol)
LabelStoreTests (test/unit/store/LabelStore.t.sol)
LabelStoreFuzzTest (test/fuzz/store/LabelStoreFuzz.t.sol)
NoStatusDepositLifecycle (test/intergration/NoStatusDepositLifecycle.t.sol)
PopRulesFuzzTest (test/fuzz/pop/PopFuzz.t.sol)
PopLifecycleFlow (test/intergration/PopLifecycleFlow.t.sol)
PopRulesTests (test/unit/pop/PopRules.t.sol)
StoreFactoryTests (test/unit/store/StoreFactory.t.sol)
StoreIntegrationTest (test/intergration/StoreIntegration.t.sol)
StoreStressTest (test/stress/store/StoreStress.t.sol)
UserStoreTests (test/unit/store/UserStore.t.sol)
UserStoreFuzzTest (test/fuzz/store/UserStoreFuzz.t.sol)
WhitelistOperatorFlow (test/intergration/WhitelistOperatorFlow.t.sol)
Gas ReportDotnsProtocolRegistry
DotnsRegistrar
DotnsRegistrarController
DotnsRegistry
DotnsReverseResolver
PopRules
StoreFactory
Deploy ContractsDeployed addresses vs the committed manifestExpected is the committed manifest; actual is this CI deployment of the same pipeline.
Labelssmartcontracts, other, scope: registration, type: test, type: docs, scope: store, scope: pop |
|
Merging is blocked by paritytech/host-rust-core#564 and paritytech/preview-net-v1#177 |
GHkrishna
left a comment
There was a problem hiding this comment.
Looks good to me a few nits.
Apart from this, I was wondering if it would be good to add fork test, as it was also mentioned in the acceptance crieteria in the issue desc. A fork test covers the Root and non-Root paths on the target runtime.
This way we don't rely on the mocks only?
There was a problem hiding this comment.
I don't this function is required now?
There was a problem hiding this comment.
Nits: Should this be renamed??
There was a problem hiding this comment.
So are a few heloers below
There was a problem hiding this comment.
Fixed comments in 4ae3b37 but left the ones that are referring to the DotNS gateway pallet
|
Also do u think it makes sense to have a comment for root origin specific path, something like (as you mentioned in the comments): |
I added this small change in 45cc832 but it's not an enforced invariant so I would not add the As for the fork test, forge cannot produce a substrate Root origin so we cannot do it here. |
Description
The PoP controller now verifies substrate Root authority itself through pallet revive precompiles, and the gateway dispatcher is removed.
Adding the
_onlyRootguard, which readsSystemUtils.originIsRoot(). Note this usesoriginIsRoot, notcallerIsRootas #215 proposes:callerIsRootis caller-of-caller and returns false from inside a UUPS proxy's delegatecall frame, which is exactly why the dispatcher existed.originIsRoot(paritytech/polkadot-sdk#12281) is origin-scoped and a plain forwarding call preserves the origin.With the check moved into the controller, the dispatcher is no longer needed and therefore removed.
Type
Scope
Related Issues
Closes #215. Part of #214. Depends on #251.
Fixes
See #215 for more details.
Checklist
Code
forge buildpassesforge testpassesTesting
Security
selfdestructordelegatecallDocumentation
Breaking Changes
Breaking changes:
NotGateway(address caller)becomesNotRoot(). The caller parameter is dropped because a Root origin has no account to report. The gateway pallet'ssol!block already lists both errors, so it decodes the new one unchanged.(bytes)entrypoints are removed, along with_dispatchTypedand the four selector constants. The pallet encodes typed calls only (reserveLiteName((string,address,bytes))and siblings), and never calledreserveBaseNameOnlyat all.POP_GATEWAYis removed fromDotnsConstants, and rotating it was previously a way to revoke a compromised dispatcher.RootGatewayDispatcherleaves the manifest, so the address set drops to 18 contracts and the release genesis artifact drops from 33 accounts to 32. Chains already running keep the deployed dispatcher as an orphan; nothing points at it once the pallet is repointed.type(IDotnsPopController).interfaceIdchanges, because the four(bytes)functions leave the interface.DotnsPopController.supportsInterface(:530-537) answers against that id, so anything caching the old value getsfalseafter the upgrade. Recompute from the new ABI rather than hardcoding.How to test
Notes
New runtimes carry pallet-revive 0.19.1. as #251 has been completed, previewnet and Paseo already contain the new precompile. This will also belong to the next runtime for mainnet.
Two follow-ups live outside this repo. truapi's
discover_pop_controllerreadsDotnsGateway.DispatcherAddressand then callsTARGET()on it; that has to gain a fallback before anyone repoints the pallet at the controller proxy, or host username discovery breaks. And the pallet's storedDispatcherAddresshas to move to the controller viaset_dispatcher_address, no pallet code change needed.