Add ERC: Reference-Relative Slippage Bounds - #1935
Conversation
File
|
|
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. |
| @@ -0,0 +1,124 @@ | |||
| --- | |||
| eip: 0000 | |||
There was a problem hiding this comment.
| eip: 0000 | |
| eip: 8377 |
Assigning next sequential EIP/ERC/RIP number.
Numbers are assigned by editors & associates.
Please also update the filename.
| 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 |
There was a problem hiding this comment.
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.
|
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 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.
…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.
|
The commit 8adba9d (as a parent of c0ddffe) contains errors. |
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.
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
minAmountOutfixed 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'stokenOutbalance 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: 0000is a placeholder for an editor to assign.