Skip to content

Commit 4c577fb

Browse files
tbroAyiga
andauthored
hotshot update (#1866)
Bumps hotshot to 0.1.70 * implement `Versions` * propagate related (many) changes * use `UpdateLock` for Message (de)serialization * bump upstream crates --------- Co-authored-by: tbro <[email protected]> Co-authored-by: Theodore Schnepper <[email protected]>
1 parent 5927593 commit 4c577fb

33 files changed

+480
-395
lines changed

Cargo.lock

Lines changed: 145 additions & 137 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,22 @@ dotenvy = "0.15"
5252
ethers = { version = "2.0", features = ["solc"] }
5353
futures = "0.3"
5454

55-
hotshot = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.69" }
55+
hotshot = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.70" }
5656
# Hotshot imports
57-
hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.69" }
58-
hotshot-builder-core = { git = "https://github.com/EspressoSystems/hotshot-builder-core", tag = "0.1.40" }
59-
marketplace-builder-core = { git = "https://github.com/EspressoSystems/marketplace-builder-core", tag = "0.0.3" }
60-
hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.40" }
61-
hotshot-orchestrator = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.69" }
62-
hotshot-query-service = { git = "https://github.com/EspressoSystems/hotshot-query-service", tag = "0.1.51" }
63-
hotshot-stake-table = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.69" }
57+
hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.70" }
58+
hotshot-builder-core = { git = "https://github.com/EspressoSystems/hotshot-builder-core", tag = "0.1.41" }
59+
marketplace-builder-core = { git = "https://github.com/EspressoSystems/marketplace-builder-core", tag = "0.0.5" }
60+
hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.41" }
61+
hotshot-orchestrator = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.70" }
62+
hotshot-query-service = { git = "https://github.com/EspressoSystems/hotshot-query-service", tag = "0.1.52" }
63+
hotshot-stake-table = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.70" }
6464
hotshot-state-prover = { version = "0.1.0", path = "hotshot-state-prover" }
65-
hotshot-task = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.69" }
66-
hotshot-testing = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.69" }
67-
hotshot-types = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.69" }
65+
hotshot-task = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.70" }
66+
hotshot-testing = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.70" }
67+
hotshot-types = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.70" }
6868
hotshot-contract-adapter = { version = "0.1.0", path = "contracts/rust/adapter" }
6969
# Temporary, used to pull in the mock auction results provider
70-
hotshot-example-types = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.69" }
70+
hotshot-example-types = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.70" }
7171

7272
# Push CDN imports
7373
cdn-broker = { git = "https://github.com/EspressoSystems/Push-CDN", features = [

builder/src/lib.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub mod testing {
121121

122122
use espresso_types::{
123123
mock::MockStateCatchup, v0_3::ChainConfig, Event, FeeAccount, L1Client, NodeState, PrivKey,
124-
PubKey, Transaction, ValidatedState,
124+
PubKey, SequencerVersions, Transaction, ValidatedState,
125125
};
126126
use ethers::{
127127
types::spoof::State,
@@ -339,7 +339,7 @@ pub mod testing {
339339
bind_version: Ver,
340340
options: impl PersistenceOptions<Persistence = P>,
341341
) -> Vec<(
342-
Arc<SystemContextHandle<SeqTypes, Node<network::Memory, P>>>,
342+
Arc<SystemContextHandle<SeqTypes, Node<network::Memory, P>, SequencerVersions>>,
343343
Option<StateSigner<Ver>>,
344344
)> {
345345
let num_staked_nodes = self.num_staked_nodes();
@@ -380,7 +380,7 @@ pub mod testing {
380380
bind_version: Ver,
381381
persistence: P,
382382
) -> (
383-
SystemContextHandle<SeqTypes, Node<network::Memory, P>>,
383+
SystemContextHandle<SeqTypes, Node<network::Memory, P>, SequencerVersions>,
384384
StateSigner<Ver>,
385385
) {
386386
let mut config = self.config.clone();
@@ -465,7 +465,9 @@ pub mod testing {
465465
hotshot_events_api_url: Url,
466466
known_nodes_with_stake: Vec<PeerConfig<VerKey>>,
467467
num_non_staking_nodes: usize,
468-
hotshot_context_handle: Arc<SystemContextHandle<SeqTypes, Node<network::Memory, P>>>,
468+
hotshot_context_handle: Arc<
469+
SystemContextHandle<SeqTypes, Node<network::Memory, P>, SequencerVersions>,
470+
>,
469471
) {
470472
// create a event streamer
471473
let events_streamer = Arc::new(RwLock::new(EventsStreamer::new(
@@ -602,7 +604,9 @@ pub mod testing {
602604
{
603605
pub async fn init_permissioned_builder(
604606
hotshot_test_config: HotShotTestConfig,
605-
hotshot_handle: Arc<SystemContextHandle<SeqTypes, Node<network::Memory, P>>>,
607+
hotshot_handle: Arc<
608+
SystemContextHandle<SeqTypes, Node<network::Memory, P>, SequencerVersions>,
609+
>,
606610
node_id: u64,
607611
state_signer: StateSigner<Ver>,
608612
hotshot_builder_api_url: Url,

builder/src/non_permissioned.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use async_compatibility_layer::{
1111
use async_std::sync::{Arc, RwLock};
1212
use espresso_types::{
1313
eth_signature_key::EthKeyPair, v0_3::ChainConfig, FeeAmount, L1Client, NodeState, Payload,
14-
SeqTypes, ValidatedState,
14+
SeqTypes, SequencerVersions, ValidatedState,
1515
};
1616
use ethers::{
1717
core::k256::ecdsa::SigningKey,
@@ -195,14 +195,18 @@ impl BuilderConfig {
195195
let events_url = hotshot_events_api_url.clone();
196196
tracing::info!("Running permissionless builder against hotshot events API at {events_url}",);
197197
async_spawn(async move {
198-
let res = run_non_permissioned_standalone_builder_service(
199-
da_sender,
200-
qc_sender,
201-
decide_sender,
202-
tx_sender,
203-
events_url,
204-
)
205-
.await;
198+
// TODO this is proabably a mistake in builder-core. These
199+
// generic params can be removed and the concrete types
200+
// used instead.
201+
let res =
202+
run_non_permissioned_standalone_builder_service::<SeqTypes, SequencerVersions>(
203+
da_sender,
204+
qc_sender,
205+
decide_sender,
206+
tx_sender,
207+
events_url,
208+
)
209+
.await;
206210
tracing::error!(?res, "builder service exited");
207211
if res.is_err() {
208212
panic!("Builder should restart.");

builder/src/permissioned.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ use async_std::{
2626
use espresso_types::{
2727
eth_signature_key::EthKeyPair,
2828
v0::traits::{PersistenceOptions, SequencerPersistence, StateCatchup},
29-
FeeAmount, L1Client, NodeState, Payload, PubKey, SeqTypes, SolverAuctionResultsProvider,
30-
ValidatedState,
29+
FeeAmount, L1Client, NodeState, Payload, PubKey, SeqTypes, SequencerVersions,
30+
SolverAuctionResultsProvider, ValidatedState,
3131
};
3232
use ethers::{
3333
core::k256::ecdsa::SigningKey,
@@ -339,7 +339,10 @@ pub async fn init_hotshot<
339339
stake_table_commit: StakeTableCommitmentType,
340340
_: Ver,
341341
persistence: P,
342-
) -> (SystemContextHandle<SeqTypes, Node<N, P>>, StateSigner<Ver>) {
342+
) -> (
343+
SystemContextHandle<SeqTypes, Node<N, P>, SequencerVersions>,
344+
StateSigner<Ver>,
345+
) {
343346
let combined_known_nodes_with_stake = match stake_table_entries_for_non_voting_nodes {
344347
Some(stake_table_entries) => {
345348
let combined_entries = config

hotshot-state-prover/src/bin/state-prover.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
use std::time::Duration;
22

33
use clap::Parser;
4-
use espresso_types::{parse_duration, SeqTypes};
4+
use espresso_types::{parse_duration, SequencerVersions};
55
use ethers::{
66
providers::{Http, Middleware, Provider},
77
signers::{coins_bip39::English, MnemonicBuilder, Signer},
88
types::Address,
99
};
1010
use hotshot_stake_table::config::STAKE_TABLE_CAPACITY;
1111
use hotshot_state_prover::service::{run_prover_once, run_prover_service, StateProverConfig};
12-
use hotshot_types::traits::node_implementation::NodeType;
12+
use hotshot_types::traits::node_implementation::Versions;
1313
use sequencer_utils::logging;
1414
use url::Url;
1515
use vbs::version::StaticVersionType;
@@ -114,13 +114,16 @@ async fn main() {
114114

115115
if args.daemon {
116116
// Launching the prover service daemon
117-
if let Err(err) = run_prover_service(config, <SeqTypes as NodeType>::Base::instance()).await
117+
if let Err(err) =
118+
run_prover_service(config, <SequencerVersions as Versions>::Base::instance()).await
118119
{
119120
tracing::error!("Error running prover service: {:?}", err);
120121
};
121122
} else {
122123
// Run light client state update once
123-
if let Err(err) = run_prover_once(config, <SeqTypes as NodeType>::Base::instance()).await {
124+
if let Err(err) =
125+
run_prover_once(config, <SequencerVersions as Versions>::Base::instance()).await
126+
{
124127
tracing::error!("Error running prover once: {:?}", err);
125128
};
126129
}

marketplace-builder/src/bin/marketplace-builder.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ use std::{num::NonZeroUsize, path::PathBuf, time::Duration};
33
use async_compatibility_layer::logging::{setup_backtrace, setup_logging};
44
use clap::Parser;
55
use espresso_types::{
6-
eth_signature_key::EthKeyPair, parse_duration, FeeAmount, NamespaceId, SeqTypes,
6+
eth_signature_key::EthKeyPair, parse_duration, FeeAmount, NamespaceId, SequencerVersions,
77
};
88
use hotshot::traits::ValidatedState;
9-
use hotshot_types::{data::ViewNumber, traits::node_implementation::ConsensusTime};
9+
use hotshot_types::{
10+
data::ViewNumber,
11+
traits::node_implementation::{ConsensusTime, Versions},
12+
};
1013
use marketplace_builder::{
1114
builder::{build_instance_state, BuilderConfig},
1215
hooks::BidConfig,
1316
};
14-
use marketplace_builder_core::testing::basic_test::NodeType;
1517
use sequencer::{Genesis, L1Params};
1618
use url::Url;
1719
use vbs::version::StaticVersionType;
@@ -150,7 +152,7 @@ async fn main() -> anyhow::Result<()> {
150152
genesis.chain_config,
151153
l1_params,
152154
opt.state_peers,
153-
<SeqTypes as NodeType>::Base::instance(),
155+
<SequencerVersions as Versions>::Base::instance(),
154156
)
155157
.unwrap();
156158

marketplace-builder/src/builder.rs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use async_lock::RwLock;
1212
use async_std::sync::Arc;
1313
use espresso_types::{
1414
eth_signature_key::EthKeyPair, v0_3::ChainConfig, FeeAmount, L1Client, NamespaceId, NodeState,
15-
Payload, SeqTypes, ValidatedState,
15+
Payload, SeqTypes, SequencerVersions, ValidatedState,
1616
};
1717
use ethers::{
1818
core::k256::ecdsa::SigningKey,
@@ -203,9 +203,11 @@ impl BuilderConfig {
203203
};
204204

205205
async_spawn(async move {
206-
let res =
207-
run_non_permissioned_standalone_builder_service(hooks, senders, events_url)
208-
.await;
206+
let res = run_non_permissioned_standalone_builder_service::<
207+
SeqTypes,
208+
SequencerVersions,
209+
>(hooks, senders, events_url)
210+
.await;
209211
tracing::error!(?res, "Reserve builder service exited");
210212
if res.is_err() {
211213
panic!("Reserve builder should restart.");
@@ -217,9 +219,11 @@ impl BuilderConfig {
217219
let hooks = hooks::EspressoFallbackHooks { solver_api_url };
218220

219221
async_spawn(async move {
220-
let res =
221-
run_non_permissioned_standalone_builder_service(hooks, senders, events_url)
222-
.await;
222+
let res = run_non_permissioned_standalone_builder_service::<
223+
SeqTypes,
224+
SequencerVersions,
225+
>(hooks, senders, events_url)
226+
.await;
223227
tracing::error!(?res, "Fallback builder service exited");
224228
if res.is_err() {
225229
panic!("Fallback builder should restart.");
@@ -249,7 +253,8 @@ mod test {
249253
use async_std::{stream::StreamExt, task};
250254
use committable::Commitment;
251255
use espresso_types::{
252-
mock::MockStateCatchup, FeeAccount, NamespaceId, PubKey, SeqTypes, Transaction,
256+
mock::MockStateCatchup, FeeAccount, NamespaceId, PubKey, SeqTypes, SequencerVersions,
257+
Transaction,
253258
};
254259
use ethers::utils::Anvil;
255260
use hotshot::types::BLSPrivKey;
@@ -261,12 +266,11 @@ mod test {
261266
use hotshot_query_service::availability::LeafQueryData;
262267
use hotshot_types::{
263268
bundle::Bundle,
264-
constants::MarketplaceVersion,
265269
light_client::StateKeyPair,
266270
signature_key::BLSPubKey,
267271
traits::{
268272
block_contents::{BlockPayload, GENESIS_VID_NUM_STORAGE_NODES},
269-
node_implementation::NodeType,
273+
node_implementation::{NodeType, Versions},
270274
signature_key::{BuilderSignatureKey, SignatureKey},
271275
},
272276
};
@@ -325,7 +329,8 @@ mod test {
325329
)
326330
.network_config(network_config)
327331
.build();
328-
let network = TestNetwork::new(config, <SeqTypes as NodeType>::Base::instance()).await;
332+
let network =
333+
TestNetwork::new(config, <SequencerVersions as Versions>::Base::instance()).await;
329334

330335
// Start the builder
331336
let init = BuilderConfig::init(
@@ -352,7 +357,7 @@ mod test {
352357
let _builder_config = init.await;
353358

354359
// Wait for at least one empty block to be sequenced (after consensus starts VID).
355-
let sequencer_client: Client<ServerError, <SeqTypes as NodeType>::Base> =
360+
let sequencer_client: Client<ServerError, <SequencerVersions as Versions>::Base> =
356361
Client::new(query_api_url);
357362
sequencer_client.connect(None).await;
358363
sequencer_client
@@ -366,12 +371,12 @@ mod test {
366371
.unwrap();
367372

368373
// Connect to builder
369-
let builder_client: Client<ServerError, MarketplaceVersion> =
374+
let builder_client: Client<ServerError, <SequencerVersions as Versions>::Marketplace> =
370375
Client::new(builder_api_url.clone());
371376
builder_client.connect(None).await;
372377

373378
// TODO(AG): workaround for version mismatch between bundle and submit APIs
374-
let submission_client: Client<ServerError, <SeqTypes as NodeType>::Base> =
379+
let submission_client: Client<ServerError, <SequencerVersions as Versions>::Base> =
375380
Client::new(builder_api_url);
376381
submission_client.connect(None).await;
377382

marketplace-builder/src/hooks.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ use espresso_types::v0_3::BidTxBody;
55

66
use espresso_types::v0_3::RollupRegistration;
77
use espresso_types::SeqTypes;
8+
use espresso_types::SequencerVersions;
89
use hotshot::types::EventType;
910

1011
use hotshot::types::Event;
1112

13+
use hotshot_types::traits::node_implementation::Versions;
1214
use marketplace_builder_core::service::BuilderHooks;
1315

1416
use espresso_types::FeeAmount;
@@ -36,8 +38,8 @@ pub struct BidConfig {
3638

3739
pub async fn connect_to_solver(
3840
solver_api_url: Url,
39-
) -> Option<Client<SolverError, <SeqTypes as NodeType>::Base>> {
40-
let client = Client::<SolverError, <SeqTypes as NodeType>::Base>::new(
41+
) -> Option<Client<SolverError, <SequencerVersions as Versions>::Base>> {
42+
let client = Client::<SolverError, <SequencerVersions as Versions>::Base>::new(
4143
solver_api_url.join("marketplace-solver/").unwrap(),
4244
);
4345

marketplace-builder/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use espresso_types::{
1919
eth_signature_key::EthKeyPair,
2020
v0::traits::{PersistenceOptions, SequencerPersistence, StateCatchup},
2121
v0_3::BidTxBody,
22-
SeqTypes,
22+
SeqTypes, SequencerVersions,
2323
};
2424
use ethers::{
2525
core::k256::ecdsa::SigningKey,
@@ -56,7 +56,7 @@ use hotshot_types::{
5656
},
5757
election::Membership,
5858
metrics::Metrics,
59-
node_implementation::{ConsensusTime, NodeType},
59+
node_implementation::{ConsensusTime, NodeType, Versions},
6060
},
6161
utils::BuilderCommitment,
6262
HotShotConfig, PeerConfig, ValidatorConfig,
@@ -92,7 +92,7 @@ pub fn run_builder_api_service(url: Url, source: ProxyGlobalState<SeqTypes>) {
9292
let private_mempool_api = hotshot_builder_api::v0_3::builder::submit_api::<
9393
ProxyGlobalState<SeqTypes>,
9494
SeqTypes,
95-
<SeqTypes as NodeType>::Base,
95+
<SequencerVersions as Versions>::Base,
9696
>(&HotshotBuilderApiOptions::default())
9797
.expect("Failed to construct the builder API for private mempool txns");
9898

@@ -104,5 +104,5 @@ pub fn run_builder_api_service(url: Url, source: ProxyGlobalState<SeqTypes>) {
104104
app.register_module("txn_submit", private_mempool_api)
105105
.expect("Failed to register the private mempool API");
106106

107-
async_spawn(app.serve(url, <SeqTypes as NodeType>::Base::instance()));
107+
async_spawn(app.serve(url, <SequencerVersions as Versions>::Base::instance()));
108108
}

0 commit comments

Comments
 (0)