Skip to content

Commit

Permalink
fixes for sequencer types
Browse files Browse the repository at this point in the history
  • Loading branch information
tbro committed Aug 15, 2024
1 parent cf29926 commit 74fbbf8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
6 changes: 3 additions & 3 deletions types/src/v0/impls/auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::state::ValidatedState;
use crate::{
eth_signature_key::{EthKeyPair, SigningError},
v0_3::{BidTx, BidTxBody, FullNetworkTx, SolverAuctionResults},
FeeAccount, FeeAmount, FeeError, FeeInfo, NamespaceId, SeqTypes,
FeeAccount, FeeAmount, FeeError, FeeInfo, NamespaceId, SequencerVersions,
};
use anyhow::Context;
use async_trait::async_trait;
Expand All @@ -11,7 +11,7 @@ use hotshot_types::{
data::ViewNumber,
traits::{
auction_results_provider::AuctionResultsProvider,
node_implementation::{ConsensusTime, HasUrls, NodeType},
node_implementation::{ConsensusTime, HasUrls, NodeType, Versions},
signature_key::BuilderSignatureKey,
},
};
Expand Down Expand Up @@ -279,7 +279,7 @@ impl HasUrls for SolverAuctionResults {
}
}

type SurfClient = surf_disco::Client<ServerError, <SeqTypes as NodeType>::Base>;
type SurfClient = surf_disco::Client<ServerError, <SequencerVersions as Versions>::Base>;

#[derive(Debug, Clone, Eq, PartialEq, Hash)]
/// Auction Results provider holding the Url of the solver in order to fetch auction results.
Expand Down
5 changes: 2 additions & 3 deletions types/src/v0/impls/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ 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 +21,7 @@ use serde_json::{Map, Value};
use std::fmt;
use thiserror::Error;
use time::OffsetDateTime;
use vbs::version::{StaticVersionType, Version};
use vbs::version::{StaticVersion, StaticVersionType, Version};

use crate::{
v0::header::{EitherOrVersion, VersionedHeader},
Expand Down Expand Up @@ -425,7 +424,7 @@ impl Header {
fee_amount,
} in &builder_fee
{
if version < MarketplaceVersion::VERSION {
if version < StaticVersion::<0, 3>::version() {
ensure!(
fee_account.validate_fee_signature(
fee_signature,
Expand Down
8 changes: 5 additions & 3 deletions types/src/v0/impls/instance_state.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use crate::SequencerVersions;
use crate::{
v0::traits::StateCatchup, v0_3::ChainConfig, GenesisHeader, L1BlockInfo, L1Client, PubKey,
SeqTypes, Timestamp, Upgrade, UpgradeMode,
Timestamp, Upgrade, UpgradeMode,
};
use hotshot_types::traits::{node_implementation::NodeType, states::InstanceState};
use hotshot_types::traits::node_implementation::Versions;
use hotshot_types::traits::states::InstanceState;
use hotshot_types::HotShotConfig;
use std::{collections::BTreeMap, sync::Arc};
use vbs::version::{StaticVersionType, Version};
Expand Down Expand Up @@ -59,7 +61,7 @@ impl NodeState {
},
l1_genesis: None,
upgrades: Default::default(),
current_version: <SeqTypes as NodeType>::Base::version(),
current_version: <SequencerVersions as Versions>::Base::version(),
}
}

Expand Down
15 changes: 13 additions & 2 deletions types/src/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use hotshot::traits::election::static_committee::GeneralStaticCommittee;
use hotshot_types::{
data::ViewNumber,
signature_key::BLSPubKey,
traits::{node_implementation::NodeType, signature_key::SignatureKey},
traits::{
node_implementation::{NodeType, Versions},
signature_key::SignatureKey,
},
};
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -130,14 +133,22 @@ impl NodeType for SeqTypes {
type ValidatedState = ValidatedState;
type Membership = GeneralStaticCommittee<Self, PubKey>;
type BuilderSignatureKey = FeeAccount;
type AuctionResult = SolverAuctionResults;
}
#[derive(Clone, Debug, Copy)]
pub struct SequencerVersions {}

impl Versions for SequencerVersions {
type Base = StaticVersion<0, 1>;
type Upgrade = StaticVersion<0, 2>;
type AuctionResult = SolverAuctionResults;
const UPGRADE_HASH: [u8; 32] = [
1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0,
];

type Marketplace = StaticVersion<0, 3>;
}

pub type Leaf = hotshot_types::data::Leaf<SeqTypes>;
pub type Event = hotshot::types::Event<SeqTypes>;

Expand Down

0 comments on commit 74fbbf8

Please sign in to comment.