-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add persisted batch event validation #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: sergey/batch-nullify-filter-by-tree
Are you sure you want to change the base?
chore: add persisted batch event validation #40
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughAdds strict validation and sequencing checks to three batch persistence paths—append, nullify, and address append—in a single ingester module. Each path now enforces tree/range filters, exact expected counts, per-record field presence, sequential indices, and post-operation DB updates, failing early on any mismatch. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant I as Ingester
participant DB as Database
participant MT as MerkleTree
rect rgb(235, 245, 255)
note over I: Batch Append Flow (accounts)
I->>DB: Query accounts by tree + leaf range + InOutputQueue=true
DB-->>I: Records
I->>I: Validate expected_count, sequential LeafIndex, non-empty hashes
I->>MT: multi_append(leaf_nodes from accounts)
MT-->>I: Append result (new_next_index)
I->>DB: Update InOutputQueue=false for affected LeafIndex range
DB-->>I: Rows updated (must equal expected_count)
end
alt any validation/count mismatch
I-->>I: Fail early with error
end
sequenceDiagram
autonumber
participant I as Ingester
participant DB as Database
participant MT as MerkleTree
rect rgb(245, 235, 255)
note over I: Batch Nullify Flow (nullifiers)
I->>DB: Query by tree + NullifierQueueIndex range + Spent=true + NullifiedInTree=false + InOutputQueue=false
DB-->>I: Records
I->>I: Validate expected_count, sequential queue indices, non-null nullifiers
I->>MT: multi_append(leaf_nodes from hashed nullifiers)
MT-->>I: Append result
I->>DB: Set NullifierQueueIndex=NULL, NullifiedInTree=true
DB-->>I: Rows updated (must equal expected_count)
end
alt any validation/count mismatch
I-->>I: Fail early with error
end
sequenceDiagram
autonumber
participant I as Ingester
participant DB as Database
participant MT as MerkleTree
rect rgb(235, 255, 245)
note over I: Batch Address Append Flow (addresses)
I->>DB: Query by tree + Address QueueIndex range
DB-->>I: Records
I->>I: Validate expected_count, sequential queue indices, non-empty addresses
I->>MT: multi_append(leaf_nodes from addresses)
MT-->>I: Append result
I->>DB: Delete processed address rows by range + tree
DB-->>I: Rows deleted (must equal expected_count)
end
alt any validation/count mismatch
I-->>I: Fail early with error
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
…ounts and addresses
8c9347b
to
c14fb15
Compare
Summary by CodeRabbit