feat: live pAMM state-override stream integration (scaffold)#1106
Draft
zizou0x wants to merge 1 commit into
Draft
feat: live pAMM state-override stream integration (scaffold)#1106zizou0x wants to merge 1 commit into
zizou0x wants to merge 1 commit into
Conversation
Add a generic, protocol-agnostic layer in tycho-simulation that injects live per-block VM storage overrides and block environment into pAMM pools (e.g. FermiSwap) sourced from the Titan pAMM stream. - overrides.rs: StateOverrideProvider trait, OverrideSnapshot, and attach_live_overrides helper (downcasts EVMPoolState and wires a live watch channel into the pool). - EVMPoolState: read-through live overrides at simulation time via a watch receiver; storage and block env now prefer the live snapshot. - decoder: attaches each provider's channel to matching venue pools. - stream builder: default-on auto-registration of the Titan provider with without_titan_overrides() opt-out and with_override_provider() for custom sources. The Titan WebSocket client bodies (spawn/parse/timestamp resolution) are todo!() and land in a follow-up. Co-Authored-By: Claude Opus 4.7 <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.
Summary
Scaffolds a generic, protocol-agnostic layer in
tycho-simulationthat injects live per-block VM storage overrides and block environment into pAMM pools (e.g. FermiSwap), sourced from the Titan pAMM stream. Consumers keep usingProtocolStreamBuilderunchanged; overrides are on by default with an opt-out.Jira: ENG-6118
How it works
watchchannel ofOverrideSnapshots per protocol.EVMPoolStatefor a served venue holds the receiver and reads the freshest snapshot at simulation time (get_amount_out/get_limits), so sub-block updates are reflected without a Tycho block update.Changes
evm/overrides.rs(new):StateOverrideProvidertrait,OverrideSnapshot,attach_live_overrideshelper.evm/protocol/vm/state.rs: live read-through onEVMPoolState(live_overridesfield,set_live_overrides, live-awareget_overwritesandeffective_block_overrides).evm/decoder.rs: attaches each registered provider's channel to matching venue pools during decode.evm/stream.rs: default-on auto-registration of the Titan provider, withwithout_titan_overrides()opt-out andwith_override_provider()/titan_url().evm/titan.rs(new):TitanProviderimplementing the trait; WebSocket client bodies aretodo!().Status
Draft / WIP. The Titan WebSocket client (
spawn,parse_message,max_lane_timestamp,venue_for_protocol) is stubbed withtodo!()and lands in a follow-up. Compiles under--all-featuresand--no-default-features --features evm; clippy clean.Test plan
TitanProviderWS client and un-ignore provider tests