Skip to content

Commit

Permalink
resolve issues with weekly release
Browse files Browse the repository at this point in the history
  • Loading branch information
pls148 committed Jan 24, 2025
1 parent 018fbc5 commit a1c0c13
Show file tree
Hide file tree
Showing 14 changed files with 637 additions and 474 deletions.
639 changes: 378 additions & 261 deletions Cargo.lock

Large diffs are not rendered by default.

40 changes: 14 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,24 @@ tokio = { version = "1", default-features = false, features = [
"sync",
] }

hotshot = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.83" }
hotshot = { git = "https://github.com/EspressoSystems/hotshot", branch = "bump/0.5.84" }
# Hotshot imports
hotshot-builder-api = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.83" }
hotshot-builder-core = { git = "https://github.com/EspressoSystems/marketplace-builder-core", tag = "0.1.59" }
marketplace-builder-core = { git = "https://github.com/EspressoSystems/marketplace-builder-core", tag = "0.1.59" }
marketplace-builder-shared = { git = "https://github.com/EspressoSystems/marketplace-builder-core", tag = "0.1.59" }
hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.57" }
hotshot-orchestrator = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.83" }
hotshot-query-service = { git = "https://github.com/EspressoSystems/hotshot-query-service", tag = "v0.1.76" }
hotshot-stake-table = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.83" }
hotshot-builder-api = { git = "https://github.com/EspressoSystems/hotshot", branch = "bump/0.5.84" }
hotshot-builder-core = { git = "https://github.com/EspressoSystems/marketplace-builder-core", branch = "hotshot/rc-0.5.84" }
marketplace-builder-core = { git = "https://github.com/EspressoSystems/marketplace-builder-core", branch = "hotshot/rc-0.5.84" }
marketplace-builder-shared = { git = "https://github.com/EspressoSystems/marketplace-builder-core", branch = "hotshot/rc-0.5.84" }
hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", branch = "hotshot/rc-0.5.84" }
hotshot-orchestrator = { git = "https://github.com/EspressoSystems/hotshot", branch = "bump/0.5.84" }
hotshot-query-service = { git = "https://github.com/EspressoSystems/hotshot-query-service", branch = "hotshot/rc-0.5.84" }
hotshot-stake-table = { git = "https://github.com/EspressoSystems/hotshot", branch = "bump/0.5.84" }
hotshot-state-prover = { version = "0.1.0", path = "hotshot-state-prover" }
hotshot-task = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.83" }
hotshot-testing = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.83" }
hotshot-types = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.83" }
libp2p-networking = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.83" }
hotshot-task = { git = "https://github.com/EspressoSystems/hotshot", branch = "bump/0.5.84" }
hotshot-testing = { git = "https://github.com/EspressoSystems/hotshot", branch = "bump/0.5.84" }
hotshot-types = { git = "https://github.com/EspressoSystems/hotshot", branch = "bump/0.5.84" }
libp2p-networking = { git = "https://github.com/EspressoSystems/hotshot", branch = "bump/0.5.84" }
hotshot-contract-adapter = { version = "0.1.0", path = "contracts/rust/adapter" }
# Temporary, used to pull in the mock auction results provider
hotshot-example-types = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.83" }
hotshot-example-types = { git = "https://github.com/EspressoSystems/hotshot", branch = "bump/0.5.84" }

# Push CDN imports
cdn-broker = { git = "https://github.com/EspressoSystems/Push-CDN", tag = "0.5.1-upgrade", package = "cdn-broker" }
Expand Down Expand Up @@ -162,15 +162,3 @@ opt-level = 0
opt-level = 0
[profile.test.package.hotshot-state-prover]
opt-level = 3

