Skip to content

e2e test proving pre hook run on same token trade#4490

Merged
extrawurst merged 3 commits into
mainfrom
same-token-pre-hook
Jun 5, 2026
Merged

e2e test proving pre hook run on same token trade#4490
extrawurst merged 3 commits into
mainfrom
same-token-pre-hook

Conversation

@extrawurst
Copy link
Copy Markdown
Contributor

Description

Adds a use-case-driven e2e test for same-token orders (SameTokensPolicy::Allow, #3963).
Follow-up to #4463, which proved buy-side support with WETH→ETH (native-equivalent, not a
literal same token). This uses WETH→WETH and the real use case: a no-op same-token
trade used to get a pre-hook executed and paid for by the solver.

Changes

Add local_node_solver_pays_for_pre_hook_on_same_token_order:

  • SameTokensPolicy::Allow, WETH→WETH Buy order with a 1% spread (the solver's headroom
    to cover settlement gas + the hook).
  • Pre-hook calls the Counter test contract; we assert it ran.

Asserts: counter 0 before; settlement tx confirmed (not a cancellation); counter 1
after (hook ran); trader WETH balance decreased (paid the spread).

How to test

cargo nextest run -p e2e local_node_solver_pays_for_pre_hook_on_same_token_order \
  --test-threads 1 --run-ignored ignored-only --failure-output final

proving actual sell=buy use case to facilitate it to arb interactions on a same token trade
@extrawurst extrawurst requested a review from a team as a code owner June 5, 2026 10:07
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds an end-to-end test to verify that a solver pays for a pre-hook execution on a same-token buy order when SameTokensPolicy::Allow is enabled. No critical issues found.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Copy link
Copy Markdown
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

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

Seems reasonable to have a dedicated test for this.

Comment thread crates/e2e/tests/e2e/submission.rs Outdated
@extrawurst extrawurst enabled auto-merge June 5, 2026 12:37
@extrawurst extrawurst added this pull request to the merge queue Jun 5, 2026
Merged via the queue into main with commit add8db2 Jun 5, 2026
20 checks passed
@extrawurst extrawurst deleted the same-token-pre-hook branch June 5, 2026 12:51
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants