Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change api response fields #33

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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: 2 additions & 2 deletions api/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Get the specified block candidate.
Returns application-specific encoded transactions type
"""

[route.claim_header]
PATH = ["claimheader/:block_hash/:signature"]
[route.claim_header_input]
PATH = ["claimheaderinput/:block_hash/:signature"]
":block_hash" = "TaggedBase64"
":signature" = "TaggedBase64"
DOC = """
Expand Down
8 changes: 5 additions & 3 deletions src/block_info.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::{hash::Hash, marker::PhantomData};

use hotshot_types::{
traits::{node_implementation::NodeType, signature_key::SignatureKey},
data::{VidScheme, VidSchemeTrait},
traits::{node_implementation::NodeType, signature_key::SignatureKey, BlockPayload},
utils::BuilderCommitment,
};
use serde::{Deserialize, Serialize};
Expand All @@ -21,15 +22,16 @@ pub struct AvailableBlockInfo<I: NodeType> {
#[serde(bound = "")]
pub struct AvailableBlockData<I: NodeType> {
pub block_payload: <I as NodeType>::BlockPayload,
pub metadata: <<I as NodeType>::BlockPayload as BlockPayload>::Metadata,
pub signature: <<I as NodeType>::SignatureKey as SignatureKey>::PureAssembledSignatureType,
pub sender: <I as NodeType>::SignatureKey,
pub _phantom: PhantomData<I>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Hash)]
#[serde(bound = "")]
pub struct AvailableBlockHeader<I: NodeType> {
pub block_header: <I as NodeType>::BlockHeader,
pub struct AvailableBlockHeaderInput<I: NodeType> {
pub vid_commitment: <VidScheme as VidSchemeTrait>::Commit,
pub signature: <<I as NodeType>::SignatureKey as SignatureKey>::PureAssembledSignatureType,
pub sender: <I as NodeType>::SignatureKey,
pub _phantom: PhantomData<I>,
Expand Down
4 changes: 2 additions & 2 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ where
}
.boxed()
})?
.get("claim_header", |req, state| {
.get("claim_header_input", |req, state| {
async move {
let hash: BuilderCommitment = req.blob_param("block_hash")?;
let signature = req.blob_param("signature")?;
state
.claim_block_header(&hash, &signature)
.claim_block_header_input(&hash, &signature)
.await
.context(BlockClaimSnafu {
resource: hash.to_string(),
Expand Down
6 changes: 3 additions & 3 deletions src/data_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use hotshot_types::{
use tagged_base64::TaggedBase64;

use crate::{
block_info::{AvailableBlockData, AvailableBlockHeader, AvailableBlockInfo},
block_info::{AvailableBlockData, AvailableBlockHeaderInput, AvailableBlockInfo},
builder::BuildError,
};

Expand All @@ -27,11 +27,11 @@ where
block_hash: &BuilderCommitment,
signature: &<<I as NodeType>::SignatureKey as SignatureKey>::PureAssembledSignatureType,
) -> Result<AvailableBlockData<I>, BuildError>;
async fn claim_block_header(
async fn claim_block_header_input(
&self,
block_hash: &BuilderCommitment,
signature: &<<I as NodeType>::SignatureKey as SignatureKey>::PureAssembledSignatureType,
) -> Result<AvailableBlockHeader<I>, BuildError>;
) -> Result<AvailableBlockHeaderInput<I>, BuildError>;
}

#[async_trait]
Expand Down
Loading