Repository navigation
fix(transactions): handle all DECIDED states in waitForTransactionReceipt - #116
Merged
Merged
Conversation
…eipt - Add DECIDED_STATES constant with all terminal transaction states - Add isDecidedState utility function for status checking - Update waitForTransactionReceipt to accept any decided state when ACCEPTED is requested - Maintains backward compatibility while fixing DXP-667 Fixes: DXP-667 Co-Authored-By: daniel@genlayerlabs.com <danielrojasc888@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
Fixes ESLint error for unused variable after refactoring to use isDecidedState utility function. Co-Authored-By: daniel@genlayerlabs.com <danielrojasc888@gmail.com>
- Add tests for DECIDED_STATES constant and isDecidedState utility function - Test waitForTransactionReceipt accepts all decided states when ACCEPTED requested - Test backward compatibility for non-ACCEPTED status requests - Test edge cases with invalid statuses - Comprehensive test coverage for new decided states logic Co-Authored-By: daniel@genlayerlabs.com <danielrojasc888@gmail.com>
cristiam86
approved these changes
Sep 18, 2025
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.
Fixes DXP-667
What
DECIDED_STATESconstant defining all terminal transaction states (ACCEPTED, UNDETERMINED, LEADER_TIMEOUT, VALIDATORS_TIMEOUT, CANCELED, FINALIZED)isDecidedState()utility function to check if a transaction status is in a decided/terminal statewaitForTransactionReceipt()logic to accept any decided state whenstatus = ACCEPTEDis requested, instead of only accepting FINALIZEDWhy
The current implementation incorrectly handles waiting for transactions in "DECIDED" states. When users call
waitForTransactionReceiptwithstatus = ACCEPTED, the function only accepts ACCEPTED or FINALIZED states as valid terminal states. However, several other transaction states (UNDETERMINED, LEADER_TIMEOUT, VALIDATORS_TIMEOUT, CANCELED) are also considered "decided" and should satisfy the wait condition.This fix allows users to properly wait for transaction completion without getting stuck when transactions reach other valid terminal states.
Testing done
isDecidedState()function correctly identifies decided states using the status number mappingsDecisions made
Checks
Reviewing tips
Key areas to focus review:
isDecidedState()logic correctly usestransactionsStatusNameToNumbermappingwaitForTransactionReceipt()maintains the original behavior for exact status matchesUser facing release notes
🔧 Fixed:
waitForTransactionReceipt()now properly handles all decided transaction states when waiting for ACCEPTED status. Previously, only FINALIZED transactions would satisfy ACCEPTED waits, but now UNDETERMINED, LEADER_TIMEOUT, VALIDATORS_TIMEOUT, and CANCELED states are also accepted as valid terminal states.Link to Devin run: https://app.devin.ai/sessions/80954022f93e4bf9a08ebdb0af8edcd8
Requested by: @danielrc888