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