Rework Storage Program to accept multiple proofs per segment (#4319)
automerge
This commit is contained in:
@@ -23,6 +23,7 @@ use solana_sdk::genesis_block::GenesisBlock;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use solana_sdk::timing::timestamp;
|
||||
use solana_storage_api::SLOTS_PER_SEGMENT;
|
||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::mpsc::Receiver;
|
||||
@@ -44,7 +45,7 @@ impl Default for FullnodeConfig {
|
||||
// TODO: remove this, temporary parameter to configure
|
||||
// storage amount differently for test configurations
|
||||
// so tests don't take forever to run.
|
||||
const NUM_HASHES_FOR_STORAGE_ROTATE: u64 = 128;
|
||||
const NUM_HASHES_FOR_STORAGE_ROTATE: u64 = SLOTS_PER_SEGMENT;
|
||||
Self {
|
||||
sigverify_disabled: false,
|
||||
voting_disabled: false,
|
||||
|
@@ -400,13 +400,15 @@ impl StorageStage {
|
||||
) -> Result<()> {
|
||||
let timeout = Duration::new(1, 0);
|
||||
let slot: u64 = slot_receiver.recv_timeout(timeout)?;
|
||||
storage_state.write().unwrap().slot = slot;
|
||||
*slot_count += 1;
|
||||
// Todo check if any rooted slots were missed leading up to this one and bump slot count and process proofs for each missed root
|
||||
// Update the advertised blockhash to the latest root directly.
|
||||
|
||||
if let Ok(entries) = blocktree.get_slot_entries(slot, 0, None) {
|
||||
for entry in entries {
|
||||
for entry in &entries {
|
||||
// Go through the transactions, find proofs, and use them to update
|
||||
// the storage_keys with their signatures
|
||||
for tx in entry.transactions {
|
||||
for tx in &entry.transactions {
|
||||
for (i, program_id) in tx.message.program_ids().iter().enumerate() {
|
||||
if solana_storage_api::check_id(&program_id) {
|
||||
Self::process_storage_transaction(
|
||||
@@ -419,20 +421,22 @@ impl StorageStage {
|
||||
}
|
||||
}
|
||||
}
|
||||
if *slot_count % storage_rotate_count == 0 {
|
||||
debug!(
|
||||
"crosses sending at slot: {}! hashes: {}",
|
||||
slot, entry.num_hashes
|
||||
);
|
||||
Self::process_entry_crossing(
|
||||
&storage_keypair,
|
||||
&storage_state,
|
||||
&blocktree,
|
||||
entry.hash,
|
||||
slot,
|
||||
instruction_sender,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
if *slot_count % storage_rotate_count == 0 {
|
||||
// assume the last entry in the slot is the blockhash for that slot
|
||||
let entry_hash = entries.last().unwrap().hash;
|
||||
debug!(
|
||||
"crosses sending at root slot: {}! with last entry's hash {}",
|
||||
slot_count, entry_hash
|
||||
);
|
||||
Self::process_entry_crossing(
|
||||
&storage_keypair,
|
||||
&storage_state,
|
||||
&blocktree,
|
||||
entries.last().unwrap().hash,
|
||||
slot,
|
||||
instruction_sender,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
Reference in New Issue
Block a user