feat: return partial commitments for pending blocks#933
Open
MavenRain wants to merge 1 commit into
Open
Conversation
mevcommit_getTransactionCommitments previously returned nothing until every provider committed or the transaction landed on-chain, because commitments were only persisted at finalization. Persist commitments as they arrive so the RPC can return the available subset while a block is still pending, letting DApps decide which providers they require a commitment from. - store: add AppendCommitment (incremental) and StoreCommitments (block-change replace); StoreTransaction now reconciles to the finalized set so a failed transaction retains no commitments; index commitments by transaction_hash. - sender: persist commitments as each one arrives during bidding. - handlers: return an empty array instead of an error when a transaction has no commitments yet. Closes primev#732 Signed-off-by: Onyeka Obi <[email protected]>
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.
What
Implements #732.
mevcommit_getTransactionCommitmentsnow returns the available subset ofcommitments for a still-pending block instead of only returning once every provider has committed
(or the tx is on-chain).
Why
Commitments were only written to the store at terminal finalization, so a partial set on a pending
block was invisible to the RPC (it returned an error). DApps that want to judge commitment
sufficiency for a pending tx could not see which providers had committed.
How
store.AppendCommitmentrecords each commitment as it arrives;store.StoreCommitmentsatomically replaces the set on a block change.
store.StoreTransactionreconciles to thefinalized set at settlement (delete-first), so a failed tx retains no commitments and no earlier
block attempt unions into the final answer.
commitmentsis now indexed bytransaction_hash.aborts bidding).
handleGetTxCommitmentsreturns[](not an error) for a tx with no commitments yet.While bidding, the stored set mirrors the sender's in-memory commitment set for the current block
attempt (the sender intentionally retains commitments across a block boundary until a new one
arrives).
Tests
store_test:AppendCommitmentidempotency,StoreCommitmentsreplace + empty no-op,StoreTransactiondelete-first (success replaces, failure clears). Requires Docker(testcontainers).
sender_test: asserts bidding drives incremental persistence.AI-assisted