Skip to content

BM-1843: add expected probability for secondary fulfillment, calculate and convert total reward and prioritize#1633

Merged
jonastheis merged 74 commits intomainfrom
jonas/bm-1843-compute-expected-value-of-winning-proof-race-for-secondary
Feb 24, 2026
Merged

BM-1843: add expected probability for secondary fulfillment, calculate and convert total reward and prioritize#1633
jonastheis merged 74 commits intomainfrom
jonas/bm-1843-compute-expected-value-of-winning-proof-race-for-secondary

Conversation

@jonastheis
Copy link
Contributor

@jonastheis jonastheis commented Feb 12, 2026

  • Adds a configurable expected_probability_win_secondary_fulfillment parameter (0-any), code default 50%) that scales the expected reward of secondary (lock-expired) orders by the probability of winning the proof race
  • Removes the redundant min_mcycle_price_collateral_token config. min_mcycle_price is now dynamically converted to ZKC via the price oracle for secondary order evaluation
  • Unifies primary (lock and fulfill) and secondary order prioritization into a single sort by converting all (discounted) rewards to ETH, so high-value secondary orders can rank above low-value primary orders
  • Applies a random factor (0.2x–1.0x) to secondary order sort keys to spread provers across different orders and prevent all provers starting to compete in the same proof race if there's a secondary order with a high collateral value
  • Internal/production provers use expected_probability_win_secondary_fulfillment = 100 (no discount), since we want aggressive secondary fulfillment. The broker template and generate-config command recommends 50% for external provers.

@jonastheis jonastheis changed the base branch from jonas/bm-1842-make-eth-and-zkc-dynamically-priced-by-usd to main February 17, 2026 05:09
@github-actions github-actions bot changed the title add expected probability for secondary fulfillment, calculate and convert total reward and prioritize BM-1843: add expected probability for secondary fulfillment, calculate and convert total reward and prioritize Feb 17, 2026
@jonastheis jonastheis changed the base branch from main to jonas/bm-1842-make-eth-and-zkc-dynamically-priced-by-usd February 17, 2026 05:14
Base automatically changed from jonas/bm-1842-make-eth-and-zkc-dynamically-priced-by-usd to main February 17, 2026 12:01
Copy link
Contributor

@capossele capossele left a comment

Choose a reason for hiding this comment

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

Approved, just noting that the breaking config change should be called out in release notes.

Copy link
Contributor

@willpote willpote left a comment

Choose a reason for hiding this comment

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

This looks good!

One thought is that we are making a few number decisions based on intuition in this change, specifically 50% default and the 20%-100% adjustment factor.

I think this is good as getting something to prod and observing how it performs will ultimately give us the best data, but I'm not confident we have the logs/metrics to evaluate it.

I think we want a way to see how secondary fulfillment orders are being ranked/adjusted, just so that we can get a sense if 50% is too aggressive/not aggressive enough, or that 20% penalty isn't too steep etc.

Tricky thing is being able to do this without spamming the logs, will leave it to you to come up with something clever :D

@@ -1,7 +1,7 @@
[market]
min_mcycle_price = "0.000000025"
expected_probability_win_secondary_fulfillment = 100 # assume we win all secondary fulfillments -> min_mcycle_price is used to judge whether to accept a request or not
Copy link
Contributor

Choose a reason for hiding this comment

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

I actually think we should leave this at the default for 'nightly'. Intention with nightly is that it runs a very default/vanilla config, similar to what a new prover would run if just using the defaults, so we can test how the defaults perform in the wild

Aligned to make it 100 for the release cluster though!

@@ -1,7 +1,7 @@
[market]
min_mcycle_price = "0.000000025"
expected_probability_win_secondary_fulfillment = 100 # assume we win all secondary fulfillments -> min_mcycle_price is used to judge whether to accept a request or not
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to go > 100? With this cluster, given its intention is to backstop, it would be good to have it always prioritize secondaries asap

@jonastheis jonastheis merged commit 3a58491 into main Feb 24, 2026
48 of 50 checks passed
@jonastheis jonastheis deleted the jonas/bm-1843-compute-expected-value-of-winning-proof-race-for-secondary branch February 24, 2026 06:41
willpote pushed a commit that referenced this pull request Feb 25, 2026
…e and convert total reward and prioritize (#1633)

- Adds a configurable `expected_probability_win_secondary_fulfillment
parameter` (0-any), code default 50%) that scales the expected reward of
secondary (lock-expired) orders by the probability of winning the proof
race
- Removes the redundant `min_mcycle_price_collateral_token` config.
`min_mcycle_price` is now dynamically converted to ZKC via the price
oracle for secondary order evaluation
- Unifies primary (lock and fulfill) and secondary order prioritization
into a single sort by converting all (discounted) rewards to ETH, so
high-value secondary orders can rank above low-value primary orders
- Applies a random factor (0.2x–1.0x) to secondary order sort keys to
spread provers across different orders and prevent all provers starting
to compete in the same proof race if there's a secondary order with a
high collateral value
- Internal/production provers use
`expected_probability_win_secondary_fulfillment = 100` (no discount),
since we want aggressive secondary fulfillment. The broker template and
`generate-config` command recommends 50% for external provers.
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.

3 participants