Migrate smart account SDK to OZ contracts v0.7.0-rc.2 - #13
Merged
Conversation
- AuthPayload format changed from Vec-based to Map-based with context_rule_ids and signers fields - Signing digest now binds context rule IDs: sha256(payloadHash || contextRuleIds.toXDR()) - Context rule resolution algorithm with 4-tier disambiguation (context type, exact signer, rule subset, selected subset) - Signer and policy removal now uses ID-based API (remove_signer/remove_policy take u32 IDs) - ParsedContextRule includes signerIds and policyIds (positionally aligned) - Pre-fetch context rules per submit/multiSignerTransfer call to avoid N+1 RPC calls - multiSignerTransfer accepts optional contextRuleId for explicit rule selection - Android WebAuthn allowCredentials now correctly constrains passkey selection - Updated demo config with v0.7.0 testnet contract addresses and WASM hash - Removed dead parsing code from demo ContextRuleParser (SDK handles parsing) - Updated unit tests for new AuthPayload format, added buildAuthDigest tests
- Replace static contextRuleIds parameter with ResolveContextRuleIds callback on submit(), executeAndSubmit(), and multiSignerTransfer() for per-entry context rule selection - Add executeAndSubmit() for generic single-signer contract calls via the OZ execute entry point - Improve error messages to differentiate ambiguous matches from invalid signer combinations - Update API reference documentation and unit tests
… key data for passkey signers
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (23.40%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
==========================================
- Coverage 77.85% 77.25% -0.60%
==========================================
Files 830 831 +1
Lines 23664 23937 +273
Branches 3108 3164 +56
==========================================
+ Hits 18424 18493 +69
- Misses 3975 4164 +189
- Partials 1265 1280 +15
🚀 New features to boost your workflow:
|
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.
Description
Migrates the smart account SDK layer, demo app, and documentation to the OpenZeppelin smart account contracts v0.7.0-rc.2. Updates testnet contract addresses, signing flow, and context rule management.
Auth payload and signing
context_rule_idsandsignersfieldssha256(payloadHash || contextRuleIds.toXDR())SmartAccountAuthPayloaddata class andSmartAccountAuthPayloadCodecfor reading/writing the v0.7.0-rc.2 formatsignAuthEntry()acceptscontextRuleIdsparameteraddRawSignatureMapEntry()acceptscontextRuleIdsparameterContext rule resolution
resolveContextRuleIdsForEntry()with overload accepting pre-fetched rules to avoid N+1 RPC callslistContextRules()returns fully parsedParsedContextRulewithsignerIdsandpolicyIdsResolveContextRuleIdscallback onsubmit(),executeAndSubmit(), andmultiSignerTransfer()for explicit per-entry rule selectionMAX_CONTEXT_RULESpre-validation inaddContextRule()(no upper limit in v0.7.0-rc.2 contract)addContextRule()allows zero signers when at least one policy is presentNew APIs
executeAndSubmit()for generic single-signer contract calls via the OZexecuteentry pointResolveContextRuleIdstype alias for per-entry context rule callbacksAPI changes
removeSigner()takessignerId: UIntinstead ofSmartAccountSignerremovePolicy()takespolicyId: UIntinstead of policy address stringsignAuthEntries()removed (unused public method with no equivalent in the TS SDK)ParsedContextRuleincludessignerIdsandpolicyIds(positionally aligned)MathOverflow,KeyDataTooLarge,ContextRuleIdsLengthMismatch,NameTooLong,UnauthorizedSignerTransaction assembly and polling
prepareTransaction()instead of manual fee calculation insubmit(),submitMultiSignerTransaction(), andfundWallet()pollTransaction()with 30 attempts and 3-second intervalsSendTransactionStatuschecks for ERROR and TRY_AGAIN_LATERtx_bad_seqDemo app
listContextRules(), removed dead parsing codeallowCredentialsto correctly constrain passkey selectionTests and documentation
buildAuthDigest, contextRuleIds preservation, andexecutefunction usageResolveContextRuleIdstype, and examples