mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-01-12 16:15:17 +00:00
feat: Support faster PoRA specification
This commit is contained in:
parent
3024771fb1
commit
9fd6359681
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
Loading…
Reference in New Issue
Block a user