Skip to content

Commit

Permalink
add better claim block header logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-maron committed Feb 13, 2025
1 parent 822dfe2 commit dd41df1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion hotshot-builder-core-refactored/src/testing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl TestServiceWrapper {
) -> Vec<TestTransaction> {
let mut available_states = self
.client
.available_blocks::<TestVersions>(
.available_blocks(
state_id.parent_commitment,
*state_id.parent_view,
MOCK_LEADER_KEYS.0,
Expand Down
1 change: 1 addition & 0 deletions hotshot-task-impls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ either = { workspace = true }
futures = { workspace = true }
hotshot-builder-api = { workspace = true }
hotshot-task = { workspace = true }
reqwest = "0.12"
hotshot-types = { workspace = true }
hotshot-utils = { workspace = true }
jf-vid = { workspace = true }
Expand Down
26 changes: 14 additions & 12 deletions hotshot-task-impls/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ use hotshot_builder_api::v0_1::{
};
use hotshot_types::{
constants::LEGACY_BUILDER_MODULE,
traits::{
node_implementation::{NodeType, Versions},
signature_key::SignatureKey,
},
traits::{node_implementation::NodeType, signature_key::SignatureKey},
vid::VidCommitment,
};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -111,7 +108,7 @@ impl<TYPES: NodeType, Ver: StaticVersionType> BuilderClient<TYPES, Ver> {
/// # Errors
/// - [`BuilderClientError::BlockNotFound`] if blocks aren't available for this parent
/// - [`BuilderClientError::Api`] if API isn't responding or responds incorrectly
pub async fn available_blocks<V: Versions>(
pub async fn available_blocks(
&self,
parent: VidCommitment,
view_number: u64,
Expand Down Expand Up @@ -159,13 +156,18 @@ pub mod v0_1 {
signature: &<<TYPES as NodeType>::SignatureKey as SignatureKey>::PureAssembledSignatureType,
) -> Result<AvailableBlockHeaderInput<TYPES>, BuilderClientError> {
let encoded_signature: TaggedBase64 = signature.clone().into();
self.client
.get(&format!(
"{LEGACY_BUILDER_MODULE}/claimheaderinput/{block_hash}/{view_number}/{sender}/{encoded_signature}"
))
.send()
.await
.map_err(Into::into)
let endpoint = &format!(
"{LEGACY_BUILDER_MODULE}/claimheaderinput/{block_hash}/{view_number}/{sender}/{encoded_signature}"
);

let response = reqwest::get(endpoint).await;
println!("reqwest response: {:?}", response);

println!("querying {}", endpoint);
self.client.get(endpoint).send().await.map_err(|err| {
println!("error: {:#}", err);
err.into()
})
}

/// Claim block
Expand Down
2 changes: 1 addition & 1 deletion hotshot-task-impls/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions> TransactionTask
.enumerate()
.map(|(builder_idx, client)| async move {
client
.available_blocks::<V>(
.available_blocks(
parent_comm,
view_number.u64(),
self.public_key.clone(),
Expand Down
2 changes: 1 addition & 1 deletion hotshot-testing/tests/tests_1/block_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async fn test_random_block_builder() {
let mut blocks = loop {
// Test getting blocks
let blocks = client
.available_blocks::<TestVersions>(
.available_blocks(
vid_commitment::<TestVersions>(&[], 1, version),
dummy_view_number,
pub_key,
Expand Down

0 comments on commit dd41df1

Please sign in to comment.