feat: bundle pending bids into a single multi-tx bid - #934
Open
MavenRain wants to merge 1 commit into
Open
Conversation
Bundle eligible pending transactions from different senders into one multi-transaction bid on the first bid attempt. The wire protocol already supports this: bidderapi.v1.Bid.raw_transactions is repeated and providers accept or reject a bid digest as a unit. - Eligibility: regular transactions with no constraint and no prior commitments; at least 2 eligible; at most 5 per bundle. - All-or-nothing dispatch: worker slots for the whole bundle are reserved before any goroutine starts, so a partial dispatch cannot re-queue a member that a live bundle bid still covers. - The leader sends one bid whose amount is the sum of the per-member costs. Each stored commitment copy carries its member share as BidAmount. Fast-tracked members are persisted by the leader and survive context cancellation. - A member dropped by a pre-check falls back to the solo path with its block attempt rolled back, so the retry is a true first attempt. If the bundle gets no full acceptance, every member falls back to the existing solo loop unchanged. - Storage: commitments primary key becomes (commitment_digest, transaction_hash) via an idempotent migration. - Settlement: subscriptions split comma-joined transaction_hashes; the tracker attributes amounts pro rata by stored shares, scoped to the digest covering the whole bundle. One split source per notification burst; shares sum exactly to the aggregate; the fallback is an equal split, never the full amount per member. - New flag --bundle-bids (env PRECONF_RPC_BUNDLE_BIDS, default true). Closes primev#728 Signed-off-by: Onyeka Obi <softwareengineerasaservant@isurvivable.cv>
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.
Closes #728.
This PR bundles eligible pending transactions from different senders into one multi-transaction bid on the first bid attempt in preconf-rpc. The bid protocol already supports this:
raw_transactionsis a repeated field and providers accept or reject a bid digest as a unit.What changes
BidAmount.commitmentstable primary key becomes(commitment_digest, transaction_hash)so one bid digest can map to more than one transaction. The migration is idempotent and safe to re-run.transaction_hashesfield and emit one message per hash. The settlement tracker attributes amounts pro rata by the stored shares. Share lookups are scoped to the digest that covers the whole bundle, with the newest dispatch timestamp as the tie-break. All members of one notification burst use one split source, and the member shares sum exactly to the aggregate amount. If shares are not available, the tracker falls back to an equal split, never to the full amount per member.--bundle-bids(envPRECONF_RPC_BUNDLE_BIDS, default true) turns bundling off if set to false.Design decisions open to change
Tests
Bidcall, distinct per-member costs, amount equals the exact sum, each commitment carries its own member's share.All tests pass with
-race.gofmt,go build, andgo vetare clean.🤖 Generated with Claude Code