Skip to content

fix(predict): invalidate EthQuery cache before Claim/Withdraw Safe TX signing#28001

Merged
matallui merged 1 commit into
mainfrom
predict/invalidate-ethquery-cache
Mar 26, 2026
Merged

fix(predict): invalidate EthQuery cache before Claim/Withdraw Safe TX signing#28001
matallui merged 1 commit into
mainfrom
predict/invalidate-ethquery-cache

Conversation

@matallui

@matallui matallui commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Description

~2% of Claim/Withdraw transactions are failing with Safe GS026 or GS013 errors. Root cause: EthQuery caches query results for up to 15 minutes, which can serve a stale nonce when signing Safe transactions. This fix calls invalidateQueryCache before prepareClaim and signWithdraw so the Safe TX is always signed with a fresh nonce.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/PRED-769

Manual testing steps

Feature: Predict Claim/Withdraw nonce freshness

  Scenario: User claims positions without GS026/GS013 errors
    Given the user has claimable positions on Predict
    And the EthQuery cache contains a stale nonce

    When the user initiates a Claim transaction
    Then the query cache is invalidated before signing the Safe TX
    And the transaction succeeds without GS026 or GS013 errors

  Scenario: User withdraws funds without GS026/GS013 errors
    Given the user has a balance available for withdrawal on Predict
    And the EthQuery cache contains a stale nonce

    When the user initiates a Withdraw transaction
    Then the query cache is invalidated before signing the Safe TX
    And the transaction succeeds without GS026 or GS013 errors

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Touches Predict claim/withdraw signing flow; while the change is small, it alters pre-sign network behavior and could impact transaction submission timing or error handling.

Overview
Prevents stale Safe nonces during Predict Claim and Withdraw by invalidating the underlying EthQuery cache immediately before prepareClaim and signWithdraw run.

This adds an invalidateQueryCache call (via blockTracker.checkForLatestBlock()) to force fresh chain state before signing, reducing intermittent Safe GS026/GS013 failures.

Written by Cursor Bugbot for commit 2144104. This will update automatically on new commits. Configure here.

… signing

Adds invalidateQueryCache calls before prepareClaim and signWithdraw
to prevent GS026/GS013 errors caused by stale nonces from EthQuery's
15-minute query cache.
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-predict Predict team label Mar 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - draft PR

All E2E tests pre-selected.

View GitHub Actions results

@matallui matallui marked this pull request as ready for review March 26, 2026 21:14
@matallui matallui requested a review from a team as a code owner March 26, 2026 21:14

@caieu caieu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
16 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud

Copy link
Copy Markdown

@matallui matallui added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 49c3ca0 Mar 26, 2026
133 checks passed
@matallui matallui deleted the predict/invalidate-ethquery-cache branch March 26, 2026 22:20
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 26, 2026
@metamaskbot metamaskbot added the release-7.73.0 Issue or pull request that will be included in release 7.73.0 label Mar 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.73.0 Issue or pull request that will be included in release 7.73.0 size-XS team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants