-
-
Notifications
You must be signed in to change notification settings - Fork 414
feat: signature verification for reqresp DA #8580
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
Conversation
| // TODO(fulu) not in use, remove? | ||
| export type ValidateColumnSidecarsProps = Pick< | ||
| FetchByRootAndValidateColumnsProps, | ||
| "config" | "peerMeta" | "blockRoot" | "missing" | ||
| > & { | ||
| slot: number; | ||
| blobCount: number; | ||
| needed?: fulu.DataColumnSidecars; | ||
| needToPublish?: fulu.DataColumnSidecars; | ||
| }; | ||
|
|
||
| // TODO(fulu) not in use, remove? |
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.
These were unused. Removed them instead of updating the inner function call for validation
Performance Report✔️ no performance regression detected Full benchmark results
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## unstable #8580 +/- ##
============================================
- Coverage 51.99% 51.96% -0.04%
============================================
Files 848 848
Lines 65857 65928 +71
Branches 4808 4814 +6
============================================
+ Hits 34242 34258 +16
- Misses 31547 31602 +55
Partials 68 68 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| if (chain !== null) { | ||
| const headState = await chain.getHeadState(); |
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.
I don't think this is correct, need to get block state (same as in gossip validation)
lodestar/packages/beacon-node/src/chain/validation/dataColumnSidecar.ts
Lines 105 to 106 in 5317389
| const blockState = await chain.regen | |
| .getBlockSlotState(parentRoot, blockHeader.slot, {dontTransferCache: true}, RegenCaller.validateGossipDataColumn) |
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.
No, not needed. Only thing that is used to calculate the signing root is the slot of the object being signed. Not sure why we use the state in gossip actually. I think just because it has the keys on the epochCtx
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.
I am pretty sure in some re-org scenario or when we validate sidecars from a different chain the pubkey2index could be different between the states
| pubkey: epochCtx.index2pubkey[signedBlockHeader.message.proposerIndex], |
this seems unlikely but we also use the state slot to compute the domain which can very likely be wrong around fork boundary if we always use the head state
| const stateForkInfo = chainForkConfig.getForkInfo(stateSlot); |
@twoeths should probably double check this
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.
The validator/proposer indices changes based on slot-root but the key cache does not to my knowledge
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.
agree with @nflaig that we need to use the state of parent root dialing to block header slot
the context is the same to gossip, we need to use a state of the same "view/branch" of the message to handle reorg scenario. We dial to block header slot to handle fork boundary
| const stateForkInfo = chainForkConfig.getForkInfo(stateSlot); |
using head state is mostly correct for stable network condition but it does not work all the time, and there is no advantage doing that except for more concise code so let's just not use it
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.
Its not possible with byRoot code is why I switched it. The state transition has not been run yet, thus there is no state cached, when we attempt to verify the signature. But sending the blocks for validation (partial but not has_all_data will need to happen before the full block input goes through the process pipeline
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.
Its not possible with byRoot code is why I switched it. The state transition has not been run yet, thus there is no state cached, when we attempt to verify the signature.
it works on gossip, why wouldn't it work here?
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.
we need state of parent dialing to block slot (not the state of block itself) so should be able to do that
packages/beacon-node/src/chain/errors/dataColumnSidecarError.ts
Outdated
Show resolved
Hide resolved
packages/beacon-node/src/chain/errors/dataColumnSidecarError.ts
Outdated
Show resolved
Hide resolved
packages/beacon-node/src/chain/errors/dataColumnSidecarError.ts
Outdated
Show resolved
Hide resolved
nflaig
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.
LGTM
|
/gemini review |
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.
Code Review
This pull request introduces signature verification for blob and data column sidecars received over req/resp, aligning with upcoming specification changes. The implementation is well-structured, adding new signature set creation functions and passing the IBeaconChain instance to validation functions where BLS verification is necessary. A key improvement is the more robust validation of sidecars by comparing the full SignedBeaconBlockHeader. The use of an optional chain parameter in validation functions is a good design choice, allowing control over when signature verification is performed, which is particularly useful for testing and historical sync scenarios. My feedback includes a couple of suggestions to improve parameter naming in packages/state-transition/src/signatureSets/proposer.ts for better code clarity and maintainability.
|
🎉 This PR is included in v1.36.0 🎉 |
Motivation
Spec will be updated to have check of signatures via reqresp. Proacative fix inline with Lighthouse and Prysm
sigp/lighthouse#7650