feat(types): extend IRSCapability with factory lookup, key probe, and management grant - #202
Merged
Merged
Conversation
… management grant Co-authored-by: Cursor <cursoragent@cursor.com>
✅ Deploy Preview for openzeppelin-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Closes a type-surface gap on
IRSCapabilitythat was forcing double structural casts across the IRS capability boundary:openzeppelin-adapters—createIRSreturnsguardRuntimeCapability(...) as unknown as EvmIRSCapabilitybecause the concreteEvmIRSServiceimplements methods the shared interface did not declare.reference-implementationsRI plugin —capabilities.tscasts back to recovergetFactoryIdentity,grantHolderManagementKey, andhasIdentityKeyPurposethat consumers call but the type never exposed.That double cast defeats the compiler at a capability boundary: a consumer calling a method the type does not declare only finds out at runtime. We hit exactly that this week.
This PR adds three required members to
IRSCapability, with discriminated read results that preserve the convention thatread_failedmust stay distinguishable from a negative answer. Collapsing an RPC error intoundefined/false/not_foundis the precise defect that orphaned three Sepolia identities — the saga treated a transport failure as "no identity" and re-attempted steps that had already landed on-chain.Added to
IRSCapabilitygetFactoryIdentity(holder){ status: 'found', onchainId }|{ status: 'not_found' }|{ status: 'read_failed', cause }hasIdentityKeyPurpose({ onchainId, address, purpose }){ status: 'has' }|{ status: 'lacks' }|{ status: 'read_failed', cause }grantHolderManagementKey({ onchainId, holder }, ...)OperationResult(same write signature convention as other IRS writes)Semver: minor
New required interface members are technically breaking for implementors (any external
IRSCapabilityimplementor must add all three members or fail to compile). Consumers calling the capability are unaffected.Practical blast radius is limited: no in-repo implementor exists beyond the conformance test stub (updated here), and no in-adapters implementor is missing these — only
adapter-evmimplements IRS (adapter-solana,adapter-stellar,adapter-midnighthave noirscapability at all), and it already shipsgetFactoryIdentity+grantHolderManagementKeyin 2.4.0.Ahead-of-publish note
hasIdentityKeyPurposeis declared here ahead of its adapter release — the implementation lives onfeat/irs-has-identity-key-purposeinopenzeppelin-adaptersand is not yet published.getFactoryIdentityandgrantHolderManagementKeyare already shipped in adapter-evm 2.4.0.Test plan
pnpm --filter @openzeppelin/ui-types typecheckpnpm --filter @openzeppelin/ui-types testpnpm --filter @openzeppelin/ui-types lintpnpm --filter @openzeppelin/ui-types buildMade with Cursor