Skip to content

fix(spraay): align tool ABI with the deployed contract - #182

Open
plagtech wants to merge 3 commits into
google:mainfrom
plagtech:fix/spraay-abi-alignment
Open

fix(spraay): align tool ABI with the deployed contract#182
plagtech wants to merge 3 commits into
google:mainfrom
plagtech:fix/spraay-abi-alignment

Conversation

@plagtech

@plagtech plagtech commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Problem

The Spraay tool ABI merged in #95 declares four functions (spraayETH,
spraayToken, spraayETHVariable, spraayTokenVariable) whose selectors
do not exist in the deployed contract's bytecode
(0x1646452F98E36A3c9Cfc3eDD8868221E207B5eEC on Base), so every payment
call reverts at gas estimation. Two further issues surfaced while testing
the fix end to end: the "gas": 0 placeholder blocks estimation on the
default Base RPC, and using the confirmed (rather than pending) nonce makes
back-to-back sends collide.

All failures are loud and pre-broadcast — no funds were ever at risk, and
the contract has no on-chain record of calls to the missing selectors.

Fix

  • ABI replaced with the verified deployed interface (copied verbatim from
    the Sourcify-verified source): sprayEqual(token, recipients, amount)
    for equal sends (address(0) = ETH), and sprayETH / sprayToken with
    Recipient[] structs for variable sends
  • Protocol fee read live from feeBps() (owner-adjustable on-chain) with
    a safe fallback
  • Gas: build_transaction estimates (no zero placeholder), then a 10%
    buffer is applied
  • Nonce: fetched with "pending" so sequential sends don't collide

No public API changes: tool names, signatures, and return shapes are
unchanged, so existing agents need no code changes.

Verification

  • 25/25 unit tests, including new ABI-shape regression tests that pin the
    ABI to the verified contract interface
  • Selector pre-flight: every declared function's selector confirmed present
    in the deployed bytecode
  • Mainnet transactions through the fixed tools on Base:
    • 0x8701665d9ef5c99c14d548e89f5f4fa3eab0ff0841d696adff33f0a3be83e1ff (sprayEqual)
    • 0x795ff187a8426ff0c2439fefd2339e0ab5105a349a900dac5e9b7b8fb11a7507 (sprayEqual)
    • 0xa93e4b1b0ab99a30bcb3607190954e89ed15d09dc52c61e23e088805c4f27700 (sprayETH,
      variable amounts — consecutive block with the previous tx, exercising the
      sequential-send path)

@google-cla

google-cla Bot commented Sep 7, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@plagtech
plagtech force-pushed the fix/spraay-abi-alignment branch from 14317a9 to 51a9f01 Compare September 7, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant