adds hash domain to merkle shreds (#29339)
This commit is contained in:
parent
cf0a149add
commit
06bb71c79f
|
@ -41,8 +41,10 @@ const_assert_eq!(ShredData::SIZE_OF_PAYLOAD, 1203);
|
|||
|
||||
// Defense against second preimage attack:
|
||||
// https://en.wikipedia.org/wiki/Merkle_tree#Second_preimage_attack
|
||||
const MERKLE_HASH_PREFIX_LEAF: &[u8] = &[0x00];
|
||||
const MERKLE_HASH_PREFIX_NODE: &[u8] = &[0x01];
|
||||
// Following Certificate Transparency, 0x00 and 0x01 bytes are prepended to
|
||||
// hash data when computing leaf and internal node hashes respectively.
|
||||
const MERKLE_HASH_PREFIX_LEAF: &[u8] = b"\x00SOLANA_MERKLE_SHREDS_LEAF";
|
||||
const MERKLE_HASH_PREFIX_NODE: &[u8] = b"\x01SOLANA_MERKLE_SHREDS_NODE";
|
||||
|
||||
type MerkleProofEntry = [u8; 20];
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use {
|
|||
lru::LruCache,
|
||||
rayon::{prelude::*, ThreadPool},
|
||||
reed_solomon_erasure::{
|
||||
galois_8::Field,
|
||||
galois_8::ReedSolomon,
|
||||
Error::{InvalidIndex, TooFewDataShards, TooFewShardsPresent},
|
||||
},
|
||||
solana_entry::entry::Entry,
|
||||
|
@ -38,8 +38,6 @@ pub(crate) const ERASURE_BATCH_SIZE: [usize; 33] = [
|
|||
55, 56, 58, 59, 60, 62, 63, 64, // 32
|
||||
];
|
||||
|
||||
type ReedSolomon = reed_solomon_erasure::ReedSolomon<Field>;
|
||||
|
||||
pub struct ReedSolomonCache(
|
||||
Mutex<LruCache<(/*data_shards:*/ usize, /*parity_shards:*/ usize), Arc<ReedSolomon>>>,
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue