Commit 94bc4b4
authored
feat(adapter-stellar): add two-step Ownable support with ledger-based expiration (#271)
* docs(spec): add Stellar Ownable two-step transfer specification
Complete feature specification for extending the Stellar Access Control
module to support OpenZeppelin Ownable two-step ownership transfer with
ledger-based expiration.
Includes:
- spec.md: 23 functional requirements, 6 NFRs, 4 user stories
- plan.md: implementation approach and architecture decisions
- tasks.md: 64 implementation tasks organized by user story
- research.md: Phase 0 research findings
- data-model.md: entity definitions and relationships
- contracts/: TypeScript interface definitions
- quickstart.md: integration guide
- checklists/: requirements quality validation
* feat(adapter-stellar): add two-step Ownable foundation (Phase 1 & 2)
Add foundational infrastructure for Stellar Ownable two-step ownership
transfer with ledger-based expiration support.
Types (chain-agnostic):
- Add OwnershipState type ('owned' | 'pending' | 'expired' | 'renounced')
- Add PendingOwnershipTransfer interface with expirationBlock
- Extend OwnershipInfo with optional state and pendingTransfer
- Add hasTwoStepOwnable flag to AccessControlCapabilities
Adapter-stellar:
- Add getCurrentLedger() to query current ledger via Soroban RPC
- Add OWNERSHIP_TRANSFER_INITIATED event type to indexer client
- Add queryPendingOwnershipTransfer() method to detect pending transfers
- Add validateExpirationLedger() helper for client-side validation
- Update feature detection to identify two-step Ownable contracts
* feat(adapter-stellar): implement ownership status viewing (Phase 3)
Implement User Story 1 - View Contract Ownership Status with:
- Add getOwnership() method with full state determination (owned/pending/expired/renounced)
- Add readPendingOwner() on-chain query for expiration data (liveUntilLedger)
- Add getCurrentLedger() for expiration calculations
- Update indexer client to use OWNERSHIP_TRANSFER_STARTED event type
- Hybrid data sourcing: indexer for event detection, on-chain for expiration
- Add comprehensive unit tests (T015-T027) and integration tests
- Update spec files with indexer schema discovery notes
Note: Indexer does not store live_until_ledger, so expiration is queried
on-chain via get_pending_owner() contract method.
* feat(adapter-stellar): implement two-step ownership transfer initiation (Phase 4)
Add support for initiating two-step ownership transfers with expiration:
- Update assembleTransferOwnershipAction() to include live_until_ledger parameter
- Update transferOwnership() to require expirationLedger with client-side validation
- Add boundary condition check (expirationLedger == currentLedger is invalid per FR-020)
- Add specific error messages per FR-018
- Add INFO logging for transfer initiation per NFR-004
- Update AccessControlService interface for two-step transfer support
* feat(adapter-stellar): implement ownership acceptance (Phase 5)
Add acceptOwnership() method to complete the two-step ownership transfer flow.
Pending owners can now accept transfers before expiration.
- Add assembleAcceptOwnershipAction() in actions.ts
- Add acceptOwnership() method in service.ts with INFO logging
- Add comprehensive tests for acceptance flow (T039-T048)
- Mark Phase 5 tasks complete in tasks.md
* chore: rename spec from 001 to 006-stellar-ownable-support
Fix spec numbering to follow existing sequence (001-005 already used).
Rename directory and update all internal references.
* docs(spec): mark Phase 6 feature detection tasks complete
Phase 6 (User Story 4: Detect Ownable Contract Features) was already
implemented. Verified all tests pass and marked tasks T049-T056 complete.
* fix(adapter-stellar): add blockHeight to ownership transfer query
The GraphQL query for OWNERSHIP_TRANSFER_STARTED was missing the
blockHeight field, causing the fallback logic at line 609 to fail.
When ledger was falsy, parseInt(undefined, 10) returned NaN.
* feat(adapter-stellar): complete Phase 7 polish for two-step Ownable support
Phase 7 Polish & Cross-Cutting Concerns:
- Enhanced module-level JSDoc in index.ts with two-step Ownable documentation
- Added @example sections to service methods (getOwnership, transferOwnership, acceptOwnership)
- Added integration tests for full two-step transfer workflow
- Added edge case tests (boundary conditions, network errors)
- Added performance benchmark tests (NFR-001/NFR-002/NFR-003)
- Created changeset for minor version bump
Bug Fixes:
- Fixed missing admin field validation in queryPendingOwnershipTransfer
(returns null instead of invalid OwnershipTransferStartedEvent with empty previousOwner)
- Fixed missing GraphQL error check for completion query response
(now throws OperationFailed instead of silently treating errors as no completion)
Documentation:
- Updated quickstart.md with correct field names and imports
- Marked all Phase 7 tasks complete in tasks.md
* fix(adapter-stellar): remove redundant null check in readPendingOwner1 parent 56eb3fc commit 94bc4b4
File tree
22 files changed
+5079
-54
lines changed- .changeset
- packages
- adapter-stellar
- src/access-control
- test/access-control
- types/src/adapters
- specs/006-stellar-ownable-support
- checklists
- contracts
22 files changed
+5079
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
| 81 | + | |
78 | 82 | | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
82 | | - | |
| 86 | + | |
| 87 | + | |
83 | 88 | | |
84 | 89 | | |
85 | 90 | | |
86 | | - | |
| 91 | + | |
87 | 92 | | |
88 | 93 | | |
89 | | - | |
| 94 | + | |
90 | 95 | | |
91 | 96 | | |
92 | 97 | | |
93 | 98 | | |
94 | | - | |
95 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
96 | 127 | | |
97 | 128 | | |
98 | 129 | | |
| |||
Lines changed: 28 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
72 | | - | |
| 75 | + | |
| 76 | + | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
79 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
80 | 88 | | |
81 | 89 | | |
82 | 90 | | |
| |||
99 | 107 | | |
100 | 108 | | |
101 | 109 | | |
| 110 | + | |
102 | 111 | | |
103 | 112 | | |
104 | 113 | | |
| |||
113 | 122 | | |
114 | 123 | | |
115 | 124 | | |
| 125 | + | |
116 | 126 | | |
117 | 127 | | |
118 | 128 | | |
119 | 129 | | |
120 | 130 | | |
121 | | - | |
| 131 | + | |
| 132 | + | |
122 | 133 | | |
123 | 134 | | |
124 | 135 | | |
125 | 136 | | |
126 | 137 | | |
127 | 138 | | |
128 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
129 | 142 | | |
130 | 143 | | |
131 | 144 | | |
132 | 145 | | |
133 | 146 | | |
134 | | - | |
135 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
136 | 158 | | |
137 | 159 | | |
138 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
7 | 36 | | |
8 | 37 | | |
9 | 38 | | |
| |||
0 commit comments