-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NONEVM-984][solana] - Reorg Detection + lighter rpc call #951
Conversation
case txmutils.Confirmed: | ||
if sigOnChainState == txmutils.Processed || sigOnChainState == txmutils.Broadcasted || sigOnChainState == txmutils.NotFound { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't there be a case where the in-memory state differs from the on-chain state due to the chain being polled more recently, which wouldn't be a true reorg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no problem that we have different states as long as the on-chain one is greater or equal than our in-memory one.
If this premise is false, it's because:
- A re-org occurred and we need to handle it
- Potential Lagging RPC edge case
- We are not sure if this is a real risk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is what I was getting at... I guess you guys have already thought it through though and nothing has come up in soak testing
if tempTx, confirmedExists = c.confirmedTxs[id]; confirmedExists { | ||
tx = tempTx | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be impossible for a tx to exist in both confirmed and broadcasted since it's deleted during OnCofirmed
? Not saying this is a huge issue mostly just testing my understanding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this shouldn't happen. What is your concern about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well this function seems to be okay with that case where broadcastedExists
and confirmedExists
, I guess the reorg would just be caught elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We catch the reorgs here:
- When getting a NotFound sig, we check if our in-memory state is higher for it (
Processed
orConfirmed
) and needs to be handled - When getting a Processed signature sig, if our in-memory state is higher for it (
Confirmed
) and needs to be handled - By definition, no reorgs from
Finalized
state should happen, that's why they are not handled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work, looks good to me!
Quality Gate passedIssues Measures |
* refactor so txm owns blockhash assignment * lastValidBlockHeight shouldn't be exported * better comment * refactor sendWithRetry to make it clearer * confirm loop refactor * fix infinite loop * move accountID inside msg * lint fix * base58 does not contain lower l * fix hash errors * fix generate random hash * remove blockhash as we only need block height * expired tx changes without tests * add maybe to mocks * expiration tests * send txes through queue * revert pendingtx leakage of information. overwrite blockhash * fix order of confirm loop and not found signature check * fix mocks * prevent confirmation loop to mark tx as errored when it needs to be rebroadcasted * fix test * fix pointer * add comments * reduce rpc calls + refactors * tests + check to save rpc calls * address feedback + remove redundant impl * iface comment * address feedback on compute unit limit and lastValidBlockHeight assignment * blockhash assignment inside txm.sendWithRetry * address feedback * Merge branch 'develop' into nonevm-706-support-custom-bumping-strategy-rpc-expiration-within-confirmation * refactors after merge * fix interactive rebase * fix whitespace diffs * fix import * fix mocks * add on prebroadcaste error * remove rebroadcast count and fix package * improve docs * track status on each signature to detect reorgs * move things arround + add reorg detection * linting errors * fix some state tracking instances * remove redundant sig update * move state from txes to sigs * fix listAllExpiredBroadcastedTxs * handle reorg after confirm cycle * associate sigs to retry ctx * remove unused ctx * add errored state and remove finalized * comment * Revert "comment" This reverts commit 6bc0c62. * Revert "remove unused ctx" This reverts commit 2902ec0. * Revert "associate sigs to retry ctx" This reverts commit 8c18891. * Revert "fix listAllExpiredBroadcastedTxs" This reverts commit f4c6069. * Revert "move state from txes to sigs" This reverts commit 3a6e643. * fix tx state * address feedback * fix ci * fix lint * handle multiple sigs case * improve comment * improve logic and comments * fix comparison against blockHeight instead of slotHeight * address feedback * fix lint * fix log * address feedback * remove useless slot height * address feedback * add comment * tests and fix some bugs * address feedback * address feedback * validate that tx doesn't exist in any of maps when adding new tx * get height instead of whole block optimization * fix mocks on expiration * fix test * rebroadcast with new blockhash + add integration tests * fix integration tests * remove unused params and better comments * handle reorg equally for processed and confirmed at a sig level * add comments and rename txHasReorg to IsTxReorged for better readability * change test name to solve github CI failing check * fix ci * fix tests removing parallel * fix integration tests * capture range var * address feedback * address feedback
Description
Tickets
Soak Testing