feat(soroban,stellar): upgrade path management, multi-sig auth, state snapshot, and tx sequencing#687
Open
Macnelson9 wants to merge 1 commit into
Conversation
… snapshot, and tx sequencing Issue StellerCraft#621 — Contract Upgrade Path Management - Add `validateUpgradeCompatibility` to check deployed vs new storage key schemas - Add `scheduleContractUpgrade` that validates compatibility before returning a pending record - Add `rollbackContractUpgrade` to cancel pending upgrades before on-chain submission - Reject upgrades that remove or retype existing storage keys to prevent state corruption Issue StellerCraft#622 — Multi-Signature Authorization for Admin Operations - Add `createMultiSigOperation` with configurable signer threshold and authorized signer set - Add `collectSignature` to accumulate validated signatures; auto-approves at threshold - Add `executeMultiSigOperation` to finalize approved operations - Reject unauthorized signers, duplicate signatures, and operations below threshold Issue StellerCraft#623 — Contract State Snapshot and Restore for Testnet Debugging - Add `snapshotContractState` to serialize contract storage into a versioned portable snapshot - Add `restoreContractState` to reapply a snapshot to a testnet contract - Guard both operations to testnet only; throw on any other network value - Injectable entry fetcher/applier for testability without live RPC Issue StellerCraft#624 — Stellar Payment Channel Transaction Sequencing with Conflict Resolution - Add `isSequenceConflict` to detect tx_bad_seq / bad_seq Horizon result codes - Add `SequenceManager` class with in-memory sequence cache, increment, and Horizon refresh - Add `submitWithSequenceRetry` that detects conflicts, refreshes the sequence from Horizon, and retries submission with the corrected sequence number Closes StellerCraft#621 Closes StellerCraft#622 Closes StellerCraft#623 Closes StellerCraft#624
|
@Macnelson9 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
SequenceManagertracks per-account sequence numbers, detectstx_bad_seqconflicts, refreshes the sequence from Horizon, and retries submission automatically.Changes
packages/stellar/src/soroban.tsvalidateUpgradeCompatibility(deployedSchema, newSchema)— pure compatibility checkscheduleContractUpgrade(...)— validates then returns aContractUpgradeRecordrollbackContractUpgrade(record)— cancels a pending upgradecreateMultiSigOperation(payload, config)— creates a pending multi-sig opcollectSignature(operation, signerPublicKey, config)— accumulates validated signaturesexecuteMultiSigOperation(operation)— marks approved op as executedsnapshotContractState(contractId, network, ...)— captures testnet contract storagerestoreContractState(contractId, snapshot, network, ...)— reapplies a snapshot on testnetpackages/stellar/src/service.tsisSequenceConflict(error)— detects tx_bad_seq result codesSequenceManager— in-memory sequence cache withgetSequence,increment,refresh,clearsubmitWithSequenceRetry(...)— submits with automatic conflict-resolution retryTest plan
validateUpgradeCompatibilityreturns compatible for schema superset, incompatible when keys are removed or retypedscheduleContractUpgradethrows on incompatible schemasrollbackContractUpgradethrows on non-pending recordscreateMultiSigOperationenforces threshold boundscollectSignaturerejects unauthorized/duplicate signers; transitions to approved at thresholdexecuteMultiSigOperationthrows when status is not approvedsnapshotContractState/restoreContractStatethrow on non-testnet network valuesrestoreContractStatethrows when snapshot belongs to a different contractisSequenceConflictmatches tx_bad_seq error messagesSequenceManager.refreshupdates cache from Horizon;incrementbumps countersubmitWithSequenceRetryretries on conflict and succeeds with refreshed sequenceCloses #621
Closes #622
Closes #623
Closes #624