Skip to content

Commit

Permalink
Fix ensures in header construction
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinI committed Jul 31, 2024
1 parent 80f2002 commit cfe9b63
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions types/src/v0/impls/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use ark_serialize::CanonicalSerialize;
use committable::{Commitment, Committable, RawCommitmentBuilder};
use hotshot_query_service::{availability::QueryableHeader, explorer::ExplorerHeader};
use hotshot_types::{
constants::MarketplaceVersion,
traits::{
block_contents::{BlockHeader, BuilderFee},
node_implementation::NodeType,
Expand All @@ -22,7 +23,7 @@ use snafu::Snafu;
use std::fmt;
use thiserror::Error;
use time::OffsetDateTime;
use vbs::version::Version;
use vbs::version::{StaticVersionType, Version};

use crate::{
v0::header::{EitherOrVersion, VersionedHeader},
Expand Down Expand Up @@ -469,15 +470,23 @@ impl Header {
fee_amount,
} in &builder_fee
{
ensure!(
fee_account.validate_fee_signature(
fee_signature,
*fee_amount,
&ns_table,
&payload_commitment,
),
"invalid builder signature"
);
if version < MarketplaceVersion::VERSION {
ensure!(
fee_account.validate_fee_signature(
fee_signature,
*fee_amount,
&ns_table,
&payload_commitment,
),
"invalid builder signature"
);
} else {
ensure!(
fee_account
.validate_sequencing_fee_signature_marketplace(fee_signature, *fee_amount,),
"invalid builder signature"
);
}

let fee_info = FeeInfo::new(*fee_account, *fee_amount);
state
Expand Down

0 comments on commit cfe9b63

Please sign in to comment.