[patch."https://github.com/EspressoSystems/HotShot.git"]
hotshot = { git = "https://www.github.com/EspressoSystems/HotShot.git", tag = "0.5.83-patch1" }
hotshot-builder-api = { git = "https://www.github.com/EspressoSystems/HotShot.git", tag = "0.5.83-patch1" }
hotshot-orchestrator = { git = "https://www.github.com/EspressoSystems/HotShot.git", tag = "0.5.83-patch1" }
hotshot-stake-table = { git = "https://www.github.com/EspressoSystems/HotShot.git", tag = "0.5.83-patch1" }
hotshot-task = { git = "https://www.github.com/EspressoSystems/HotShot.git", tag = "0.5.83-patch1" }
hotshot-task-impls = { git = "https://www.github.com/EspressoSystems/HotShot.git", tag = "0.5.83-patch1" }
hotshot-testing = { git = "https://www.github.com/EspressoSystems/HotShot.git", tag = "0.5.83-patch1" }
hotshot-types = { git = "https://www.github.com/EspressoSystems/HotShot.git", tag = "0.5.83-patch1" }
libp2p-networking = { git = "https://www.github.com/EspressoSystems/HotShot.git", tag = "0.5.83-patch1" }
hotshot-example-types = { git = "https://www.github.com/EspressoSystems/HotShot.git", tag = "0.5.83-patch1" }
2 changes: 1 addition & 1 deletion builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ pub mod testing {
let event = subscribed_events.next().await.unwrap();
tracing::warn!("Event: {:?}", event.event);
if let EventType::QuorumProposal { proposal, .. } = event.event {
let parent_view_number = *proposal.data.view_number;
let parent_view_number = *proposal.data.view_number();
let parent_commitment =
Leaf2::from_quorum_proposal(&proposal.data).payload_commitment();
let encoded_signature = <SeqTypes as NodeType>::SignatureKey::sign(
Expand Down
85 changes: 50 additions & 35 deletions sequencer/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,30 +163,30 @@ impl<N: ConnectedNetwork<PubKey>, D: Send + Sync, V: Versions, P: SequencerPersi
impl<N: ConnectedNetwork<PubKey>, D: Sync, V: Versions, P: SequencerPersistence>
StakeTableDataSource<SeqTypes> for StorageState<N, P, D, V>
{
/// Get the stake table for a given epoch or the current epoch if not provided
/// Get the stake table for a given epoch
async fn get_stake_table(
&self,
epoch: Option<<SeqTypes as NodeType>::Epoch>,
) -> Vec<StakeTableEntry<<SeqTypes as NodeType>::SignatureKey>> {
self.as_ref().get_stake_table(epoch).await
}

/// Get the stake table for the current epoch if not provided
async fn get_stake_table_current(
&self,
) -> Vec<StakeTableEntry<<SeqTypes as NodeType>::SignatureKey>> {
self.as_ref().get_stake_table_current().await
}
}

impl<N: ConnectedNetwork<PubKey>, V: Versions, P: SequencerPersistence>
StakeTableDataSource<SeqTypes> for ApiState<N, P, V>
{
/// Get the stake table for a given epoch or the current epoch if not provided
/// Get the stake table for a given epoch
async fn get_stake_table(
&self,
epoch: Option<<SeqTypes as NodeType>::Epoch>,
) -> Vec<StakeTableEntry<<SeqTypes as NodeType>::SignatureKey>> {
// Get the epoch from the argument or the current epoch if not provided
let epoch = if let Some(epoch) = epoch {
epoch
} else {
self.consensus().await.read().await.cur_epoch().await
};

self.consensus()
.await
.read()
Expand All @@ -196,6 +196,15 @@ impl<N: ConnectedNetwork<PubKey>, V: Versions, P: SequencerPersistence>
.await
.stake_table(epoch)
}

/// Get the stake table for the current epoch if not provided
async fn get_stake_table_current(
&self,
) -> Vec<StakeTableEntry<<SeqTypes as NodeType>::SignatureKey>> {
let epoch = self.consensus().await.read().await.cur_epoch().await;

self.get_stake_table(epoch).await
}
}

impl<N: ConnectedNetwork<PubKey>, V: Versions, P: SequencerPersistence> SubmitDataSource<N, P>
Expand Down Expand Up @@ -1054,7 +1063,6 @@ mod api_tests {
use committable::Committable;
use data_source::testing::TestableSequencerDataSource;
use endpoints::NamespaceProofQueryData;

use espresso_types::MockSequencerVersions;
use espresso_types::{
traits::{EventConsumer, PersistenceOptions},
Expand All @@ -1065,8 +1073,9 @@ mod api_tests {
use hotshot_query_service::availability::{
AvailabilityDataSource, BlockQueryData, VidCommonQueryData,
};

use hotshot_types::{
data::{DaProposal, QuorumProposal2, VidDisperseShare},
data::{DaProposal, QuorumProposal2, QuorumProposalWrapper, VidDisperseShare},
event::LeafInfo,
message::Proposal,
simple_certificate::QuorumCertificate,
Expand Down Expand Up @@ -1251,19 +1260,22 @@ mod api_tests {
let payload_bytes_arc = payload.encode();
let disperse = vid_scheme(2).disperse(payload_bytes_arc.clone()).unwrap();
let payload_commitment = disperse.commit;
let mut quorum_proposal = QuorumProposal2::<SeqTypes> {
block_header: genesis.block_header().clone(),
view_number: ViewNumber::genesis(),
justify_qc: QuorumCertificate::genesis::<MockSequencerVersions>(
&ValidatedState::default(),
&NodeState::mock(),
)
.await
.to_qc2(),
upgrade_certificate: None,
view_change_evidence: None,
next_drb_result: None,
next_epoch_justify_qc: None,
let mut quorum_proposal = QuorumProposalWrapper::<SeqTypes> {
proposal: QuorumProposal2::<SeqTypes> {
block_header: genesis.block_header().clone(),
view_number: ViewNumber::genesis(),
justify_qc: QuorumCertificate::genesis::<MockSequencerVersions>(
&ValidatedState::default(),
&NodeState::mock(),
)
.await
.to_qc2(),
upgrade_certificate: None,
view_change_evidence: None,
next_drb_result: None,
next_epoch_justify_qc: None,
},
with_epoch: false,
};
let mut qc = QuorumCertificate::genesis::<MockSequencerVersions>(
&ValidatedState::default(),
Expand All @@ -1274,9 +1286,9 @@ mod api_tests {

let mut justify_qc = qc.clone();
for i in 0..5 {
*quorum_proposal.block_header.height_mut() = i;
quorum_proposal.view_number = ViewNumber::new(i);
quorum_proposal.justify_qc = justify_qc;
*quorum_proposal.proposal.block_header.height_mut() = i;
quorum_proposal.proposal.view_number = ViewNumber::new(i);
quorum_proposal.proposal.justify_qc = justify_qc;
let leaf = Leaf2::from_quorum_proposal(&quorum_proposal);
qc.view_number = leaf.view_number();
qc.data.leaf_commit = Committable::commit(&leaf);
Expand Down Expand Up @@ -1463,14 +1475,17 @@ mod api_tests {
// Create another leaf, with missing data.
let mut block_header = leaf.block_header().clone();
*block_header.height_mut() += 1;
let qp = QuorumProposal2 {
block_header,
view_number: leaf.view_number() + 1,
justify_qc: qc.clone(),
upgrade_certificate: None,
view_change_evidence: None,
next_drb_result: None,
next_epoch_justify_qc: None,
let qp = QuorumProposalWrapper {
proposal: QuorumProposal2 {
block_header,
view_number: leaf.view_number() + 1,
justify_qc: qc.clone(),
upgrade_certificate: None,
view_change_evidence: None,
next_drb_result: None,
next_epoch_justify_qc: None,
},
with_epoch: false,
};

let leaf = Leaf2::from_quorum_proposal(&qp);
Expand Down
7 changes: 6 additions & 1 deletion sequencer/src/api/data_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,16 @@ pub(crate) trait NodeStateDataSource {
}

pub(crate) trait StakeTableDataSource<T: NodeType> {
/// Get the stake table for a given epoch or the current epoch if not provided
/// Get the stake table for a given epoch
fn get_stake_table(
&self,
epoch: Option<<T as NodeType>::Epoch>,
) -> impl Send + Future<Output = Vec<StakeTableEntry<T::SignatureKey>>>;

/// Get the stake table for the current epoch if not provided
fn get_stake_table_current(
&self,
) -> impl Send + Future<Output = Vec<StakeTableEntry<T::SignatureKey>>>;
}

pub(crate) trait CatchupDataSource: Sync {
Expand Down
13 changes: 7 additions & 6 deletions sequencer/src/api/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,23 +193,24 @@ where
async move {
// Try to get the epoch from the request. If this fails, error
// as it was probably a mistake
let epoch = EpochNumber::new(req.integer_param("epoch_number").map_err(|_| {
hotshot_query_service::node::Error::Custom {
let epoch = req
.opt_integer_param("epoch_number")
.map_err(|_| hotshot_query_service::node::Error::Custom {
message: "Epoch number is required".to_string(),
status: StatusCode::BAD_REQUEST,
}
})?);
})?
.map(EpochNumber::new);

Ok(state
.read(|state| state.get_stake_table(Some(epoch)).boxed())
.read(|state| state.get_stake_table(epoch).boxed())
.await)
}
.boxed()
})?
.at("stake_table_current", |_, state| {
async move {
Ok(state
.read(|state| state.get_stake_table(None).boxed())
.read(|state| state.get_stake_table_current().boxed())
.await)
}
.boxed()
Expand Down
4 changes: 2 additions & 2 deletions sequencer/src/message_compat_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ async fn test_message_compat<Ver: StaticVersionType>(_ver: Ver) {
ViewNumber::genesis(),
vid_scheme(1).disperse(payload.encode()).unwrap(),
&membership,
EpochNumber::genesis(),
EpochNumber::new(1),
Some(EpochNumber::genesis()),
Some(EpochNumber::new(1)),
Some(block_header.payload_commitment()),
)
.await,
Expand Down
Loading

0 comments on commit a1c0c13

Please sign in to comment.