Skip to content

feat: return partial commitments for pending blocks#933

Open
MavenRain wants to merge 1 commit into
primev:mainfrom
MavenRain:feat/preconf-return-partial-commitments
Open

feat: return partial commitments for pending blocks#933
MavenRain wants to merge 1 commit into
primev:mainfrom
MavenRain:feat/preconf-return-partial-commitments

Conversation

@MavenRain

Copy link
Copy Markdown

What

Implements #732. mevcommit_getTransactionCommitments now returns the available subset of
commitments 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.AppendCommitment records each commitment as it arrives; store.StoreCommitments
    atomically replaces the set on a block change. store.StoreTransaction reconciles to the
    finalized set at settlement (delete-first), so a failed tx retains no commitments and no earlier
    block attempt unions into the final answer. commitments is now indexed by transaction_hash.
  • The bid loop persists commitments incrementally (best-effort; a store error is logged, never
    aborts bidding).
  • handleGetTxCommitments returns [] (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: AppendCommitment idempotency, StoreCommitments replace + empty no-op,
    StoreTransaction delete-first (success replaces, failure clears). Requires Docker
    (testcontainers).
  • sender_test: asserts bidding drives incremental persistence.

AI-assisted

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 <softwareengineerasaservant@isurvivable.cv>
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