feat: intent-swap extension — solve signed Fusion orders for same-block inclusion#1
feat: intent-swap extension — solve signed Fusion orders for same-block inclusion#1kayibal wants to merge 13 commits into
Conversation
…seal; distinguish engine-unavailable from queue-full
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Distinguish a closed build-event channel (consumer gone) from a full one (backpressure) in emit_build_event. A closed channel now warns once per process via an atomic latch instead of on every dropped event, which previously flooded logs for the remaining lifetime of the builder once the consumer died.
|
Pushed a fix round addressing external review findings:
Not addressed (pending decision): behavior on engine startup failure (currently error-and-stay-dead; alternative is panic → critical-task fail-fast → node restart). Tests: 14 intent-swap + 48 core lib + driver test green; clippy |
The critical-task fail-fast in reth only triggers on panic, not a plain return. Logging the error and returning left the intent-swap engine silently dead. Panic instead so the task manager shuts the node down.
|
Startup-failure decision resolved: 236ab6b |
|
Repointed the `backrunner`/`builder-types` git pin from the retired `pending-sim-entangled` branch to builder-integration main's merge commit `6029f1b` (intent-solve-api merge). `cargo update -p backrunner -p builder-types` resolved `fynd-core` from the git rev `af403016` (0.82.3) back to the crates.io release `0.81.1`, matching main's pin; `tycho-common`/`tycho-simulation`/`tycho-execution` stayed single-copy at 0.305.1. `cargo test -p base-intent-swap` (14/14) and `cargo clippy -p base-intent-swap --all-targets -- -D warnings` are both green. |
What this does
Adds an in-process intent-swap service to the Base builder. Signed orders arrive via a new
intent_submitOrderRPC, are solved immediately against committed AMM state overlaid with the in-progress block's executed transactions, and the signed settlement transaction is inserted into the builder's txpool for same-block inclusion. Settlement uses the existing Fusion resolver contracts; the solver engine isbackrunner(Tycho state + Fynd routing), consumed as a git dependency pinned tofeat/intent-solve-api@d62c89c.Structure (commits reviewable in order)
builder-core (isolated commits):
feat(builder-core): optional build-event stream from flashblocks payload builder— addsBuilderConfig.build_event_tx: Option<mpsc::Sender<BuildEvent>>(defaultNone) and four emit sites (IterationStart/TxExecutedwith receipt logs /IterationComplete/IterationAborted). Emission istry_send-only viaBuilderConfig::emit_build_event; a full channel drops the event with a warning and never stalls building. Zero behavior change when unset.test(builder-core): driver test for build-event stream sequence—tests/build_events.rsbuilds a block through the ChainDriver and asserts event order, tx-hash match, and a single shared payload id.new crate
base-intent-swap:intent_submitOrderRPC: shape + auction-window validation (no EIP-712 recovery — the LOP contract validates on-chain), distinct error codes incl. queue-full and engine-unavailable.Backrunner::solve_orders, signs with a configured EOA (redacted from allDebugoutput), inserts viaadd_external_transaction— the same path asbase_insertValidatedTransaction.BaseNodeExtension) + CLI arg group (--builder.intent-swap.*, disabled by default) +bin/builderwiring. With the flag off, builder behavior is unchanged.Build notes
Cargo.lockpinstycho-common/tycho-simulation/tycho-executionat 0.305.1 deliberately:fynd-coreat the pinned rev does not compile against 0.339.x. Regenerating the lockfile breaks the build.backrunner/builder-typesaressh://git dependencies — building requires GitHub SSH access. If cargo's libssh transport cannot reach your agent, setnet.git-fetch-with-cli = truein.cargo/config.toml(not committed).Testing
cargo test -p base-intent-swap— 9 tests (RPC validation paths, uuid derivation, EIP-1559 sign→decode_2718→recover roundtrip, Debug redaction)cargo test -p base-builder-core --test build_events— driver integration test-D warningsand rustfmt clean on all touched crates🤖 Generated with Claude Code