hotshot_types/constants.rs
1// Copyright (c) 2021-2024 Espresso Systems (espressosys.com)
2// This file is part of the HotShot repository.
3
4// You should have received a copy of the MIT License
5// along with the HotShot repository. If not, see <https://mit-license.org/>.
6
7//! configurable constants for hotshot
8
9use std::time::Duration;
10
11use crate::upgrade_config::UpgradeConstants;
12
13/// timeout for fetching auction results from the solver
14pub const AUCTION_RESULTS_FETCH_TIMEOUT: Duration = Duration::from_millis(500);
15
16/// timeout for fetching bundles from builders
17pub const BUNDLE_FETCH_TIMEOUT: Duration = Duration::from_millis(500);
18
19/// the number of views to gather information for ahead of time
20pub const LOOK_AHEAD: u64 = 5;
21
22/// the default kademlia record republication interval (in seconds)
23pub const KAD_DEFAULT_REPUB_INTERVAL_SEC: u64 = 28800;
24
25/// the number of messages to cache in the combined network
26pub const COMBINED_NETWORK_CACHE_SIZE: usize = 5_000;
27
28/// the number of messages to attempt to send over the primary network before switching to prefer the secondary network
29pub const COMBINED_NETWORK_MIN_PRIMARY_FAILURES: u64 = 5;
30
31/// the number of messages to send over the secondary network without delay before re-attempting the (presumed down) primary network
32pub const COMBINED_NETWORK_PRIMARY_CHECK_INTERVAL: u64 = 50;
33
34/// the default delay duration value in milliseconds of sending on the secondary in the combined networks
35pub const COMBINED_NETWORK_DELAY_DURATION: u64 = 5000;
36
37/// The default network data request delay in milliseconds
38pub const REQUEST_DATA_DELAY: u64 = 5000;
39
40/// Default channel size for consensus event sharing
41pub const EVENT_CHANNEL_SIZE: usize = 100_000;
42
43/// Default channel size for HotShot -> application communication
44pub const EXTERNAL_EVENT_CHANNEL_SIZE: usize = 100_000;
45
46/// Default values for the upgrade constants
47pub const DEFAULT_UPGRADE_CONSTANTS: UpgradeConstants = UpgradeConstants {
48 propose_offset: 5,
49 decide_by_offset: 105,
50 begin_offset: 110,
51 finish_offset: 115,
52};
53
54/// Default values for the upgrade constants to be used in testing
55pub const TEST_UPGRADE_CONSTANTS: UpgradeConstants = UpgradeConstants {
56 propose_offset: 5,
57 decide_by_offset: 10,
58 begin_offset: 15,
59 finish_offset: 20,
60};
61
62/// For `STAKE_TABLE_CAPACITY=200`, the light client prover (a.k.a. `hotshot-state-prover`)
63/// would need to generate proof for a circuit of slightly below 2^20 gates.
64/// Thus we need to support this upperbounded degree in our Structured Reference String (SRS),
65/// the `+2` is just an artifact from the jellyfish's Plonk proof system.
66#[allow(clippy::cast_possible_truncation)]
67pub const SRS_DEGREE: usize = 2u64.pow(20) as usize + 2;
68
69/// The `tide` module name for the legacy builder
70pub const LEGACY_BUILDER_MODULE: &str = "block_info";
71
72/// The `tide` module name for the marketplace builder
73pub const MARKETPLACE_BUILDER_MODULE: &str = "bundle_info";
74
75/// default number of rounds to run
76pub const ORCHESTRATOR_DEFAULT_NUM_ROUNDS: usize = 100;
77/// default number of transactions per round
78pub const ORCHESTRATOR_DEFAULT_TRANSACTIONS_PER_ROUND: usize = 10;
79/// default size of transactions
80pub const ORCHESTRATOR_DEFAULT_TRANSACTION_SIZE: usize = 100;