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
@@ -301,9 +301,11 @@ impl RequestChunksPhase {
let validator_index = chunk.index;
if let Ok(anticipated_hash) =
branch_hash(&params.erasure_root, &chunk.proof, chunk.index.0 as usize)
{
if let Ok(anticipated_hash) = branch_hash(
&params.erasure_root,
&chunk.proof_as_vec(),
chunk.index.0 as usize,
) {
let erasure_chunk_hash = BlakeTwo256::hash(&chunk.chunk);
if erasure_chunk_hash != anticipated_hash {
@@ -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::{sync::Arc, time::Duration};
use std::{convert::TryFrom, sync::Arc, time::Duration};
use assert_matches::assert_matches;
use futures::{executor, future};
@@ -28,7 +28,7 @@ use super::*;
use sc_network::config::RequestResponseConfig;
use polkadot_erasure_coding::{branches, obtain_chunks_v1 as obtain_chunks};
use polkadot_node_primitives::{BlockData, PoV};
use polkadot_node_primitives::{BlockData, PoV, Proof};
use polkadot_node_subsystem_util::TimeoutExt;
use polkadot_primitives::v1::{AuthorityDiscoveryId, HeadData, PersistedValidationData};
use polkadot_subsystem::{
@@ -371,7 +371,7 @@ fn derive_erasure_chunks_with_proofs_and_root(
.map(|(index, (proof, chunk))| ErasureChunk {
chunk: chunk.to_vec(),
index: ValidatorIndex(index as _),
proof,
proof: Proof::try_from(proof).unwrap(),
})
.collect::<Vec<ErasureChunk>>();