Skip to content

Add ERC: Reference-Relative Slippage Bounds - #1935

Open
zexoverz wants to merge 9 commits into
ethereum:masterfrom
zexoverz:add-erc-reference-relative-slippage-bounds
Open

Add ERC: Reference-Relative Slippage Bounds#1935
zexoverz wants to merge 9 commits into
ethereum:masterfrom
zexoverz:add-erc-reference-relative-slippage-bounds

Conversation

@zexoverz

@zexoverz zexoverz commented Aug 8, 2026

Copy link
Copy Markdown

Adds a Standards Track ERC for reference-relative slippage bounds. A swap's output floor is derived from a live ERC-7726 reference price at execution time, rather than a static minAmountOut fixed at signing time. This shrinks the stale-quote window a sandwich exploits and standardizes how wallets and routers express slippage protection.

Discussion: https://ethereum-magicians.org/t/reference-relative-slippage-bounds/29292

The floor separates a known-cost field (expectedCostBps, the pool fee plus modeled impact vs the mid-price reference) from an adverse-only tolerance (maxDeviationBps), so a normal fill is not spent as adverse headroom. Realized output is measured as the executor's tokenOut balance delta, never a route-reported number, and freshness is a requirement on the referenced oracle instance, not the interface.

A reference implementation (interface, abstract floor base, a real Chainlink ERC-7726 adapter, unit tests, and a mainnet-fork test, all green) is linked from the Reference Implementation section. Requires ERC-165 and ERC-7726.

eip: 0000 is a placeholder for an editor to assign.

@eip-review-bot

eip-review-bot commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

File ERCS/erc-8377.md

Requires 1 more review from Editors: @g11tech, @jochem-brouwer, @samwilsn, @xinbenlv

@github-actions github-actions Bot added the w-ci label Aug 8, 2026
@zexoverz

Copy link
Copy Markdown
Author

This is ready for editor review. The two failing checks (EIP Walidator and HTMLProofer) are only the erc-0000 placeholder state and clear once a number is assigned and the file is renamed. Everything else passes and the discussion link is in the preamble. Would appreciate a number assignment and a review pass around Meeting 110 tomorrow.

Comment thread ERCS/erc-0000.md Outdated
@@ -0,0 +1,124 @@
---
eip: 0000

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.

Suggested change
eip: 0000
eip: 8377

Assigning next sequential EIP/ERC/RIP number.
Numbers are assigned by editors & associates.

Please also update the filename.

Comment thread ERCS/erc-0000.md Outdated
title: Reference-Relative Slippage Bounds
description: An interface for swap slippage relative to a live reference price at execution time, not a static minimum fixed at signing time
author: Faisal Firdani (@zexoverz)
discussions-to: https://ethereum-magicians.org/t/reference-relative-slippage-bounds/29292

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.

Please create actual discussions topic on Eth Magicians

Number assigned by @abcoathup. Updates eip to 8377, renames the file, and
points discussions-to at the numbered Ethereum Magicians topic.
@zexoverz

Copy link
Copy Markdown
Author

Thanks, updated to 8377 and renamed the file.

The discussion topic already exists, it just did not carry the number in the title yet. I am updating the title to carry ERC-8377 so it matches the convention, and discussions-to now points at the numbered URL.

https://ethereum-magicians.org/t/erc-8377-reference-relative-slippage-bounds/29292

HTMLProofer resolves links against the built EIPS/eip-*.html tree, so ./erc-N.md
fails while ./eip-N.md resolves. Matches how the rest of the repo links.
@github-actions github-actions Bot removed the w-ci label Aug 14, 2026
…e impl, normative keywords in Specification

- Test Cases: replace the prose list of test shapes with concrete input/expected-output
  tables, and point at the executable suite.
- Reference Implementation: vendor the sources into assets/erc-8377/ and link relatively
  instead of pointing at an external repository path that did not exist.
- Specification: add the rule that the reference MUST NOT be a spot price from the pool
  being traded. It previously lived only in Security Considerations.
- Backwards Compatibility / Security Considerations: state requirements descriptively and
  leave the normative keywords in Specification.
@github-actions

Copy link
Copy Markdown

The commit 8adba9d (as a parent of c0ddffe) contains errors.
Please inspect the Run Summary for details.

@github-actions github-actions Bot added the w-ci label Aug 14, 2026
The directory stays assets/erc-8377/, but the generated site serves it under
assets/eip-8377/, the same erc-/eip- rename the .md links follow. Matches ERC-8063.
The draft measured the executor's tokenOut balance delta and had no recipient
parameter, which contradicts the answer given on the discussion thread: the
invariant is that the recipient received at least the floor, not the executor.
Both the interface and the reference implementation now take a recipient and
measure there.

Adds InvalidRecipient, a rationale paragraph for why the measurement moved, and
two test cases: a route that pays the executor instead of the recipient, and a
zero recipient. interfaceId moves from 0x5001f5f8 to 0x2a376f22.
…plit Test Cases table

The fork test still asserted the executor's USDC balance after the floor moved
to the recipient, so it failed against a live feed. Assert the recipient's
delta and that the executor keeps nothing. Case 10 sat in its own headerless
table and rendered as a header row; merge it into the main table. Drop two
stale 'executor' doc comments.
A reference-relative floor is immune to price drift by construction, so a
caller who decided to swap yesterday gets today's price with the same bps
guarantee. The floor cannot catch that. A stale quote and a stale intent are
different properties: the oracle already fails closed on the first, and the
deadline covers the second.

Zero is unbounded, so existing callers are unaffected. The check runs before
the reference read and before the route, so an expired intent does not depend
on an oracle read succeeding. interfaceId moves 0x2a376f22 -> 0x41b46b60 and
is now pinned by the suite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants