backing-availability-audit: Move ErasureChunk Proof to BoundedVec (#3626)

* backing-availability-audit: Move ErasureChunk Proof to BoundedVec

* WIP

* Touch up

* Fix spelling mistake

* Address Feedback
This commit is contained in:
Lldenaurois
2021-08-24 12:50:33 -04:00
committed by GitHub
parent ec86d1d119
commit 9b45483cb1
11 changed files with 156 additions and 32 deletions
@@ -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) {
Ok(hash) => hash,
Err(e) => {
tracing::warn!(
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use std::collections::HashMap;
use std::{collections::HashMap, convert::TryFrom};
use parity_scale_codec::Encode;
@@ -29,7 +29,7 @@ use sc_network as network;
use sp_keyring::Sr25519Keyring;
use polkadot_node_network_protocol::request_response::{v1, Recipient};
use polkadot_node_primitives::{BlockData, PoV};
use polkadot_node_primitives::{BlockData, PoV, Proof};
use polkadot_primitives::v1::{CandidateHash, ValidatorIndex};
use super::*;
@@ -60,7 +60,7 @@ fn task_does_not_accept_invalid_chunk() {
Recipient::Authority(Sr25519Keyring::Alice.public().into()),
ChunkFetchingResponse::Chunk(v1::ChunkResponse {
chunk: vec![1, 2, 3],
proof: vec![vec![9, 8, 2], vec![2, 3, 4]],
proof: Proof::try_from(vec![vec![9, 8, 2], vec![2, 3, 4]]).unwrap(),
}),
);
m
@@ -170,7 +170,7 @@ fn task_stores_valid_chunk_if_there_is_one() {
Recipient::Authority(Sr25519Keyring::Charlie.public().into()),
ChunkFetchingResponse::Chunk(v1::ChunkResponse {
chunk: vec![1, 2, 3],
proof: vec![vec![9, 8, 2], vec![2, 3, 4]],
proof: Proof::try_from(vec![vec![9, 8, 2], vec![2, 3, 4]]).unwrap(),
}),
);