-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[qs] Introduce BatchV2 #18085
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
[qs] Introduce BatchV2 #18085
Conversation
4e6435b to
e1a91cd
Compare
d3049aa to
52f3018
Compare
e1a91cd to
c07419d
Compare
52f3018 to
251c641
Compare
c07419d to
eec8298
Compare
251c641 to
a094eaf
Compare
eec8298 to
ea4f27e
Compare
f2dbced to
9244123
Compare
JoshLind
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me 😄
9244123 to
397fd1c
Compare
ea4f27e to
4f27983
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
8a0a608 to
ad4e2c2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on December 7
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| let batch: Batch<BatchInfoExt> = value.try_into().unwrap(); | ||
| let batch: Batch<BatchInfo> = batch | ||
| .try_into() | ||
| .expect("Batch retieval requests must be for V1 batch"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Batch retrieval panics when serving V2 batches
The batch retrieval handler unconditionally attempts to convert Batch<BatchInfoExt> to Batch<BatchInfo> via try_into().expect(), which panics for V2 batches. The batch store now contains both V1 and V2 batches (as PersistedValue<BatchInfoExt>), and a BatchResponse::BatchV2 variant exists for V2 responses. However, when a retrieval request arrives for a V2 batch's digest, the code panics instead of either returning BatchV2 or gracefully handling the incompatibility. This could crash nodes when enable_batch_v2 is enabled and another node requests a V2 batch via the legacy retrieval mechanism.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ad4e2c2 to
0c49bf4
Compare
| if !batch_info.is_v2() { | ||
| self.generate_signed_batch_info(batch_info.info().clone()) | ||
| .ok() | ||
| .map(|inner| inner.into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Signature verification fails due to type conversion mismatch
For V1 batches, generate_signed_batch_info(batch_info.info().clone()) creates a signature over BatchInfo, then .map(|inner| inner.into()) converts the result to SignedBatchInfo<BatchInfoExt> by wrapping the info in BatchInfoExt::V1. However, the signature remains unchanged. When verification occurs via optimistic_verify(self.signer, &self.info, &self.signature), it hashes BatchInfoExt::V1{info: BatchInfo} which has a different BCS serialization than BatchInfo (enum discriminator byte is prepended). This causes signature verification to fail because the signed data doesn't match the verified data. The PR author acknowledged this issue in the discussion.
Additional Locations (1)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|

Description
This PR introduces support for BatchV2 in QuorumStore, enabling batches to carry additional metadata (such as batch kind) while maintaining full backward compatibility with BatchV1. The implementation uses
BatchInfoExtas a unified type that can represent both V1 and V2 batches, and adds new network message types to handle V2 batches. Sending BatchV2 is configured via a local Quorum Store Config flag.BatchMsg and related QS messages are used to handle BatchInfo or BatchInfoExt::V1 batches normally. BatchMsgV2 and other V2 messages verify that BatchInfoExt::V2 is used. This is to simplify handling of different message types on the receiver.