Fix for #7305: Verify blobs and data columns during backfill#7353
Fix for #7305: Verify blobs and data columns during backfill#7353SunnysidedJ wants to merge 5 commits intosigp:unstablefrom
Conversation
|
Currently under debugging its test case. The test is: However, the test does not run properly when Deneb or Fulu is enabled, e.g. FORK_NAME=deneb cargo test weak_subjectivity_sync --features "fork_from_env". |
| (block_root, block, blob_data) | ||
| } | ||
|
|
||
| /// Only used for testing |
There was a problem hiding this comment.
Removed as it is no longer called in testing (moved to RpcBlock)
| // Verify that blobs or data columns signatures match | ||
| let sig_timer = metrics::start_timer(&metrics::BACKFILL_SIGNATURE_TOTAL_TIMES); | ||
| let setup_timer = metrics::start_timer(&metrics::BACKFILL_SIGNATURE_SETUP_TIMES); | ||
| // TODO: this logic is redundant with one from range sync. Do we have a good place to make |
There was a problem hiding this comment.
Maybe move it inside of verify_kzg_for_rpc_blocks?
There was a problem hiding this comment.
Sorry, forgot to integrate this. Let me do it tomorrow!
| } | ||
|
|
||
| impl<T: BeaconChainTypes> BeaconChain<T> { | ||
| fn verify_blobs_and_data_columns( |
There was a problem hiding this comment.
pulled out verification parts as import_historical_block_batch() has become too long
|
Status: Ready for review.
|
|
Hey @dapplion, I much liked your implementation from #7352, where you've used existing functions I wasn't aware of and also made helper functions that share the same logics between range sync. I tried to minimize the conflicts I hope this is okay with you. Please let me know for any comments! There're a few parts that I changed from yours.
I haven't made any changes to the range sync verification as it wasn't scope of the issue (I would've done it if I was aware of) and thought it would create more conflicts between your PR. |
| // Verify that blobs or data columns signatures match | ||
| let sig_timer = metrics::start_timer(&metrics::BACKFILL_SIGNATURE_TOTAL_TIMES); | ||
| let setup_timer = metrics::start_timer(&metrics::BACKFILL_SIGNATURE_SETUP_TIMES); | ||
| // TODO: this logic is redundant with one from range sync. Do we have a good place to make |
There was a problem hiding this comment.
Maybe move it inside of verify_kzg_for_rpc_blocks?
| drop(verify_timer); | ||
| drop(sig_timer); | ||
| // Verify signatures in a batch. | ||
| self.verify_available_block_signatures(&signed_blocks)?; |
There was a problem hiding this comment.
Order of ops should be:
- verify block signatures
- match block and sidecar headers
- verify kzg proofs
To do proper scoring later
| | HistoricalBlockError::InvalidDataColumnsSignature(_) | ||
| | HistoricalBlockError::Unexpected(_) | ||
| | HistoricalBlockError::AvailabilityCheckError(_) => { | ||
| warn!( |
There was a problem hiding this comment.
Only internal errors should be a warn, peers can send invalid objects and users can't do anything about it.
| let full_store = get_store(&temp1); | ||
|
|
||
| let is_deneb = full_store.get_chain_spec().deneb_fork_epoch.is_some(); | ||
| let is_fulu = full_store.get_chain_spec().is_peer_das_scheduled(); |
There was a problem hiding this comment.
ForkName::fulu_enabled()
| let temp1 = tempdir().unwrap(); | ||
| let full_store = get_store(&temp1); | ||
|
|
||
| let is_deneb = full_store.get_chain_spec().deneb_fork_epoch.is_some(); |
There was a problem hiding this comment.
Use ForkName::deneb_enabled()
There was a problem hiding this comment.
The way I think I can use is something like fork_name_at_slot::(Slot::new(0)). I can see that it is safer to use ForkName than ChainSpec (that it checks previous forks are enabled), but I'm not sure it is cleaner here, and all others are using this format.
| false | ||
| } | ||
| }) | ||
| .unwrap(); |
There was a problem hiding this comment.
Why do you need to find this position? Just setup the rpc_blocks such that the first block always has data
There was a problem hiding this comment.
Then, we might get to test non-first index as well!
|
Restructured backfill importing such that
|
|
@dapplion could you review the PR? |
|
We are focusing on merging #7352 first, will port the remaining diff from here later |
|
This is quite outdated and a lot of the code touched in this PR has changed. Closing this and we'll address this separately. |
Issue Addressed
#7305: Verify blobs and data columns during backfill
Proposed Changes
Compare signatures (equality check) for blob and data column sidecars
Then, validate KZG commitments as described in the issue.
Additional Info
This will be further compared and leveraged with #7352 as some parts of this issue is also covered as part of the issue it is fixing. So, WIP and will let you know once it is ready under the comments.