-
Notifications
You must be signed in to change notification settings - Fork 877
Fix for #7305: Verify blobs and data columns during backfill #7353
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: unstable
Are you sure you want to change the base?
Fix for #7305: Verify blobs and data columns during backfill #7353
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". |
@@ -783,23 +783,6 @@ impl<E: EthSpec> AvailableBlock<E> { | |||
} = self; | |||
(block_root, block, blob_data) | |||
} | |||
|
|||
/// Only used for testing |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Maybe move it inside of verify_kzg_for_rpc_blocks
?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only internal errors should be a warn, peers can send invalid objects and users can't do anything about it.
@@ -2279,6 +2279,9 @@ async fn weak_subjectivity_sync_test(slots: Vec<Slot>, checkpoint_slot: Slot) { | |||
let temp1 = tempdir().unwrap(); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ForkName::fulu_enabled()
@@ -2279,6 +2279,9 @@ async fn weak_subjectivity_sync_test(slots: Vec<Slot>, checkpoint_slot: Slot) { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ForkName::deneb_enabled()
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.