/
constant.go
209 lines (198 loc) 路 7.3 KB
/
constant.go
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
// SPDX-FileCopyrightText: 2024 PK Lab AG <contact@pklab.io>
// SPDX-License-Identifier: MIT
package genesis
import (
"strconv"
"strings"
"github.com/celenium-io/celestia-indexer/internal/storage"
storageTypes "github.com/celenium-io/celestia-indexer/internal/storage/types"
"github.com/celenium-io/celestia-indexer/pkg/node/types"
pkgTypes "github.com/celenium-io/celestia-indexer/pkg/types"
)
func (module *Module) parseConstants(appState types.AppState, consensus pkgTypes.ConsensusParams, data *parsedData) {
// consensus
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameConsensus,
Name: "block_max_bytes",
Value: strconv.FormatInt(consensus.Block.MaxBytes, 10),
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameConsensus,
Name: "block_max_gas",
Value: strconv.FormatInt(consensus.Block.MaxGas, 10),
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameConsensus,
Name: "evidence_max_age_num_blocks",
Value: strconv.FormatInt(consensus.Evidence.MaxAgeNumBlocks, 10),
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameConsensus,
Name: "evidence_max_bytes",
Value: strconv.FormatInt(consensus.Evidence.MaxBytes, 10),
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameConsensus,
Name: "evidence_max_age_duration",
Value: consensus.Evidence.MaxAgeDuration.String(),
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameConsensus,
Name: "validator_pub_key_types",
Value: strings.Join(consensus.Validator.PubKeyTypes, ", "),
})
// auth
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameAuth,
Name: "max_memo_characters",
Value: appState.Auth.Params.MaxMemoCharacters,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameAuth,
Name: "tx_sig_limit",
Value: appState.Auth.Params.TxSigLimit,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameAuth,
Name: "tx_size_cost_per_byte",
Value: appState.Auth.Params.TxSizeCostPerByte,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameAuth,
Name: "sig_verify_cost_ed25519",
Value: appState.Auth.Params.SigVerifyCostEd25519,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameAuth,
Name: "sig_verify_cost_secp256k1",
Value: appState.Auth.Params.SigVerifyCostSecp256K1,
})
// blob
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameBlob,
Name: "gas_per_blob_byte",
Value: strconv.FormatInt(int64(appState.Blob.Params.GasPerBlobByte), 10),
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameBlob,
Name: "gov_max_square_size",
Value: appState.Blob.Params.GovMaxSquareSize,
})
// crisis
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameCrisis,
Name: "constant_fee",
Value: appState.Crisis.ConstantFee.String(),
})
// distribution
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameDistribution,
Name: "community_tax",
Value: appState.Distribution.Params.CommunityTax,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameDistribution,
Name: "base_proposer_reward",
Value: appState.Distribution.Params.BaseProposerReward,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameDistribution,
Name: "bonus_proposer_reward",
Value: appState.Distribution.Params.BonusProposerReward,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameDistribution,
Name: "withdraw_addr_enabled",
Value: strconv.FormatBool(appState.Distribution.Params.WithdrawAddrEnabled),
})
// gov
if len(appState.Gov.DepositParams.MinDeposit) > 0 {
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameGov,
Name: "min_deposit",
Value: appState.Gov.DepositParams.MinDeposit[0].String(),
})
}
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameGov,
Name: "max_deposit_period",
Value: appState.Gov.DepositParams.MaxDepositPeriod,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameGov,
Name: "voting_period",
Value: appState.Gov.VotingParams.VotingPeriod,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameGov,
Name: "quorum",
Value: appState.Gov.TallyParams.Quorum,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameGov,
Name: "threshold",
Value: appState.Gov.TallyParams.Threshold,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameGov,
Name: "veto_threshold",
Value: appState.Gov.TallyParams.VetoThreshold,
})
// slashing
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameSlashing,
Name: "signed_blocks_window",
Value: appState.Slashing.Params.SignedBlocksWindow,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameSlashing,
Name: "min_signed_per_window",
Value: appState.Slashing.Params.MinSignedPerWindow,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameSlashing,
Name: "downtime_jail_duration",
Value: appState.Slashing.Params.DowntimeJailDuration,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameSlashing,
Name: "slash_fraction_double_sign",
Value: appState.Slashing.Params.SlashFractionDoubleSign,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameSlashing,
Name: "slash_fraction_downtime",
Value: appState.Slashing.Params.SlashFractionDowntime,
})
// staking
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameStaking,
Name: "unbonding_time",
Value: appState.Staking.Params.UnbondingTime,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameStaking,
Name: "max_validators",
Value: strconv.FormatInt(int64(appState.Staking.Params.MaxValidators), 10),
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameStaking,
Name: "max_entries",
Value: strconv.FormatInt(int64(appState.Staking.Params.MaxEntries), 10),
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameStaking,
Name: "historical_entries",
Value: strconv.FormatInt(int64(appState.Staking.Params.HistoricalEntries), 10),
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameStaking,
Name: "bond_denom",
Value: appState.Staking.Params.BondDenom,
})
data.constants = append(data.constants, storage.Constant{
Module: storageTypes.ModuleNameStaking,
Name: "min_commission_rate",
Value: appState.Staking.Params.MinCommissionRate,
})
}