feat: Support faster PoRA specification

This commit is contained in:
Bruno Valente 2024-12-26 16:28:24 +08:00
parent 3024771fb1
commit 9fd6359681
9 changed files with 20 additions and 15 deletions

View File

@ -5,7 +5,7 @@ pub const TB: usize = 1024 * GB;
pub const BYTES_PER_SECTOR: usize = 256;
pub const BYTES_PER_SEAL: usize = 4 * KB;
pub const BYTES_PER_SCRATCHPAD: usize = 64 * KB;
pub const BYTES_PER_SCRATCHPAD: usize = 16 * KB;
pub const BYTES_PER_LOAD: usize = 256 * KB;
pub const BYTES_PER_PRICING: usize = 8 * GB;
pub const BYTES_PER_MAX_MINING_RANGE: usize = 8 * TB;

View File

@ -4,6 +4,7 @@ use crate::{MineRangeConfig, PoraLoader};
use blake2::{Blake2b512, Digest};
use contract_interface::zgs_flow::MineContext;
use ethereum_types::{H256, U256};
use ethers::utils::keccak256;
use lighthouse_metrics::inc_counter;
use storage::log_store::MineLoadChunk;
use tiny_keccak::{Hasher, Keccak};
@ -148,7 +149,11 @@ impl<'a> Miner<'a> {
let mut scratch_pad =
[[0u8; BLAKE2B_OUTPUT_BYTES]; BYTES_PER_SCRATCHPAD / BLAKE2B_OUTPUT_BYTES];
for scratch_pad_cell in scratch_pad.iter_mut() {
digest = Blake2b512::new().chain_update(digest).finalize().into();
let output0 = keccak256(digest);
digest[..32].copy_from_slice(&output0);
let output1 = keccak256(digest);
digest[32..].copy_from_slice(&output1);
*scratch_pad_cell = digest;
}

View File

@ -1 +1 @@
30f0f921a80078e43d578c82b746677bcf06d786
bc826a18642023401040cf6dd4f2b10b0748075f

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long