Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions blockprod/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ async-trait.workspace = true
hex.workspace = true
futures.workspace = true
jsonrpsee = { workspace = true, features = ["macros"] }
itertools.workspace = true
mockall.workspace = true
parity-scale-codec.workspace = true
rayon.workspace = true
slave-pool.workspace = true
serde = { workspace = true, features = ["derive"] }
thiserror.workspace = true
Expand Down
33 changes: 29 additions & 4 deletions blockprod/src/detail/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// limitations under the License.

pub mod job_manager;
pub mod timestamp_searcher;
pub mod utils;

use std::{
Expand All @@ -38,7 +39,7 @@ use common::{
};
use consensus::{
generate_consensus_data_and_reward, FinalizeBlockInputData, GenerateBlockInputData,
PoSFinalizeBlockInputData, PoSGenerateBlockInputData,
PoSFinalizeBlockInputData, PoSGenerateBlockInputData, PoSTimestampSearchInputData,
};
use crypto::ephemeral_e2e::{self, EndToEndPrivateKey};
use logging::log;
Expand All @@ -61,9 +62,13 @@ use crate::{
BlockProductionError,
};

use self::utils::{
get_best_block_index, get_pool_balances_at_height, get_pool_staker_balance,
get_pool_total_balance, get_sealed_epoch_randomness, make_ancestor_getter, timestamp_add_secs,
use self::{
timestamp_searcher::TimestampSearchData,
utils::{
get_best_block_index, get_pool_balances_at_height, get_pool_staker_balance,
get_pool_total_balance, get_sealed_epoch_randomness, make_ancestor_getter,
timestamp_add_secs,
},
};

pub const JOBKEY_DEFAULT_LEN: usize = 32;
Expand Down Expand Up @@ -583,6 +588,26 @@ impl BlockProduction {
pub fn e2e_private_key(&self) -> &ephemeral_e2e::EndToEndPrivateKey {
&self.e2e_encryption_key
}

pub async fn collect_timestamp_search_data(
&self,
secret_input_data: PoSTimestampSearchInputData,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: I've just realised that collect_timestamp_search_data doesn't really need the vrf key, it only needs the pool id (passing the whole PoSTimestampSearchInputData here is an artifact of a previous implementation). So, e2e is not needed for this function and I've removed it.

min_height: BlockHeight,
max_height: Option<BlockHeight>,
seconds_to_check_for_height: u64,
check_all_timestamps_between_blocks: bool,
) -> Result<TimestampSearchData, BlockProductionError> {
timestamp_searcher::collect_timestamp_search_data(
&self.chainstate_handle,
Arc::clone(&self.chain_config),
secret_input_data,
min_height,
max_height,
seconds_to_check_for_height,
check_all_timestamps_between_blocks,
)
.await
}
}

fn generate_finalize_block_data(
Expand Down
Loading