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 = 10_000;
47
48/// Default values for the upgrade constants
49pub const DEFAULT_UPGRADE_CONSTANTS: UpgradeConstants = UpgradeConstants {
50 // lead time before the proposer attaches the cert; votes are collected over it
51 propose_offset: 20,
52 // deadline to decide the cert, else it's discarded
53 decide_by_offset: 105,
54 // last old-version view; only empty blocks are proposed until finish
55 begin_offset: 125,
56 // first new-version view; ends the empty-block transition
57 finish_offset: 130,
58};
59
60/// Default values for the upgrade constants to be used in testing
61pub const TEST_UPGRADE_CONSTANTS: UpgradeConstants = UpgradeConstants {
62 propose_offset: 5,
63 decide_by_offset: 10,
64 begin_offset: 15,
65 finish_offset: 20,
66};
67
68/// The `tide` module name for the legacy builder
69pub const LEGACY_BUILDER_MODULE: &str = "block_info";
70
71/// The `tide` module name for the marketplace builder
72pub const MARKETPLACE_BUILDER_MODULE: &str = "bundle_info";
73
74/// default number of rounds to run
75pub const ORCHESTRATOR_DEFAULT_NUM_ROUNDS: usize = 100;
76/// default number of transactions per round
77pub const ORCHESTRATOR_DEFAULT_TRANSACTIONS_PER_ROUND: usize = 10;
78/// default size of transactions
79pub const ORCHESTRATOR_DEFAULT_TRANSACTION_SIZE: usize = 100;