docs: move the JIT system guide to the solver crate - #21
Open
kayibal wants to merge 1 commit into
Open
Conversation
The JIT document lived under contracts/ as if the system were contracts only, but most of it is now Rust: fynd-jit-solver holds the book, the quoting, the profitability gate and the emission, and route-compressor holds the codec, order keys, dictionary sync and calldata. Move it to crates/fynd-jit-solver/README.md, next to the code it describes and alongside crates/intent-backrunner/README.md, the sibling mode's guide. contracts/README.md is now scoped to the three contracts: their external surface, the invariants a reviewer needs, the deploy script, and the forge suites, with a pointer to the solver crate for the system picture. The moved document gains what a reader could not infer from the old text: the five stages of a solve pass and the module behind each, the rules that authorize an emission (the expectedAmountOut baseline with no simulation, the surplus rule, the same-route refusal, the builder tip charged as a cost, L1 fee auto-detection, native quoted as the zero address), and a section on running the solver with the flags main.rs actually defines. Corrections at this commit: fynd-jit-solver and its anvil test are merged, so the PR #19 and unmerged-branch phrasing is gone; the gate no longer claims the L1 data fee routinely dominates, which 2399ee2 corrected; the Rust suite is 256 tests, not 102; and regenerating the fixtures does dirty the tree, since the generator writes JSON keys in declaration order while the committed files are sorted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The JIT document lived at
contracts/README.mdas if the system were contracts only. Most of itis now Rust, so it moves to where the crate lives and picks up references to the code.
What moved
contracts/README.md->crates/fynd-jit-solver/README.md(559 lines), next to the code itdescribes and alongside
crates/intent-backrunner/README.md, the sibling mode's guide. The rootREADME's JIT link now points there.
What the new contracts README covers
A contracts reviewer's document, 155 lines, scoped to
FyndJITRouter,RouteDictionaryandRouteDecompressor: the external surface (user entrypoints,storeRoute/storeBatch, theviews, the admin functions), the invariants that matter for review, the bit-stream layout, the
deploy script and its role grants, and the forge suites including the Base fork suite. No
economics and no architecture narrative; those live in one place now.
What was added about the Rust side
crates/fynd-jit-solver/src/{book,decode,engine,quoter,route_delta,gate,l1fee,compress,dictionary,decisions,state}.rsand one for
crates/route-compressor/src/{codec,bitstream,segment,order,dictionary,contracts}.rs.expectedAmountOutdecodedfrom calldata, with no
eth_calland no simulation of the original route; the surplus rule isthe only emission rule; the same-route rule refuses a byte-identical-after-normalisation route
as
same_route, withsame_pools_new_splitflagged but still gated; the builder tip ischarged in the gate because Fynd pays it; the L1 data fee is auto-detected via the OP-stack
GasPriceOracleand is structurally zero without it; native tokens are quoted as the zeroaddress while the router's convention is the
0xEeee…marker.main.rsdefines, including the three whoseenvironment variables are not named after the flag, and what a builder must supply.
quoter.rs, with--min-tvlas the operator's dial, keptalongside the existing counterfactual and compromised-key limits.
The economics section is preserved as rewritten in
1043b74: single-route framing, the fourbreak-even numbers, the FastLZ minimum-charge finding. The 2026-08-14 11:56 UTC prices were not
re-fetched, so the timestamp is unchanged.
Stale content fixed at this commit
crates/fynd-jit-solverand its anvil integration test are merged, so all "under review inPR feat: fynd-jit-solver solve loop, profitability gate, and emission #19" and "not on this branch" phrasing is gone.
2399ee2corrected that framing: L2 execution was about 274x the L1 term in the gate's own snapshot,
and cheap blobspace is why.
git statusclean. It does not: thegenerator writes JSON keys in declaration order and the committed files are sorted, so all
four fixtures come back modified with identical values.
forge testis 20 to 30 seconds, not 8, and the fork suite's RPC round trips arenearly all of it.
Verification
forge testfromcontracts/: 107 passed.cargo test --workspace: 256 passed, 3 ignored;fixture churn dropped with
git checkout -- contracts/. Every relative link resolves from itsfile's directory and all 64 cited code symbols exist in the tree.
🤖 Generated with Claude Code