Skip to content

fix(predict): cp-7.63.0 add transaction validation and improve error handling#25013

Merged
matallui merged 5 commits intomainfrom
predict/transaction-validation
Jan 22, 2026
Merged

fix(predict): cp-7.63.0 add transaction validation and improve error handling#25013
matallui merged 5 commits intomainfrom
predict/transaction-validation

Conversation

@caieu
Copy link
Copy Markdown
Contributor

@caieu caieu commented Jan 21, 2026

Description

Adds comprehensive validation for deposit transactions to prevent
silent failures causing 'not enough input to decode' errors.

Changes:

  • Add transaction validation in depositWithConfirmation:
    • Verify transaction and params objects exist
    • Validate 'to' address format (0x prefix, 42 chars)
    • Validate data field exists and has valid hex format
    • Enforce minimum data length (10 chars)
  • Improve error handling in polymarket safe utils:
    • Re-throw errors in getDeployProxyWalletTransaction instead of
      returning undefined
    • Add try-catch with proper error propagation in
      getProxyWalletAllowancesTransaction
    • Add call data length validation
  • Update tests with valid mock addresses/data
  • Add test coverage for all new validation error scenarios

Changelog

CHANGELOG entry: null

Related issues

Fixes: #24804

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

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

Strengthens transaction reliability and diagnostics around Predict deposits and Polymarket Safe flows.

  • Add validateDepositTransactions and invoke in depositWithConfirmation; logs transaction summary before submission
  • Enforce checks: presence of params, valid to (0x, 42 chars), data existence/hex format, and minimum data length
  • Improve Safe utils: re-throw signing failures in getDeployProxyWalletTransaction; wrap getProxyWalletAllowancesTransaction in try/catch and validate call data length
  • Update tests to use valid addresses/data and add coverage for all new validation/error scenarios

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

@metamaskbot metamaskbot added the team-predict Predict team label Jan 21, 2026
@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.

@caieu caieu marked this pull request as ready for review January 21, 2026 20:57
@caieu caieu requested a review from a team as a code owner January 21, 2026 20:57
@github-actions github-actions bot added size-L and removed size-M labels Jan 21, 2026
@caieu caieu changed the title fix(predict): add transaction validation and improve error handling fix(predict): cp-7.63.0 add transaction validation and improve error handling Jan 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions
  • Risk Level: medium
  • AI Confidence: 95%
click to see 🤖 AI reasoning details

The changes are entirely focused on the Predict/Polymarket feature:

  1. New validation utility (validateTransactions.ts): Adds transaction validation for deposit flows, checking for valid addresses, data format, and minimum data length.

  2. PredictController changes: Integrates the new validation into depositWithConfirmation() method with additional debug logging.

  3. Safe utils improvements: Changes error handling from silent failures to explicit error throwing in getDeployProxyWalletTransaction() and getProxyWalletAllowancesTransaction().

  4. Test updates: All test file changes are unit tests for the Predict feature, updating mock data to use valid formats and adding new validation test cases.

These changes are isolated to the Predict feature and don't touch any shared components (Browser, TabBar, Modals, Confirmations, etc.) that could affect other test suites. The SmokePredictions tag is the appropriate and only necessary tag to validate these changes, as it covers:

  • Opening positions on prediction markets
  • Cashing out positions
  • Claiming winnings
  • Balance synchronization after transactions
  • Error handling scenarios (API failures, geo restrictions)

The risk is medium because while the changes improve error handling (which is positive), they also change behavior from silent failures to thrown errors, which could affect user flows if not properly handled.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@matallui matallui added this pull request to the merge queue Jan 22, 2026
Merged via the queue into main with commit 87bc552 Jan 22, 2026
83 checks passed
@matallui matallui deleted the predict/transaction-validation branch January 22, 2026 23:09
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2026
@metamaskbot metamaskbot added the release-7.64.0 Issue or pull request that will be included in release 7.64.0 label Jan 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.64.0 Issue or pull request that will be included in release 7.64.0 size-L team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Predict deposit transactions failing with 'not enough input to decode' error

3 participants