Skip to content

Add SELECT action - #641

Open
duncancmt wants to merge 76 commits into
masterfrom
dcmt/select
Open

duncancmt wants to merge 76 commits into
masterfrom
dcmt/select

Conversation

@duncancmt

Copy link
Copy Markdown
Collaborator

Copied from 0xProject/0x-settler-private#6 . Most of this work is from @jparklev

  • add the SELECT action
  • no VIP action support within SELECT
  • no on-chain measured Best-of-n (data didn't support meaningful uplift from production-representative quote -> execute delays). however, the interface we have here can also support best-of-n, with a relatively simple change to the internals of _select if we choose to add it back (same selector and encoding)

jparklev and others added 30 commits July 3, 2026 02:41
…andidates) subsuming fallback, ladder, runoff, and the improvement fee — calldata-forwarding assembly self-calls, per-candidate gas caps, plain args
…ever influenced ranking; 4-arg SELECT/SELECT_VIP, candidates head word 0x80→0x60, unit tests 10/10
Keep SELECT on Base and leave production Mainnet unchanged for deployment size.

Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: Claude (Fable 5, Claude Code) <noreply@anthropic.com>
Co-Authored-By: Claude (Fable 5, Claude Code) <noreply@anthropic.com>
Meta-txn witnesses hash only the declared outer action bytes, so nested
candidate offsets that escape into trailing calldata would let a relayer
execute unsigned actions. Reject out-of-bounds blobs and add a regression.

Co-authored-by: Cursor <cursoragent@cursor.com>
SELECT is chain-agnostic, so handle it in the shared base dispatch.
Chains that call super._dispatch get it for free; Mainnet keeps its
copied arm. Drops the per-chain Select mixin from Base/Mainnet.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep only the SELECT wiring edits; restore original comment and
indentation style so the PR stays reviewable.

Co-authored-by: Cursor <cursoragent@cursor.com>
…st success

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
duncancmt and others added 21 commits August 31, 2026 16:45
`select` follows the `targets` and `candidates` offset words and enforces
the same bounds, at the same points, as the standard ABI decoder: array
contents must lie inside the action data, and each candidate offset must
leave room for its length word, checked when that candidate's trial runs.
Candidate offsets may alias or appear in any order. The candidate region
is copied once into a shared callback buffer; each trial selects its
candidate by rewriting only the callback's dynamic offset and target
words, and the callback follows that offset to the candidate's actions.
Every candidate now runs regardless of how much gas remains. A successful
trial commits even when EIP-150 clamped its requested trial gas limit. A
failed trial is skipped only when the pre-call gas measurement proves the
trial received its whole cap; any other failure consumes all remaining gas
with INVALID so that the gas supplied to the transaction cannot steer route
selection. The final trial still runs uncapped and bubbles its revert data
when fully funded.

Funding is measured before the call because, after a failure, a fully
funded trial that consumed its gas is indistinguishable from a starved
one. _SELECT_OVERHEAD_GAS overestimating the measurement-to-CALL plumbing
is the soundness condition for skipping a failed trial.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
A starved trial's success commits; a starved trial's failure consumes all
gas instead of falling through or bubbling; a fully funded failure still
falls through. The scenario that previously reverted before the first
candidate for want of a whole-tail reserve now succeeds and is tested as
such. Gas snapshots track the cheaper loop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@duncancmt duncancmt self-assigned this Sep 1, 2026
@immunefi-magnus

Copy link
Copy Markdown

🛡️ Immunefi PR Reviews

We noticed that your project isn't set up for automatic code reviews. If you'd like this PR reviewed by the Immunefi team, you can request it manually using the link below:

🔗 Send this PR in for review

Once submitted, we'll take care of assigning a reviewer and follow up here.

@duncancmt duncancmt added the audit changes have been sent for audit and professionally reviewed label Sep 1, 2026
Comment thread src/ISettlerActions.sol
/// its score `target`. A score is the increase in the `token` balance held by Settler. A
/// zero `target` commits any non-reverting candidate. Native asset output only scores if
/// wrapped to wrapped-native in the candidate actions. Candidates must not contain
/// `CHECK_SLIPPAGE`. `targets` are the per-candidate minimum outputs that terminate the

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.

For reviewers: we’ll add NATIVE_CHECK to this comment for clarity. Both CHECK_SLIPPAGE and NATIVE_CHECK should stay outside SELECT candidates

@duncancmt
duncancmt added this pull request to stack #648 September 9, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audit changes have been sent for audit and professionally reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants