Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-es committed Oct 17, 2024
1 parent b21a3ac commit 16871d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
21 changes: 16 additions & 5 deletions types/src/v0/impls/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,13 +682,20 @@ impl HotShotState<SeqTypes> for ValidatedState {
system_time,
diff
);
return Err(BlockError::InvalidBlockHeader);
return Err(BlockError::InvalidBlockHeader(format!(
"Timestamp drift too high proposed={} system={} diff={}",
proposed_header.timestamp(),
system_time,
diff
)));
}

//validate builder fee
if let Err(err) = validate_builder_fee(proposed_header) {
tracing::error!("invalid builder fee: {err:#}");
return Err(BlockError::InvalidBlockHeader);
return Err(BlockError::InvalidBlockHeader(format!(
"invalid builder fee: {err:#}"
)));
}

// Unwrapping here is okay as we retry in a loop
Expand Down Expand Up @@ -722,14 +729,18 @@ impl HotShotState<SeqTypes> for ValidatedState {

if finalized != proposed_finalized {
tracing::error!("Invalid proposal: l1_finalized mismatch");
return Err(BlockError::InvalidBlockHeader);
return Err(BlockError::InvalidBlockHeader(
"l1_finalized mismatch".to_string(),
));
}
}
// Validate `l1_head`.
// TODO add test https://github.com/EspressoSystems/espresso-sequencer/issues/2100
if proposed_header.l1_head() < parent_leaf.block_header().l1_head() {
tracing::error!("Invalid proposal: l1_head decreasing");
return Err(BlockError::InvalidBlockHeader);
return Err(BlockError::InvalidBlockHeader(
"l1_head decreasing".to_string(),
));
}

let _ = instance
Expand All @@ -746,7 +757,7 @@ impl HotShotState<SeqTypes> for ValidatedState {
&vid_common,
) {
tracing::error!("Invalid proposal: {err:#}");
return Err(BlockError::InvalidBlockHeader);
return Err(BlockError::InvalidBlockHeader(format!("{err:#}")));
}

// log successful progress about once in 10 - 20 seconds,
Expand Down
2 changes: 1 addition & 1 deletion types/src/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ pub type Event = hotshot::types::Event<SeqTypes>;
pub type PubKey = BLSPubKey;
pub type PrivKey = <PubKey as SignatureKey>::PrivateKey;

pub type NetworkConfig = hotshot_orchestrator::config::NetworkConfig<PubKey>;
pub type NetworkConfig = hotshot_types::network::NetworkConfig<PubKey>;

pub use self::impls::{NodeState, SolverAuctionResultsProvider, ValidatedState};
pub use crate::v0_1::{
Expand Down

0 comments on commit 16871d5

Please sign in to comment.