Skip to content

Commit

Permalink
fix fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mrnaveira committed Jan 30, 2024
1 parent 1a26a4b commit 6f5dca6
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 20 deletions.
10 changes: 8 additions & 2 deletions applications/tari_indexer/src/dry_run/processor.rs
Expand Up @@ -71,8 +71,14 @@ pub struct DryRunTransactionProcessor<TSubstateCache> {
TariSignatureService,
>,
template_manager: TemplateManager<PeerAddress>,
substate_scanner:
Arc<SubstateScanner<EpochManagerHandle<PeerAddress>, TariValidatorNodeRpcClientFactory, TSubstateCache, TariSignatureService>>,
substate_scanner: Arc<
SubstateScanner<
EpochManagerHandle<PeerAddress>,
TariValidatorNodeRpcClientFactory,
TSubstateCache,
TariSignatureService,
>,
>,
network: Network,
}

Expand Down
2 changes: 1 addition & 1 deletion applications/tari_indexer/src/lib.rs
Expand Up @@ -111,7 +111,7 @@ pub async fn run_indexer(config: ApplicationConfig, mut shutdown_signal: Shutdow
services.validator_node_client_factory.clone(),
substate_cache,
signing_service,
config.network
config.network,
));

let substate_manager = Arc::new(SubstateManager::new(
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_validator_node/src/bootstrap.rs
Expand Up @@ -271,7 +271,7 @@ pub async fn spawn_services(
validator_node_client_factory.clone(),
substate_cache,
signing_service,
config.network
config.network,
);
let substate_resolver = TariSubstateResolver::new(
state_store.clone(),
Expand Down
5 changes: 1 addition & 4 deletions applications/tari_validator_node/src/consensus/spec.rs
Expand Up @@ -10,10 +10,7 @@ use tari_rpc_state_sync::RpcStateSyncManager;
use tari_state_store_sqlite::SqliteStateStore;

use crate::{
consensus::{
leader_selection::RoundRobinLeaderStrategy,
state_manager::TariStateManager,
},
consensus::{leader_selection::RoundRobinLeaderStrategy, state_manager::TariStateManager},
p2p::services::messaging::{ConsensusInboundMessaging, ConsensusOutboundMessaging},
};

Expand Down
10 changes: 9 additions & 1 deletion clients/validator_node_client/src/types.rs
Expand Up @@ -27,7 +27,15 @@ use serde::{Deserialize, Serialize};
use tari_common_types::{transaction::TxId, types::PublicKey};
use tari_dan_common_types::{committee::CommitteeShard, shard::Shard, Epoch, SubstateAddress};
use tari_dan_storage::{
consensus_models::{Block, BlockId, Decision, ExecutedTransaction, QuorumCertificate, QuorumDecision, SubstateRecord},
consensus_models::{
Block,
BlockId,
Decision,
ExecutedTransaction,
QuorumCertificate,
QuorumDecision,
SubstateRecord,
},
global::models::ValidatorNode,
Ordering,
};
Expand Down
10 changes: 5 additions & 5 deletions dan_layer/consensus/src/block_validations.rs
Expand Up @@ -7,7 +7,9 @@ use tari_dan_storage::consensus_models::Block;
use tari_epoch_manager::EpochManagerReader;

use crate::{
hotstuff::{HotStuffError, ProposalValidationError}, quorum_certificate_validations::validate_quorum_certificate, traits::{ConsensusSpec, LeaderStrategy}
hotstuff::{HotStuffError, ProposalValidationError},
quorum_certificate_validations::validate_quorum_certificate,
traits::{ConsensusSpec, LeaderStrategy},
};

pub fn check_network(candidate_block: &Block, network: Network) -> Result<(), ProposalValidationError> {
Expand Down Expand Up @@ -99,17 +101,15 @@ pub async fn check_quorum_certificate<TConsensusSpec: ConsensusSpec>(
}

let committee_shard = epoch_manager
.get_committee_shard_by_validator_public_key(
candidate_block.epoch(), candidate_block.proposed_by(),
)
.get_committee_shard_by_validator_public_key(candidate_block.epoch(), candidate_block.proposed_by())
.await?;

validate_quorum_certificate(
candidate_block.justify(),
&committee_shard,
vote_signing_service,
epoch_manager,
candidate_block.network()
candidate_block.network(),
)
.await
.map_err(ProposalValidationError::QuorumCertificateValidationError)?;
Expand Down
7 changes: 4 additions & 3 deletions dan_layer/consensus/src/hotstuff/error.rs
Expand Up @@ -10,9 +10,10 @@ use tari_epoch_manager::EpochManagerError;
use tari_mmr::BalancedBinaryMerkleProofError;
use tari_transaction::TransactionId;

use crate::quorum_certificate_validations::QuorumCertificateValidationError;

use crate::traits::{InboundMessagingError, OutboundMessagingError};
use crate::{
quorum_certificate_validations::QuorumCertificateValidationError,
traits::{InboundMessagingError, OutboundMessagingError},
};

#[derive(Debug, thiserror::Error)]
pub enum HotStuffError {
Expand Down
17 changes: 14 additions & 3 deletions dan_layer/indexer_lib/src/substate_scanner.rs
Expand Up @@ -22,8 +22,8 @@

use log::*;
use rand::{prelude::*, rngs::OsRng};
use tari_consensus::{quorum_certificate_validations::validate_quorum_certificate, traits::VoteSignatureService};
use tari_common::configuration::Network;
use tari_consensus::{quorum_certificate_validations::validate_quorum_certificate, traits::VoteSignatureService};
use tari_dan_common_types::{DerivableFromPublicKey, SubstateAddress};
use tari_dan_storage::consensus_models::QuorumCertificate;
use tari_engine_types::{
Expand Down Expand Up @@ -347,15 +347,26 @@ where
}

/// Validates Quorum Certificates associated with a substate
async fn validate_substate_qcs(&self, qcs: &[QuorumCertificate], shard_id: SubstateAddress) -> Result<(), IndexerError> {
async fn validate_substate_qcs(
&self,
qcs: &[QuorumCertificate],
shard_id: SubstateAddress,
) -> Result<(), IndexerError> {
let qc = qcs.last().ok_or(IndexerError::MissingQuorumCertificate)?;

let committee_shard = self
.committee_provider
.get_committee_shard(qc.epoch(), shard_id)
.await?;

validate_quorum_certificate(qc, &committee_shard, &self.signing_service, &self.committee_provider, self.network).await?;
validate_quorum_certificate(
qc,
&committee_shard,
&self.signing_service,
&self.committee_provider,
self.network,
)
.await?;

Ok(())
}
Expand Down

0 comments on commit 6f5dca6

Please sign in to comment.