From 686ced9761a7ddaa6dd18128f8e9a4e123bb1985 Mon Sep 17 00:00:00 2001 From: Richard Bertok Date: Mon, 7 Oct 2024 14:50:46 +0200 Subject: [PATCH] chore: moved fee exhaust constant to consensus constants (#1166) Description --- Fee exhaust divisor (mainly used to calculate leader fees) was a hard coded constant and moved to the consensus constants to make it configurable on a tari network basis (DAN constants - Tari Network mapping). Motivation and Context --- Fee exhaust divisor (mainly used to calculate leader fees) was a simple hard coded constant before and it should be network specific. How Has This Been Tested? --- Checking whether everything is still building and running. What process can a PR reviewer use to test or verify this change? --- Breaking Changes --- - [x] None - [ ] Requires data directory to be deleted - [ ] Other - Please specify --- Cargo.lock | 2 ++ applications/tari_dan_app_utilities/Cargo.toml | 1 + .../src/base_layer_scanner.rs | 6 ++---- applications/tari_dan_app_utilities/src/lib.rs | 1 - applications/tari_indexer/Cargo.toml | 1 + applications/tari_indexer/src/bootstrap.rs | 2 +- applications/tari_indexer/src/event_scanner.rs | 10 +++++----- applications/tari_indexer/src/lib.rs | 9 ++++----- applications/tari_validator_node/src/bootstrap.rs | 2 +- .../tari_validator_node/src/consensus/mod.rs | 7 ++----- applications/tari_validator_node/src/lib.rs | 6 ++++-- dan_layer/consensus/src/block_validations.rs | 2 +- .../consensus}/src/consensus_constants.rs | 3 +++ dan_layer/consensus/src/hotstuff/common.rs | 4 ---- dan_layer/consensus/src/hotstuff/config.rs | 10 +++------- dan_layer/consensus/src/hotstuff/on_propose.rs | 12 ++++++++---- .../hotstuff/on_ready_to_vote_on_local_block.rs | 13 ++++++++----- .../src/hotstuff/on_receive_local_proposal.rs | 10 ++++++---- dan_layer/consensus/src/hotstuff/worker.rs | 4 ++-- dan_layer/consensus/src/lib.rs | 1 + .../src/support/validator/builder.rs | 14 ++++++++++---- 21 files changed, 65 insertions(+), 55 deletions(-) rename {applications/tari_dan_app_utilities => dan_layer/consensus}/src/consensus_constants.rs (93%) diff --git a/Cargo.lock b/Cargo.lock index 3abdf14f9..642fd158f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9068,6 +9068,7 @@ dependencies = [ "tari_bor", "tari_common", "tari_common_types", + "tari_consensus", "tari_core", "tari_crypto", "tari_dan_common_types", @@ -9462,6 +9463,7 @@ dependencies = [ "tari_bor", "tari_common", "tari_common_types", + "tari_consensus", "tari_crypto", "tari_dan_app_utilities", "tari_dan_common_types", diff --git a/applications/tari_dan_app_utilities/Cargo.toml b/applications/tari_dan_app_utilities/Cargo.toml index ffbc8b267..2f33963c3 100644 --- a/applications/tari_dan_app_utilities/Cargo.toml +++ b/applications/tari_dan_app_utilities/Cargo.toml @@ -11,6 +11,7 @@ tari_common = { workspace = true } tari_common_types = { workspace = true } tari_core = { workspace = true, default-features = false, features = ["transactions"] } tari_crypto = { workspace = true } +tari_consensus = { workspace = true } tari_shutdown = { workspace = true } tari_dan_common_types = { workspace = true } tari_state_store_sqlite = { workspace = true } diff --git a/applications/tari_dan_app_utilities/src/base_layer_scanner.rs b/applications/tari_dan_app_utilities/src/base_layer_scanner.rs index bd3efff14..1a7bacabb 100644 --- a/applications/tari_dan_app_utilities/src/base_layer_scanner.rs +++ b/applications/tari_dan_app_utilities/src/base_layer_scanner.rs @@ -30,6 +30,7 @@ use tari_base_node_client::{ BaseNodeClientError, }; use tari_common_types::types::{Commitment, FixedHash, FixedHashSizeError, PublicKey}; +use tari_consensus::consensus_constants::ConsensusConstants; use tari_core::transactions::{ tari_amount::MicroMinotari, transaction_components::{ @@ -61,10 +62,7 @@ use tari_state_store_sqlite::SqliteStateStore; use tari_template_lib::models::{EncryptedData, TemplateAddress, UnclaimedConfidentialOutputAddress}; use tokio::{task, task::JoinHandle, time}; -use crate::{ - consensus_constants::ConsensusConstants, - template_manager::interface::{TemplateManagerError, TemplateManagerHandle, TemplateRegistration}, -}; +use crate::template_manager::interface::{TemplateManagerError, TemplateManagerHandle, TemplateRegistration}; const LOG_TARGET: &str = "tari::dan::base_layer_scanner"; diff --git a/applications/tari_dan_app_utilities/src/lib.rs b/applications/tari_dan_app_utilities/src/lib.rs index a3a46a0d2..c25b26074 100644 --- a/applications/tari_dan_app_utilities/src/lib.rs +++ b/applications/tari_dan_app_utilities/src/lib.rs @@ -22,7 +22,6 @@ pub mod base_layer_scanner; pub mod configuration; -pub mod consensus_constants; pub mod json_encoding; pub mod keypair; pub mod p2p_config; diff --git a/applications/tari_indexer/Cargo.toml b/applications/tari_indexer/Cargo.toml index 6b7b3e0be..8b00ed576 100644 --- a/applications/tari_indexer/Cargo.toml +++ b/applications/tari_indexer/Cargo.toml @@ -28,6 +28,7 @@ tari_indexer_lib = { workspace = true } tari_template_lib = { workspace = true } tari_transaction = { workspace = true } tari_dan_p2p = { workspace = true } +tari_consensus = { workspace = true } tari_validator_node_rpc = { workspace = true } tari_rpc_framework = { workspace = true } tari_networking = { workspace = true } diff --git a/applications/tari_indexer/src/bootstrap.rs b/applications/tari_indexer/src/bootstrap.rs index 102ad53ac..5393d8661 100644 --- a/applications/tari_indexer/src/bootstrap.rs +++ b/applications/tari_indexer/src/bootstrap.rs @@ -30,10 +30,10 @@ use tari_common::{ configuration::bootstrap::{grpc_default_port, ApplicationType}, exit_codes::{ExitCode, ExitError}, }; +use tari_consensus::consensus_constants::ConsensusConstants; use tari_crypto::tari_utilities::ByteArray; use tari_dan_app_utilities::{ base_layer_scanner, - consensus_constants::ConsensusConstants, keypair::RistrettoKeypair, seed_peer::SeedPeer, template_manager::{self, implementation::TemplateManager}, diff --git a/applications/tari_indexer/src/event_scanner.rs b/applications/tari_indexer/src/event_scanner.rs index 26556435e..25b70e2ed 100644 --- a/applications/tari_indexer/src/event_scanner.rs +++ b/applications/tari_indexer/src/event_scanner.rs @@ -26,8 +26,8 @@ use futures::StreamExt; use log::*; use tari_bor::decode; use tari_common::configuration::Network; +use tari_consensus::consensus_constants::ConsensusConstants; use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::message_format::MessageFormat}; -use tari_dan_app_utilities::consensus_constants::ConsensusConstants; use tari_dan_common_types::{committee::Committee, Epoch, NumPreshards, PeerAddress, ShardGroup}; use tari_dan_p2p::proto::rpc::{GetTransactionResultRequest, PayloadResultStatus, SyncBlocksRequest}; use tari_dan_storage::consensus_models::{Block, BlockError, BlockId, Decision, TransactionRecord}; @@ -101,6 +101,7 @@ pub struct EventScanner { client_factory: TariValidatorNodeRpcClientFactory, substate_store: SqliteSubstateStore, event_filters: Vec, + consensus_constants: ConsensusConstants, } impl EventScanner { @@ -111,6 +112,7 @@ impl EventScanner { client_factory: TariValidatorNodeRpcClientFactory, substate_store: SqliteSubstateStore, event_filters: Vec, + consensus_constants: ConsensusConstants, ) -> Self { Self { network, @@ -119,6 +121,7 @@ impl EventScanner { client_factory, substate_store, event_filters, + consensus_constants, } } @@ -476,10 +479,7 @@ impl EventScanner { let start_block_id = match start_block_id { Some(block_id) => block_id, - None => { - let consensus_constants = ConsensusConstants::from(self.network); - self.build_genesis_block_id(consensus_constants.num_preshards)? - }, + None => self.build_genesis_block_id(self.consensus_constants.num_preshards)?, }; committee.shuffle(); diff --git a/applications/tari_indexer/src/lib.rs b/applications/tari_indexer/src/lib.rs index 6b3aab818..0cff64fb5 100644 --- a/applications/tari_indexer/src/lib.rs +++ b/applications/tari_indexer/src/lib.rs @@ -51,11 +51,8 @@ use tari_common::{ configuration::bootstrap::{grpc_default_port, ApplicationType}, exit_codes::{ExitCode, ExitError}, }; -use tari_dan_app_utilities::{ - consensus_constants::ConsensusConstants, - keypair::setup_keypair_prompt, - substate_file_cache::SubstateFileCache, -}; +use tari_consensus::consensus_constants::ConsensusConstants; +use tari_dan_app_utilities::{keypair::setup_keypair_prompt, substate_file_cache::SubstateFileCache}; use tari_dan_storage::global::DbFactory; use tari_dan_storage_sqlite::SqliteDbFactory; use tari_epoch_manager::{EpochManagerEvent, EpochManagerReader}; @@ -179,6 +176,7 @@ pub async fn run_indexer(config: ApplicationConfig, mut shutdown_signal: Shutdow .map(TryInto::try_into) .collect::>() .map_err(|e| ExitError::new(ExitCode::ConfigError, format!("Invalid event filters: {}", e)))?; + let consensus_constants = ConsensusConstants::from(config.network); let event_scanner = Arc::new(EventScanner::new( config.network, config.indexer.sidechain_id, @@ -186,6 +184,7 @@ pub async fn run_indexer(config: ApplicationConfig, mut shutdown_signal: Shutdow services.validator_node_client_factory.clone(), services.substate_store.clone(), event_filters, + consensus_constants, )); // Run the GraphQL API diff --git a/applications/tari_validator_node/src/bootstrap.rs b/applications/tari_validator_node/src/bootstrap.rs index 61b833792..7bedc8ae1 100644 --- a/applications/tari_validator_node/src/bootstrap.rs +++ b/applications/tari_validator_node/src/bootstrap.rs @@ -34,13 +34,13 @@ use tari_common::{ configuration::Network, exit_codes::{ExitCode, ExitError}, }; +use tari_consensus::consensus_constants::ConsensusConstants; #[cfg(not(feature = "metrics"))] use tari_consensus::traits::hooks::NoopHooks; use tari_core::transactions::transaction_components::ValidatorNodeSignature; use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::ByteArray}; use tari_dan_app_utilities::{ base_layer_scanner, - consensus_constants::ConsensusConstants, keypair::RistrettoKeypair, seed_peer::SeedPeer, substate_file_cache::SubstateFileCache, diff --git a/applications/tari_validator_node/src/consensus/mod.rs b/applications/tari_validator_node/src/consensus/mod.rs index f0d22bf67..dd4954b66 100644 --- a/applications/tari_validator_node/src/consensus/mod.rs +++ b/applications/tari_validator_node/src/consensus/mod.rs @@ -8,7 +8,6 @@ use tari_consensus::{ }; use tari_crypto::ristretto::RistrettoPublicKey; use tari_dan_app_utilities::{ - consensus_constants::ConsensusConstants, template_manager::implementation::TemplateManager, transaction_executor::TariDanTransactionProcessor, }; @@ -52,6 +51,7 @@ mod spec; pub use block_transaction_executor::*; pub use handle::*; pub use signature_service::*; +use tari_consensus::consensus_constants::ConsensusConstants; use crate::{p2p::NopLogger, transaction_validators::WithContext}; @@ -84,10 +84,7 @@ pub async fn spawn( let hs_config = HotstuffConfig { network, sidechain_id, - max_base_layer_blocks_behind: consensus_constants.max_base_layer_blocks_behind, - max_base_layer_blocks_ahead: consensus_constants.max_base_layer_blocks_ahead, - num_preshards: consensus_constants.num_preshards, - pacemaker_max_base_time: consensus_constants.pacemaker_max_base_time, + consensus_constants, }; let hotstuff_worker = HotstuffWorker::::new( diff --git a/applications/tari_validator_node/src/lib.rs b/applications/tari_validator_node/src/lib.rs index 3554e2651..cb079d5ea 100644 --- a/applications/tari_validator_node/src/lib.rs +++ b/applications/tari_validator_node/src/lib.rs @@ -48,7 +48,8 @@ use tari_common::{ configuration::bootstrap::{grpc_default_port, ApplicationType}, exit_codes::{ExitCode, ExitError}, }; -use tari_dan_app_utilities::{consensus_constants::ConsensusConstants, keypair::setup_keypair_prompt}; +use tari_consensus::consensus_constants::ConsensusConstants; +use tari_dan_app_utilities::keypair::setup_keypair_prompt; use tari_dan_common_types::SubstateAddress; use tari_dan_storage::global::DbFactory; use tari_dan_storage_sqlite::SqliteDbFactory; @@ -116,13 +117,14 @@ pub async fn run_validator_node( #[cfg(feature = "metrics")] let metrics_registry = create_metrics_registry(keypair.public_key()); + let consensus_constants = ConsensusConstants::from(config.network); let base_node_client = create_base_layer_client(config).await?; let services = spawn_services( config, shutdown_signal.clone(), keypair.clone(), global_db, - ConsensusConstants::devnet(), // TODO: change this eventually + consensus_constants, base_node_client.clone(), #[cfg(feature = "metrics")] &metrics_registry, diff --git a/dan_layer/consensus/src/block_validations.rs b/dan_layer/consensus/src/block_validations.rs index 8d2e9b4c1..60da4be13 100644 --- a/dan_layer/consensus/src/block_validations.rs +++ b/dan_layer/consensus/src/block_validations.rs @@ -79,7 +79,7 @@ pub async fn check_base_layer_block_hash( // current: current_height, // })?; // } - if base_layer_block_height > current_height + config.max_base_layer_blocks_ahead { + if base_layer_block_height > current_height + config.consensus_constants.max_base_layer_blocks_ahead { Err(ProposalValidationError::BlockHeightTooHigh { proposed: base_layer_block_height, current: current_height, diff --git a/applications/tari_dan_app_utilities/src/consensus_constants.rs b/dan_layer/consensus/src/consensus_constants.rs similarity index 93% rename from applications/tari_dan_app_utilities/src/consensus_constants.rs rename to dan_layer/consensus/src/consensus_constants.rs index c88839dfb..7895e2f52 100644 --- a/applications/tari_dan_app_utilities/src/consensus_constants.rs +++ b/dan_layer/consensus/src/consensus_constants.rs @@ -33,6 +33,8 @@ pub struct ConsensusConstants { pub max_base_layer_blocks_behind: u64, pub num_preshards: NumPreshards, pub pacemaker_max_base_time: Duration, + /// The value that fees are divided by to determine the amount of fees to burn. 0 means no fees are burned. + pub fee_exhaust_divisor: u64, } impl ConsensusConstants { @@ -44,6 +46,7 @@ impl ConsensusConstants { max_base_layer_blocks_behind: 5, num_preshards: NumPreshards::P256, pacemaker_max_base_time: Duration::from_secs(10), + fee_exhaust_divisor: 20, // 5% } } } diff --git a/dan_layer/consensus/src/hotstuff/common.rs b/dan_layer/consensus/src/hotstuff/common.rs index 503dbc1d1..de93f930d 100644 --- a/dan_layer/consensus/src/hotstuff/common.rs +++ b/dan_layer/consensus/src/hotstuff/common.rs @@ -46,10 +46,6 @@ use crate::{ const LOG_TARGET: &str = "tari::dan::consensus::hotstuff::common"; -/// The value that fees are divided by to determine the amount of fees to burn. 0 means no fees are burned. -/// This is a placeholder for the fee exhaust consensus constant so that we know where it's used later. -pub const EXHAUST_DIVISOR: u64 = 20; // 5% - /// Calculates the dummy block required to reach the new height and returns the last dummy block (parent for next /// proposal). pub fn calculate_last_dummy_block>( diff --git a/dan_layer/consensus/src/hotstuff/config.rs b/dan_layer/consensus/src/hotstuff/config.rs index 72c7d3691..da50fc033 100644 --- a/dan_layer/consensus/src/hotstuff/config.rs +++ b/dan_layer/consensus/src/hotstuff/config.rs @@ -1,18 +1,14 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -use std::time::Duration; - use tari_common::configuration::Network; use tari_crypto::ristretto::RistrettoPublicKey; -use tari_dan_common_types::NumPreshards; + +use crate::consensus_constants::ConsensusConstants; #[derive(Debug, Clone)] pub struct HotstuffConfig { pub network: Network, - pub max_base_layer_blocks_ahead: u64, - pub max_base_layer_blocks_behind: u64, - pub num_preshards: NumPreshards, - pub pacemaker_max_base_time: Duration, pub sidechain_id: Option, + pub consensus_constants: ConsensusConstants, } diff --git a/dan_layer/consensus/src/hotstuff/on_propose.rs b/dan_layer/consensus/src/hotstuff/on_propose.rs index 9d728e773..a97b64d42 100644 --- a/dan_layer/consensus/src/hotstuff/on_propose.rs +++ b/dan_layer/consensus/src/hotstuff/on_propose.rs @@ -66,7 +66,6 @@ use crate::{ TransactionLockConflicts, }, HotstuffConfig, - EXHAUST_DIVISOR, }, messages::{HotstuffMessage, ProposalMessage}, tracing::TraceTimer, @@ -497,7 +496,11 @@ where TConsensusSpec: ConsensusSpec ); // batch is empty for is_empty, is_epoch_end and is_epoch_start blocks - let mut substate_store = PendingSubstateStore::new(tx, *parent_block.block_id(), self.config.num_preshards); + let mut substate_store = PendingSubstateStore::new( + tx, + *parent_block.block_id(), + self.config.consensus_constants.num_preshards, + ); let mut executed_transactions = HashMap::new(); let timer = TraceTimer::info(LOG_TARGET, "Generating commands").with_iterations(batch.len()); let mut lock_conflicts = TransactionLockConflicts::new(); @@ -657,7 +660,8 @@ where TConsensusSpec: ConsensusSpec if tx_rec.current_decision().is_commit() { let involved = NonZeroU64::new(1).expect("1 > 0"); - let leader_fee = tx_rec.calculate_leader_fee(involved, EXHAUST_DIVISOR); + let leader_fee = + tx_rec.calculate_leader_fee(involved, self.config.consensus_constants.fee_exhaust_divisor); tx_rec.set_leader_fee(leader_fee); let diff = execution.result().finalize.result.accept().ok_or_else(|| { HotStuffError::InvariantError(format!( @@ -863,7 +867,7 @@ where TConsensusSpec: ConsensusSpec tx_rec.transaction_id(), )) })?; - let leader_fee = tx_rec.calculate_leader_fee(involved, EXHAUST_DIVISOR); + let leader_fee = tx_rec.calculate_leader_fee(involved, self.config.consensus_constants.fee_exhaust_divisor); tx_rec.set_leader_fee(leader_fee); } let atom = tx_rec.get_current_transaction_atom(); diff --git a/dan_layer/consensus/src/hotstuff/on_ready_to_vote_on_local_block.rs b/dan_layer/consensus/src/hotstuff/on_ready_to_vote_on_local_block.rs index a968012d6..fb877f53d 100644 --- a/dan_layer/consensus/src/hotstuff/on_ready_to_vote_on_local_block.rs +++ b/dan_layer/consensus/src/hotstuff/on_ready_to_vote_on_local_block.rs @@ -61,7 +61,6 @@ use crate::{ }, HotstuffConfig, ProposalValidationError, - EXHAUST_DIVISOR, }, tracing::TraceTimer, traits::{ConsensusSpec, WriteableSubstateStore}, @@ -297,7 +296,8 @@ where TConsensusSpec: ConsensusSpec ) -> Result<(), HotStuffError> { // Store used for transactions that have inputs without specific versions. // It lives through the entire block so multiple transactions can be sequenced together in the same block - let mut substate_store = PendingSubstateStore::new(tx, *block.parent(), self.config.num_preshards); + let mut substate_store = + PendingSubstateStore::new(tx, *block.parent(), self.config.consensus_constants.num_preshards); let mut total_leader_fee = 0; let locked_block = LockedBlock::get(tx, block.epoch())?; @@ -613,8 +613,10 @@ where TConsensusSpec: ConsensusSpec return Ok(Some(NoVoteReason::NoLeaderFee)); } - let calculated_leader_fee = - tx_rec.calculate_leader_fee(NonZeroU64::new(1).expect("1 > 0"), EXHAUST_DIVISOR); + let calculated_leader_fee = tx_rec.calculate_leader_fee( + NonZeroU64::new(1).expect("1 > 0"), + self.config.consensus_constants.fee_exhaust_divisor, + ); if calculated_leader_fee != *atom.leader_fee.as_ref().expect("None already checked") { warn!( target: LOG_TARGET, @@ -1226,7 +1228,8 @@ where TConsensusSpec: ConsensusSpec let num_involved_shard_groups = tx_rec.evidence().num_shard_groups(); let involved = NonZeroU64::new(num_involved_shard_groups as u64) .ok_or_else(|| HotStuffError::InvariantError("Number of involved shard groups is 0".to_string()))?; - let calculated_leader_fee = tx_rec.calculate_leader_fee(involved, EXHAUST_DIVISOR); + let calculated_leader_fee = + tx_rec.calculate_leader_fee(involved, self.config.consensus_constants.fee_exhaust_divisor); if calculated_leader_fee != *leader_fee { warn!( target: LOG_TARGET, diff --git a/dan_layer/consensus/src/hotstuff/on_receive_local_proposal.rs b/dan_layer/consensus/src/hotstuff/on_receive_local_proposal.rs index df0bd8653..376299f7b 100644 --- a/dan_layer/consensus/src/hotstuff/on_receive_local_proposal.rs +++ b/dan_layer/consensus/src/hotstuff/on_receive_local_proposal.rs @@ -314,7 +314,9 @@ impl OnReceiveLocalProposalHandler OnReceiveLocalProposalHandler OnReceiveLocalProposalHandler OnReceiveLocalProposalHandler HotstuffWorker { shutdown: ShutdownSignal, ) -> Self { let (tx_missing_transactions, rx_missing_transactions) = mpsc::unbounded_channel(); - let pacemaker = PaceMaker::new(config.pacemaker_max_base_time); + let pacemaker = PaceMaker::new(config.consensus_constants.pacemaker_max_base_time); let vote_receiver = VoteCollector::new( config.network, state_store.clone(), @@ -735,7 +735,7 @@ impl HotstuffWorker { // The parent for genesis blocks refer to this zero block let mut zero_block = Block::zero_block( self.config.network, - self.config.num_preshards, + self.config.consensus_constants.num_preshards, self.config.sidechain_id.clone(), )?; if !zero_block.exists(&**tx)? { diff --git a/dan_layer/consensus/src/lib.rs b/dan_layer/consensus/src/lib.rs index 1136a5847..125ef4825 100644 --- a/dan_layer/consensus/src/lib.rs +++ b/dan_layer/consensus/src/lib.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: BSD-3-Clause mod block_validations; +pub mod consensus_constants; pub mod hotstuff; pub mod messages; mod tracing; diff --git a/dan_layer/consensus_tests/src/support/validator/builder.rs b/dan_layer/consensus_tests/src/support/validator/builder.rs index 5375ade32..638f0ea13 100644 --- a/dan_layer/consensus_tests/src/support/validator/builder.rs +++ b/dan_layer/consensus_tests/src/support/validator/builder.rs @@ -6,6 +6,7 @@ use std::time::Duration; use tari_common::configuration::Network; use tari_common_types::types::{PrivateKey, PublicKey}; use tari_consensus::{ + consensus_constants::ConsensusConstants, hotstuff::{ConsensusCurrentState, ConsensusWorker, ConsensusWorkerContext, HotstuffConfig, HotstuffWorker}, traits::hooks::NoopHooks, }; @@ -134,12 +135,17 @@ impl ValidatorBuilder { let worker = HotstuffWorker::::new( HotstuffConfig { - num_preshards: TEST_NUM_PRESHARDS, - max_base_layer_blocks_ahead: 5, - max_base_layer_blocks_behind: 5, network: Network::LocalNet, - pacemaker_max_base_time: self.block_time, sidechain_id: None, + consensus_constants: ConsensusConstants { + base_layer_confirmations: 0, + committee_size: 0, + max_base_layer_blocks_ahead: 5, + max_base_layer_blocks_behind: 5, + num_preshards: TEST_NUM_PRESHARDS, + pacemaker_max_base_time: self.block_time, + fee_exhaust_divisor: 0, + }, }, self.address.clone(), inbound_messaging,