Skip to content

feat(fynd-core): expose BlockStepController for gated block ingestion#243

Open
kayibal wants to merge 3 commits into
mainfrom
feat/block-step-controller
Open

feat(fynd-core): expose BlockStepController for gated block ingestion#243
kayibal wants to merge 3 commits into
mainfrom
feat/block-step-controller

Conversation

@kayibal

@kayibal kayibal commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds FyndBuilder::build_with_step_controller() — an async builder method that returns (Solver, BlockStepController). The Tycho feed runs in step-controlled mode: each incoming block is buffered and held until the caller calls controller.trigger_next_block().
  • Re-exports BlockStepController from fynd_core (alongside PendingBlockProcessor) so consumers don't need to import from tycho_simulation directly.
  • Adds SolverBuildError::StepControllerChannelClosed for the case where the feed task panics before delivering the controller.

The implementation follows the same pattern as build_with_pending: a oneshot channel delivers the BlockStepController from TychoFeed::run_with_step_controller back to the builder before the event loop starts.

Upstream: propeller-heads/tycho#1067 (merged).

Usage

let (solver, controller) = FyndBuilder::new(...)
    .algorithm("most_liquid")
    .build_with_step_controller()
    .await?;

// Peek at the next block before processing it
let block = controller.peek_next_block().await;

// Release it for the solvers
controller.trigger_next_block()?;

Dependency

Blocked on the next tycho-simulation release after 0.302.0 that includes BlockStepController. Once published:

  1. Update tycho-simulation = ">=<NEW_VERSION>" in Cargo.toml (workspace dependencies).
  2. Run cargo check --workspace to update Cargo.lock.
  3. CI will pass.

Test plan

  • Wait for next tycho-simulation crates.io release with BlockStepController
  • Update version constraint and verify cargo check --workspace passes
  • Run ./check.sh to confirm no regressions

🤖 Generated with Claude Code

kayibal and others added 3 commits June 5, 2026 11:01
Threads tycho-simulation's new BlockStepController (propeller-heads/tycho#1067)
through the Fynd solver pipeline so callers can pause block processing for
deterministic testing and controlled ingestion.

New API:
- `FyndBuilder::build_with_step_controller()` — async method returning `(Solver,
  BlockStepController)`. The feed runs in step-controlled mode: each block is
  buffered until the caller calls `trigger_next_block()`.
- `BlockStepController` is re-exported from `fynd_core` alongside `PendingBlockProcessor`.
- New `SolverBuildError::StepControllerChannelClosed` error variant.

Blocked on next tycho-simulation release after 0.302.0 that includes
BlockStepController. Once published, bump the workspace constraint and run
`cargo check --workspace` to update the lockfile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…port

tycho-simulation 0.305.0 and tycho-execution 0.305.0 are now published
with BlockStepController available in the evm::stream module. The 0.305.x
release changed the protocol stream return type to be !Unpin; fix all three
run* methods in TychoFeed to Box::pin the stream at construction so that
tokio::select! futures remain Unpin.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Combines PendingBlockProcessor and BlockStepController into a single
build method for callers that need both. Adds the corresponding
run_with_pending_and_step_controller feed method which calls
with_step_controller() on the builder before build_with_pending().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant