Repository navigation
fix: resolve fee bump downgrade, soroban panic decoding, signing session timeout, and sep10 nonce randomization (#854, #859, #860, #861) - #883
Open
OluwapelumiElisha wants to merge 1 commit into
Conversation
…ion timeout, and sep10 nonce randomization (Sorokit#854, Sorokit#859, Sorokit#860, Sorokit#861) - Sorokit#854: Validate fee bump fee is strictly higher than original transaction fee in buildFeeBumpTransaction to prevent accidental fee downgrades - Sorokit#859: Implement SorobanErrorDecoder to parse Soroban panic messages and VM traps into readable descriptions instead of generic invocation failures - Sorokit#860: Enforce configurable timeout (default 5m) and cancellation support in TransactionSigningSession to prevent indefinite hangs - Sorokit#861: Introduce cryptographically random nonce generation in SEP-10 challenge generation to prevent challenge replay attacks
|
@OluwapelumiElisha 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 branch has not been deployed
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
This PR resolves issues #854, #859, #860, and #861 across the transaction, Soroban, wallet, and SEP-10 integration modules.
Closes #854
Closes #859
Closes #860
Closes #861
Detailed Changes
1. #854: Prevent Fee Bump Downgrades in
buildFeeBumpTransactionbuildFeeBumpTransactionaccepted any base fee without verifying that it exceeded the inner transaction's fee, allowing accidental fee downgrades that caused fee bumps to be rejected or ineffective.bumpFee > innerFeeimmediately after parsing the inner transaction envelope. Rejects fees less than or equal to the original transaction fee with a descriptiveTX_BUILD_FAILEDerror.src/transaction/feeBumpTransaction.ts,src/transaction/feeBump.ts,src/tests/feeBumpTransaction.test.ts.2. #859: Soroban Panic & VM Trap Decoder (
SorobanErrorDecoder)SorobanErrorDecoderanddecodeSorobanPanicto decode panics into human-readable descriptions, integrated intodecodeContractError.unreachable-> WebAssembly unreachable instruction executed (assertion failure or explicit panic)integer overflow/arithmetic overflow/overflow during arithmetic-> Arithmetic overflow or underflowdivision by zero/remainder by zero-> Division or remainder by zeroout of bounds-> Memory or table index out of boundsstack overflow/call stack exhausted-> WebAssembly call stack exhaustedunaligned memory-> Unaligned memory accessindirect call type mismatch-> Function signature mismatch on indirect callError(WasmVm, Trapped)-> WebAssembly VM execution trappedError(Context, Trap)-> Soroban host context trap occurredError(Budget, ExceededLimit)-> Soroban compute or memory resource budget exceededError(Storage, MissingValue)-> Missing or expired contract storage keyError(Auth, Invalid)-> Contract authorization failed or invalid credentialsError(Contract, #<code>)-> Custom contract error code extractionpanicked at '...', src/lib.rs:line:colextracted with clean reason and source location.src/soroban/sorobanErrorDecoder.ts,src/soroban/contractErrors.ts,src/soroban/index.ts,src/tests/sorobanErrorDecoder.test.ts.3. #860: Enforce Configurable Timeout & Cancellation on
TransactionSigningSessionTransactionSigningSessionandsignTransactionWithSessionwith timeout tracking and active lifecycle control.DEFAULT_SIGNING_SESSION_TIMEOUT_MS = 300,000 ms).session.extendTimeout(additionalMs): Adds additional milliseconds to the active session deadline while pending.session.resetTimeout(newTimeoutMs): Resets the timeout duration from the current moment.session.cancel(reason?): Immediately cancels the pending session and resolves the signing promise with aWALLET_SIGN_REJECTEDerror.SorokitErrorCode.OPERATION_TIMEOUTerror.src/wallet/transactionSigningSession.ts,src/wallet/index.ts,src/tests/transactionSigningSession.test.ts.4. #861: Cryptographically Secure Random Nonces in SEP-10 Challenge Generation
generateSep10NonceandgenerateSep10Challengeensuring every challenge contains a unique cryptographically secure random nonce.crypto.randomBytes(48)(Web Crypto APIgetRandomValuesin browser, Nodecrypto.randomBytesin Node.js).manageDataoperation (${homeDomain} auth), meeting the SEP-10 specification.src/integration/sep10Auth.ts,src/integration/index.ts,src/tests/sep10ChallengeNonce.test.ts.