-
Notifications
You must be signed in to change notification settings - Fork 1.6k
backing-availability-audit: Move ErasureChunk Proof to BoundedVec #3626
Changes from all commits
576c48f
0edfca9
960ecf1
e35d65e
bc7a996
7b7bd4b
f442c43
5a4ad8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,13 @@ | |
|
||
use super::*; | ||
|
||
use std::convert::TryFrom; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since there's no use of this trait anywhere (it seems), I believe it may be incorrect to implement the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How would it be incorrect? |
||
|
||
use assert_matches::assert_matches; | ||
use futures::{channel::oneshot, executor, future, Future}; | ||
|
||
use parking_lot::Mutex; | ||
use polkadot_node_primitives::{AvailableData, BlockData, PoV}; | ||
use polkadot_node_primitives::{AvailableData, BlockData, PoV, Proof}; | ||
use polkadot_node_subsystem_test_helpers as test_helpers; | ||
use polkadot_node_subsystem_util::TimeoutExt; | ||
use polkadot_primitives::v1::{ | ||
|
@@ -287,7 +289,7 @@ fn store_chunk_works() { | |
let chunk = ErasureChunk { | ||
chunk: vec![1, 2, 3], | ||
index: validator_index, | ||
proof: vec![vec![3, 4, 5]], | ||
proof: Proof::try_from(vec![vec![3, 4, 5]]).unwrap(), | ||
}; | ||
|
||
// Ensure an entry already exists. In reality this would come from watching | ||
|
@@ -333,7 +335,7 @@ fn store_chunk_does_nothing_if_no_entry_already() { | |
let chunk = ErasureChunk { | ||
chunk: vec![1, 2, 3], | ||
index: validator_index, | ||
proof: vec![vec![3, 4, 5]], | ||
proof: Proof::try_from(vec![vec![3, 4, 5]]).unwrap(), | ||
}; | ||
|
||
let (tx, rx) = oneshot::channel(); | ||
|
@@ -441,8 +443,11 @@ fn store_block_works() { | |
let mut branches = erasure::branches(chunks.as_ref()); | ||
|
||
let branch = branches.nth(5).unwrap(); | ||
let expected_chunk = | ||
ErasureChunk { chunk: branch.1.to_vec(), index: ValidatorIndex(5), proof: branch.0 }; | ||
let expected_chunk = ErasureChunk { | ||
chunk: branch.1.to_vec(), | ||
index: ValidatorIndex(5), | ||
proof: Proof::try_from(branch.0).unwrap(), | ||
}; | ||
|
||
assert_eq!(chunk, expected_chunk); | ||
virtual_overseer | ||
|
@@ -545,7 +550,7 @@ fn query_all_chunks_works() { | |
let chunk = ErasureChunk { | ||
chunk: vec![1, 2, 3], | ||
index: ValidatorIndex(1), | ||
proof: vec![vec![3, 4, 5]], | ||
proof: Proof::try_from(vec![vec![3, 4, 5]]).unwrap(), | ||
}; | ||
|
||
let (tx, rx) = oneshot::channel(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -363,7 +363,7 @@ impl RunningTask { | |
|
||
fn validate_chunk(&self, validator: &AuthorityDiscoveryId, chunk: &ErasureChunk) -> bool { | ||
let anticipated_hash = | ||
match branch_hash(&self.erasure_root, &chunk.proof, chunk.index.0 as usize) { | ||
match branch_hash(&self.erasure_root, &chunk.proof_as_vec(), chunk.index.0 as usize) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't we fix |
||
Ok(hash) => hash, | ||
Err(e) => { | ||
tracing::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.
Not sure it is the right behavior to just let the iterator end if the
Proof
could not be constructed. Can this even happen, without the code having a logic error?