Closed horsefacts closed 1 year ago
@varunsrin Updated with an explicit metadataType
arg and the naming conventions from FIP-7. This was a big rename refactor, so I'd appreciate a review to make sure I caught everything!
Coverage after merging horsefacts/app-id-validators into main will be
98.86% |
---|
File | Stmts | Branches | Funcs | Lines | Uncovered Lines |
---|---|---|---|---|---|
src | |||||
Bundler.sol | 100% | 100% | 100% | 100% | |
FnameResolver.sol | 100% | 100% | 100% | 100% | |
IdRegistry.sol | 100% | 100% | 100% | 100% | |
KeyRegistry.sol | 100% | 100% | 100% | 100% | |
StorageRegistry.sol | 100% | 100% | 100% | 100% | |
src/lib | |||||
Signatures.sol | 100% | 100% | 100% | 100% | |
TransferHelper.sol | 0% | 0% | 0% | 0% | 12, 17, 20, 20, 20 |
TrustedCaller.sol | 100% | 100% | 100% | 100% | |
src/validators | |||||
SignedKeyRequestValidator.sol | 100% | 100% | 100% | 100% |
Motivation
We'd like to validate signer key metadata on chain when a new signer key is registered. See FIP-7 and the comment here on the "Application Identifiers" FIP for more details.
Change Summary
Introduce "validator" contracts to the key registry. A validator must implement the
IMetadataValidator
interface. TheKeyRegistry
looks up the registered validator bykeyType
andmetadataType
and calls it to validate signer key metadata inside_add
, ensuring that only keys with valid metadata can be registered onchain.Merge Checklist
Choose all relevant options below by adding an
x
now or at any time before submitting for reviewAdditional context
Add a
KeyRegistry.integration.t.sol
test, which tests using an actualAppIdValidator
rather than a stubbed version.PR-Codex overview
Focus of the PR:
This PR focuses on adding a new interface
IMetadataValidator
and making changes related to gas usage in various test cases.Detailed summary:
IMetadataValidator
insrc/interfaces/IMetadataValidator.sol
.pragma solidity 0.8.21
insrc/interfaces/IMetadataValidator.sol
andsrc/interfaces/IdRegistryLike.sol
.validate
in theIMetadataValidator
interface.BundleRegistryGasUsageTest.sol
,IdRegistryGasUsageTest.sol
, andBundler.gas.t.sol
.ImmutableCreate2Deployer.sol
.SignedKeyRequestValidatorHarness
intest/Utils.sol
.SignedKeyRequestValidator
intest/Utils.sol
.SignedKeyRequestValidatorTestSuite.sol
andKeyRegistryTestSuite.sol
.SignedKeyRequestValidator
inscript/Deploy.s.sol
.Bundler
contract with changes related tokeyType
,metadataType
, andmetadata
in theSignerParams
andtrustedRegister
functions.