-
Notifications
You must be signed in to change notification settings - Fork 5
/
params.py
179 lines (163 loc) · 6.93 KB
/
params.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
from typing import Callable, Dict, List, Any
from numpy import nan
from subspace_model.const import *
from subspace_model.types import SubspaceModelParams, SubspaceModelState
from subspace_model.experiments.logic import predictable_trajectory
from subspace_model.experiments.logic import (
DEFAULT_REFERENCE_SUBSIDY_COMPONENTS,
MAINNET_REFERENCE_SUBSIDY_COMPONENTS,
DEFAULT_SLASH_FUNCTION,
MAGNITUDE,
NORMAL_GENERATOR,
POISSON_GENERATOR,
POSITIVE_INTEGER,
SUPPLY_ISSUED,
TRANSACTION_COUNT_PER_DAY_FUNCTION_CONSTANT_UTILIZATION_50,
TRANSACTION_COUNT_PER_DAY_FUNCTION_GROWING_UTILIZATION_TWO_YEARS,
TRANSACTION_COUNT_PER_DAY_FUNCTION_FROM_UTILIZATION_RATIOS,
WEEKLY_VARYING,
SCENARIO_GROUPS,
)
def operator_stake_per_ts_function(p: SubspaceModelParams, s: SubspaceModelState):
return 0.01
def nominator_stake_per_ts_function(p: SubspaceModelParams, s: SubspaceModelState):
return 0.01
def compute_weights_per_tx_function(p: SubspaceModelParams, s: SubspaceModelState):
return 60_000_000
DEFAULT_PARAMS = SubspaceModelParams(
# Meta
label="standard",
environmental_label="standard",
timestep_in_days=1,
# Mechanism Parameters
slash_function=DEFAULT_SLASH_FUNCTION,
reference_subsidy_components=DEFAULT_REFERENCE_SUBSIDY_COMPONENTS,
utilization_ratio_smooth_num_blocks=100,
# Implementation parameters
block_time_in_seconds=BLOCK_TIME,
archival_depth=ARCHIVAL_DEPTH,
archival_buffer_segment_size=SEGMENT_SIZE,
header_size=6_500, # how much data does every block contain on top of txs: signature, solution, consensus logs, etc. + votes + PoT
min_replication_factor=50,
max_block_size=int(3.75 * MIB_IN_BYTES), # 3.75 MiB
weight_to_fee=1 * SHANNON_IN_CREDITS,
# Economic Parameters
reward_recipients=10,
reward_proposer_share=0.3, # NOTE: to sweep
max_credit_supply=MAX_CREDIT_ISSUANCE,
credit_supply_definition=SUPPLY_ISSUED,
# Fees & Taxes
compute_fees_to_farmers=0.0, # NOTE: to sweep
compute_fees_tax_to_operators=0.05, # or `nomination_tax`
# Slash Parameters
slash_to_farmers=0.05,
# Other
initial_community_owned_supply_pct_of_max_credits=(1 / 33), # XXX
# Behavioral Parameters Between 0 and 1
operator_stake_per_ts_function=operator_stake_per_ts_function,
nominator_stake_per_ts_function=nominator_stake_per_ts_function,
transfer_operator_to_farmer_per_day_function=lambda p, s: 0.05,
transfer_farmer_to_nominator_per_day_function=lambda p, s: 0.01,
transfer_farmer_to_operator_per_day_function=lambda p, s: 0.01,
# Environmental Parameters (Integer positive in [0,inf])
## Environmental: Fees
priority_fee_function=lambda p, s: 0,
## Enviromental: Compute Weights per Tx
compute_weights_per_tx_function=compute_weights_per_tx_function,
min_compute_weights_per_tx=6_000_000, # XXX
compute_weight_per_bundle_function=lambda p, s: 10_000_000_000,
min_compute_weights_per_bundle=2_000_000_000, # XXX
## Environmental: Tx Sizes
transaction_size_function=lambda p, s: 256,
min_transaction_size=100, # XXX
bundle_size_function=lambda p, s: 1500,
min_bundle_size=250, # XXX
## Environmental: Tx Count
bundle_count_per_day_function=lambda p, s: 6 * BLOCKS_PER_DAY,
transaction_count_per_day_function=TRANSACTION_COUNT_PER_DAY_FUNCTION_FROM_UTILIZATION_RATIOS,
## Environmental: Slash Count
slash_per_day_function=lambda p, s: 0,
## Environmental: Space Pledged per Time
newly_pledged_space_per_day_function=lambda p, s: 100.0 * (2 ** 50),
utilization_ratio=0.01,
utilization_ratio_function=MAGNITUDE(SCENARIO_GROUPS([0.01])[0])
)
GOVERNANCE_SURFACE: Dict[str, List] = {
"reference_subsidy_components": MAINNET_REFERENCE_SUBSIDY_COMPONENTS(),
"reward_proposer_share": [1 / 10, 1 / 3],
"weight_to_fee": [
1 * SHANNON_IN_CREDITS,
100 * SHANNON_IN_CREDITS,
1_000 * SHANNON_IN_CREDITS,
10_000 * SHANNON_IN_CREDITS,
],
}
ENVIRONMENTAL_SCENARIOS: Dict[str, List[Callable]] = {
"utilization_ratio_function": [
MAGNITUDE(generator) for generator in SCENARIO_GROUPS([0.005, 0.01, 0.02])
],
"priority_fee_function": [
MAGNITUDE(generator) for generator in SCENARIO_GROUPS([0])
],
"slash_per_day_function": [
MAGNITUDE(generator) for generator in SCENARIO_GROUPS([0])
],
"operator_stake_per_ts_function": [
NORMAL_GENERATOR(0.01, 0.02)
],
"nominator_stake_per_ts_function": [
NORMAL_GENERATOR(0.01, 0.02)
],
"transfer_operator_to_farmer_per_day_function": [
MAGNITUDE(generator) for generator in SCENARIO_GROUPS([0.1])
],
"transfer_farmer_to_nominator_per_day_function": [
MAGNITUDE(generator) for generator in SCENARIO_GROUPS([0.025])
],
"transfer_farmer_to_operator_per_day_function": [
MAGNITUDE(generator) for generator in SCENARIO_GROUPS([0.025])
],
}
SPECIAL_ENVIRONMENTAL_SCENARIOS = {
"stochastic": {
# Behavioral Parameters Between 0 and 1
"operator_stake_per_ts_function": NORMAL_GENERATOR(0.01, 0.02),
"nominator_stake_per_ts_function": NORMAL_GENERATOR(0.01, 0.02),
"transfer_operator_to_farmer_per_day_function": MAGNITUDE(
NORMAL_GENERATOR(0.05, 0.05)
),
"transfer_farmer_to_nominator_per_day_function": MAGNITUDE(
NORMAL_GENERATOR(0.01, 0.02)
),
"transfer_farmer_to_operator_per_day_function": MAGNITUDE(
NORMAL_GENERATOR(0.01, 0.02)
),
# Environmental Parameters (Integer positive in [0,inf])
"environmental_label": "stochastic",
"priority_fee_function": POSITIVE_INTEGER(NORMAL_GENERATOR(0, 0.001)),
"compute_weights_per_tx_function": POSITIVE_INTEGER(
NORMAL_GENERATOR(60_000_000, 15_000_000)
),
"compute_weight_per_bundle_function": POSITIVE_INTEGER(
NORMAL_GENERATOR(10_000_000_000, 5_000_000_000)
),
"transaction_size_function": POSITIVE_INTEGER(NORMAL_GENERATOR(256, 100)),
"bundle_size_function": POSITIVE_INTEGER(NORMAL_GENERATOR(1500, 1000)),
"transaction_count_per_day_function": POISSON_GENERATOR(1 * BLOCKS_PER_DAY),
"bundle_count_per_day_function": POISSON_GENERATOR(6 * BLOCKS_PER_DAY),
"slash_per_day_function": POISSON_GENERATOR(0.1),
"new_sectors_per_day_function": POSITIVE_INTEGER(NORMAL_GENERATOR(1000, 500)),
},
"weekly-varying": {
"environmental_label": "weekly-varying",
"priority_fee_function": WEEKLY_VARYING,
},
"constant-utilization": {
"environmental_label": "constant-utilization",
"transaction_count_per_day_function": TRANSACTION_COUNT_PER_DAY_FUNCTION_CONSTANT_UTILIZATION_50,
},
"growing-utilization": {
"environmental_label": "growing-utilization",
"transaction_count_per_day_function": TRANSACTION_COUNT_PER_DAY_FUNCTION_GROWING_UTILIZATION_TWO_YEARS,
},
}