feat(sequencer): add persistent transaction receipt system#442
Open
paschal533 wants to merge 9 commits intologos-blockchain:mainfrom
Open
feat(sequencer): add persistent transaction receipt system#442paschal533 wants to merge 9 commits intologos-blockchain:mainfrom
paschal533 wants to merge 9 commits intologos-blockchain:mainfrom
Conversation
4 tasks
…ationError Replace panicking .expect() calls in send_transaction with proper error propagation using TransactionMalformationError variants. Unify the size error to use TransactionMalformationError::TransactionTooLarge instead of a raw format string. Add unit tests for too-large and valid transaction paths.
Registers the new rejected-transaction column family in RocksDB, and exposes rejected_tx_column, put_rejected_tx, and get_rejected_tx on RocksDBIO for storing and retrieving RejectedTxRecord by hash.
…tx to SequencerStore
…roduction failure
…ulate block timestamp Restructure get_transaction_receipt to scope the sequencer lock to a block expression, collect a terminal receipt (Rejected/Included) under the lock, release the lock, then lazily remove the hash from pending_txs before returning. This fixes two related issues: - pending_txs grew without bound because insert() in send_transaction had no corresponding remove() when TXs were confirmed or rejected - a TX that had been included could still appear as Pending if the caller never queried its receipt Also populate timestamp_ms for Included receipts by fetching the block from the store (an additional DB read already cached by RocksDB's block cache), replacing the previous None placeholder. Lock ordering is preserved: sequencer lock is always released before pending_txs is acquired, matching the order in send_transaction.
2dea38d to
58853c5
Compare
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.
Summary
Adds a
get_transaction_receiptRPC method that answers the question "what happened to the transaction I submitted?" with a structured, typed response rather than the currentnull-returningget_transaction.The four-tier lookup gives callers the exact status of any hash they have ever submitted, even across sequencer restarts:
send_transactionthat have not yet reached a terminal state.Receipt entries in the pending set are lazily evicted when the receipt is
first queried for a terminal-state transaction, bounding memory growth for
any transaction that callers actually follow up on.
Changes
common/src/receipt.rs(new),TxStatus,TxReceipt,RejectedTxRecordtypes with Borsh and serde derivations.common/src/lib.rs, exposepub mod receipt.storage/src/sequencer/mod.rs, newcf_rejected_txcolumn family,put_rejected_txandget_rejected_txmethods.sequencer/core/src/block_store.rs,store_rejected_tx,get_rejected_tx, andget_block_id_for_txmethods.sequencer/core/src/lib.rs, when a transaction fails validation during block production the rejection is now persisted to RocksDB instead of being silently dropped.sequencer/service/src/service.rs,pending_txstracking field,get_transaction_receiptimplementation, lazy pending set eviction.sequencer/service/rpc/src/lib.rsandsequencer/service/protocol/src/lib.rs, RPC trait method and protocol type exports.Stacking note
This PR builds on top of #441 (crash fix). The diff against main will include those commits too; the meaningful change in this PR starts at the
feat(common): add TxStatuscommit.Test plan
cargo test -p common, Borsh and serde roundtrip tests for receipt typescargo test -p sequencer_service get_receipt, receipt lifecycle tests: pending after submit, unknown for unseen hash