From 46a41ce828b511f34e7eee2136e30b9f31e781b2 Mon Sep 17 00:00:00 2001 From: Himanshu Goyal Date: Thu, 29 Feb 2024 13:49:58 -0500 Subject: [PATCH 1/3] change api response fields --- api/builder.toml | 4 ++-- src/block_info.rs | 6 ++++-- src/builder.rs | 4 ++-- src/data_source.rs | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/api/builder.toml b/api/builder.toml index d5bd8ae..e64b94d 100644 --- a/api/builder.toml +++ b/api/builder.toml @@ -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 = """ diff --git a/src/block_info.rs b/src/block_info.rs index 2649527..4c58f78 100644 --- a/src/block_info.rs +++ b/src/block_info.rs @@ -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}; @@ -21,6 +22,7 @@ pub struct AvailableBlockInfo { #[serde(bound = "")] pub struct AvailableBlockData { pub block_payload: ::BlockPayload, + pub metadata: <::BlockPayload as BlockPayload>::Metadata, pub signature: <::SignatureKey as SignatureKey>::PureAssembledSignatureType, pub sender: ::SignatureKey, pub _phantom: PhantomData, @@ -29,7 +31,7 @@ pub struct AvailableBlockData { #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Hash)] #[serde(bound = "")] pub struct AvailableBlockHeader { - pub block_header: ::BlockHeader, + pub vid_commitment: ::Commit, pub signature: <::SignatureKey as SignatureKey>::PureAssembledSignatureType, pub sender: ::SignatureKey, pub _phantom: PhantomData, diff --git a/src/builder.rs b/src/builder.rs index 4d04a8d..6cfd65a 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -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(), diff --git a/src/data_source.rs b/src/data_source.rs index d969979..a678ad0 100644 --- a/src/data_source.rs +++ b/src/data_source.rs @@ -27,7 +27,7 @@ where block_hash: &BuilderCommitment, signature: &<::SignatureKey as SignatureKey>::PureAssembledSignatureType, ) -> Result, BuildError>; - async fn claim_block_header( + async fn claim_block_header_input( &self, block_hash: &BuilderCommitment, signature: &<::SignatureKey as SignatureKey>::PureAssembledSignatureType, From aa48903fe5b7898db7bb49ac51c633112bd6c6d3 Mon Sep 17 00:00:00 2001 From: Himanshu Goyal Date: Thu, 29 Feb 2024 14:12:49 -0500 Subject: [PATCH 2/3] make blockHeaderInput --- src/block_info.rs | 2 +- src/data_source.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/block_info.rs b/src/block_info.rs index 4c58f78..4bcdaf3 100644 --- a/src/block_info.rs +++ b/src/block_info.rs @@ -30,7 +30,7 @@ pub struct AvailableBlockData { #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Hash)] #[serde(bound = "")] -pub struct AvailableBlockHeader { +pub struct AvailableBlockHeaderInput { pub vid_commitment: ::Commit, pub signature: <::SignatureKey as SignatureKey>::PureAssembledSignatureType, pub sender: ::SignatureKey, diff --git a/src/data_source.rs b/src/data_source.rs index a678ad0..e2ac3e9 100644 --- a/src/data_source.rs +++ b/src/data_source.rs @@ -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, }; @@ -31,7 +31,7 @@ where &self, block_hash: &BuilderCommitment, signature: &<::SignatureKey as SignatureKey>::PureAssembledSignatureType, - ) -> Result, BuildError>; + ) -> Result, BuildError>; } #[async_trait] From 2253796a76f40626e9b2b441258af8647b788853 Mon Sep 17 00:00:00 2001 From: Himanshu Goyal Date: Fri, 1 Mar 2024 14:16:31 -0500 Subject: [PATCH 3/3] update hotshot version --- Cargo.lock | 55 ++++++++++++++++++++++++++++------------------ Cargo.toml | 4 ++-- src/block_info.rs | 4 ++-- src/data_source.rs | 2 +- 4 files changed, 39 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 23b6ed6..39a7f0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1074,11 +1074,13 @@ dependencies = [ [[package]] name = "blst" -version = "0.3.10" -source = "git+https://github.com/EspressoSystems/blst.git?branch=no-std#faefc7fcb21864aaf4f6f443636ce8924108fcbd" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c94087b935a822949d3291a9989ad2b2051ea141eda0fd4e478a75f6aa3e604b" dependencies = [ "cc", "glob", + "threadpool", "zeroize", ] @@ -1945,8 +1947,8 @@ checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" [[package]] name = "dyn-clone" -version = "1.0.16" -source = "git+https://github.com/dtolnay/dyn-clone?tag=1.0.16#f2f0a02f1f7190048153e5ea8f554db7377a50a9" +version = "1.0.17" +source = "git+https://github.com/dtolnay/dyn-clone?tag=1.0.17#51bf8816be5a73e38b59fd4d9dda2bc18e9c2429" [[package]] name = "ed25519" @@ -2664,7 +2666,7 @@ dependencies = [ [[package]] name = "hotshot-constants" version = "0.3.3" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.14#696de65a40c42accc589a368cbbe218bdec90aa3" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.20#eeaf829a258c317da0946858b6abb57498493674" dependencies = [ "serde", ] @@ -2672,9 +2674,10 @@ dependencies = [ [[package]] name = "hotshot-types" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.14#696de65a40c42accc589a368cbbe218bdec90aa3" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.20#eeaf829a258c317da0946858b6abb57498493674" dependencies = [ "ark-bls12-381", + "ark-ec", "ark-ed-on-bn254", "ark-ff", "ark-serialize", @@ -2691,7 +2694,7 @@ dependencies = [ "derivative", "digest 0.10.7", "displaydoc", - "dyn-clone 1.0.16 (git+https://github.com/dtolnay/dyn-clone?tag=1.0.16)", + "dyn-clone 1.0.17", "either", "espresso-systems-common 0.4.1", "ethereum-types", @@ -2701,6 +2704,7 @@ dependencies = [ "jf-plonk", "jf-primitives", "jf-utils", + "lazy_static", "libp2p-networking", "rand 0.8.5", "rand_chacha 0.3.1", @@ -2717,7 +2721,7 @@ dependencies = [ [[package]] name = "hotshot-utils" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.14#696de65a40c42accc589a368cbbe218bdec90aa3" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.20#eeaf829a258c317da0946858b6abb57498493674" dependencies = [ "bincode", "hotshot-constants", @@ -3166,7 +3170,7 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "jf-plonk" version = "0.4.0-pre.0" -source = "git+https://github.com/EspressoSystems/jellyfish#d9c1b634a96256b9adf92f549fb87e0167adfae4" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.0#214227e0608c231cb55234809727723c2a6740c2" dependencies = [ "ark-ec", "ark-ff", @@ -3176,7 +3180,7 @@ dependencies = [ "derivative", "displaydoc", "downcast-rs", - "dyn-clone 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", + "dyn-clone 1.0.16", "espresso-systems-common 0.4.0", "hashbrown 0.14.3", "itertools 0.12.1", @@ -3195,7 +3199,7 @@ dependencies = [ [[package]] name = "jf-primitives" version = "0.4.0-pre.0" -source = "git+https://github.com/EspressoSystems/jellyfish#d9c1b634a96256b9adf92f549fb87e0167adfae4" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.0#214227e0608c231cb55234809727723c2a6740c2" dependencies = [ "anyhow", "ark-bls12-377", @@ -3240,7 +3244,7 @@ dependencies = [ [[package]] name = "jf-relation" version = "0.4.0-pre.0" -source = "git+https://github.com/EspressoSystems/jellyfish#d9c1b634a96256b9adf92f549fb87e0167adfae4" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.0#214227e0608c231cb55234809727723c2a6740c2" dependencies = [ "ark-bls12-377", "ark-bls12-381", @@ -3254,7 +3258,7 @@ dependencies = [ "derivative", "displaydoc", "downcast-rs", - "dyn-clone 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", + "dyn-clone 1.0.16", "hashbrown 0.14.3", "itertools 0.12.1", "jf-utils", @@ -3266,7 +3270,7 @@ dependencies = [ [[package]] name = "jf-utils" version = "0.4.0-pre.0" -source = "git+https://github.com/EspressoSystems/jellyfish#d9c1b634a96256b9adf92f549fb87e0167adfae4" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.0#214227e0608c231cb55234809727723c2a6740c2" dependencies = [ "ark-ec", "ark-ff", @@ -3648,7 +3652,7 @@ dependencies = [ [[package]] name = "libp2p-networking" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.14#696de65a40c42accc589a368cbbe218bdec90aa3" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.20#eeaf829a258c317da0946858b6abb57498493674" dependencies = [ "async-compatibility-layer", "async-lock 2.8.0", @@ -5490,18 +5494,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", @@ -5519,9 +5523,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -6215,6 +6219,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "tide" version = "0.16.0" diff --git a/Cargo.toml b/Cargo.toml index 94e8113..224f514 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,8 @@ async-trait = "0.1" clap = { version = "4.4", features = ["derive", "env"] } derive_more = "0.99" futures = "0.3" -hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.14" } -serde = { version = "1.0", features = ["derive"] } +hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.20" } +serde = { version = "1.0.197", features = ["derive"] } snafu = { version = "0.7", features = ["backtraces"] } tagged-base64 = { git = "https://github.com/EspressoSystems/tagged-base64", tag = "0.3.4" } tide-disco = { git = "https://github.com/EspressoSystems/tide-disco.git", tag = "v0.4.6" } diff --git a/src/block_info.rs b/src/block_info.rs index 4bcdaf3..0afb546 100644 --- a/src/block_info.rs +++ b/src/block_info.rs @@ -1,9 +1,9 @@ use std::{hash::Hash, marker::PhantomData}; use hotshot_types::{ - data::{VidScheme, VidSchemeTrait}, traits::{node_implementation::NodeType, signature_key::SignatureKey, BlockPayload}, utils::BuilderCommitment, + vid::VidCommitment, }; use serde::{Deserialize, Serialize}; @@ -31,7 +31,7 @@ pub struct AvailableBlockData { #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Hash)] #[serde(bound = "")] pub struct AvailableBlockHeaderInput { - pub vid_commitment: ::Commit, + pub vid_commitment: VidCommitment, pub signature: <::SignatureKey as SignatureKey>::PureAssembledSignatureType, pub sender: ::SignatureKey, pub _phantom: PhantomData, diff --git a/src/data_source.rs b/src/data_source.rs index e2ac3e9..69a75fe 100644 --- a/src/data_source.rs +++ b/src/data_source.rs @@ -1,8 +1,8 @@ use async_trait::async_trait; use hotshot_types::{ - data::VidCommitment, traits::{node_implementation::NodeType, signature_key::SignatureKey}, utils::BuilderCommitment, + vid::VidCommitment, }; use tagged_base64::TaggedBase64;