Skip to content

BM-3002: Broker Backend Service#2004

Draft
capossele wants to merge 95 commits into
mainfrom
angelo/backend-service-mvp
Draft

BM-3002: Broker Backend Service#2004
capossele wants to merge 95 commits into
mainfrom
angelo/backend-service-mvp

Conversation

@capossele
Copy link
Copy Markdown
Contributor

Introduces a broker-side backend abstraction and router so order processing, cancellation, batching, and fulfillment artifact construction are dispatched by verifier selector/backend id instead of being hardwired directly into the broker services.

@github-actions github-actions Bot changed the title Broker Backend Service BM-3002: Broker Backend Service May 19, 2026
@linear
Copy link
Copy Markdown

linear Bot commented May 19, 2026

BM-3002

Copy link
Copy Markdown
Contributor

@jonastheis jonastheis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The direction looks great. However I have a bunch of questions that I marked inline.

High-level I think what is unclear to me are mostly the following:

  • Prover trait and usage of it (it still contains risc0 types)
  • how does Backend relate to OrderPricingContext and RequestEvaluator?
  • why does OrderPricer not use BackendRouter but instead implements OrderPricingContext?
  • risc0 types are not yet contained to a single crate

I haven't really looked at the submitter and batcher yet.

}
}

macro_rules! string_id {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't we use this for BackendId?

Failed(OrderFulfillmentFailure),
}

pub struct SubmissionPlan {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain how this translates to a JointVerifier or the OnchainAssessor?

Comment thread crates/broker/src/backend/types.rs Outdated
Comment on lines +405 to +410
async fn estimate_batch_size(&self, cmd: BatchSizeEstimateRequest)
-> Result<BatchSizeEstimate>;

async fn update_batch(&self, cmd: UpdateBatch) -> Result<BatchUpdate>;

async fn close_batch(&self, cmd: CloseBatch) -> Result<BatchClose, BackendError>;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think either pub trait Backend: BatchProcessor + Send + Sync {

or better

fn batch_processor(&self) -> Result<BatchProcessorObj>;

as this keeps the Backend trait cleaner in case a backend doesn't support batching

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this in the general crate? shouldn't this have its own crate and be split in a few files maybe?

Comment thread crates/broker/src/backend/risc0.rs Outdated
}

fn supported_selectors(&self) -> Vec<FixedBytes<4>> {
SupportedSelectors::default().selectors.keys().copied().collect()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should name the selectors explicitly here to avoid any accidental issues

fn build_provers(&self, config: &ConfigLock) -> Result<(ProverObj, ProverObj)> {
let prover: ProverObj;
let aggregation_prover: ProverObj;
let batch_prover: ProverObj;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the Prover trait from crates/boundless-market/src/prover_utils/prover.rs still used? It still contains risc0 specific types

Comment thread crates/broker/src/broker.rs Outdated
chain_span.clone(),
);

let risc0_backend_id = BackendId::new("risc0_v3")?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the backend impl should name its own BackendId

Comment thread crates/broker/src/broker.rs Outdated
let risc0_backend = Arc::new(
Risc0Backend::new(
risc0_backend_id.clone(),
prover.clone(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the backend own the prover and expose it only if necessary?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand why OrderPricer still implements OrderPricingContext carries a prover and supported_selectors? Shouldn't this all go through the backend?

}
}

impl<P> Risc0RequestEvaluatorContext for OrderPricer<P>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we have again some risc0 types?

@capossele capossele force-pushed the angelo/backend-service-mvp branch from 6b35ec1 to 97b965d Compare May 22, 2026 12:34
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.

2 participants