-
Notifications
You must be signed in to change notification settings - Fork 135
/
genesis.go
77 lines (60 loc) · 2.75 KB
/
genesis.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
package types
import (
sdkerrors "cosmossdk.io/errors"
"cosmossdk.io/math"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
)
// DefaultParamspace defines the default auth module parameter subspace
const (
// todo: implement oracle constants as params
DefaultParamspace = ModuleName
)
var (
// AttestationVotesPowerThreshold threshold of votes power to succeed
AttestationVotesPowerThreshold = math.NewInt(66)
// ParamsStoreKeyContractHash stores the contract hash
ParamsStoreKeyContractHash = []byte("ContractHash")
// ParamsStoreKeyBridgeContractAddress stores the ethereum address
ParamsStoreKeyBridgeEthereumAddress = []byte("BridgeEthereumAddress")
// ParamsStoreKeyBridgeContractChainID stores the bridge chain id
ParamsStoreKeyBridgeContractChainID = []byte("BridgeChainID")
// ParamsStoreKeySignedBatchesWindow stores the signed blocks window
ParamsStoreKeySignedBatchesWindow = []byte("SignedBatchesWindow")
// ParamsStoreKeySignedClaimsWindow stores the signed blocks window
ParamsStoreKeyTargetBatchTimeout = []byte("TargetBatchTimeout")
// ParamsStoreKeySignedClaimsWindow stores the signed blocks window
ParamsStoreKeyAverageBlockTime = []byte("AverageBlockTime")
// ParamsStoreKeySignedClaimsWindow stores the signed blocks window
ParamsStoreKeyAverageEthereumBlockTime = []byte("AverageEthereumBlockTime")
// ParamsStoreSlashFractionBatch stores the slash fraction Batch
ParamsStoreSlashFractionBatch = []byte("SlashFractionBatch")
// ParamStoreSlashFractionBadEthSignature stores the amount by which a validator making a fraudulent eth signature will be slashed
ParamStoreSlashFractionBadEthSignature = []byte("SlashFractionBadEthSignature")
// ResetBridgeState boolean indicates the oracle events of the bridge history should be reset
ParamStoreResetBridgeState = []byte("ResetBridgeState")
// ResetBridgeHeight stores the nonce after which oracle events should be discarded when resetting the bridge
ParamStoreResetBridgeNonce = []byte("ResetBridgeNonce")
// Ensure that params implements the proper interface
_ paramtypes.ParamSet = &Params{}
)
// ValidateBasic validates genesis state by looping through the params and
// calling their validation functions
func (s GenesisState) ValidateBasic() error {
if err := s.Params.ValidateBasic(); err != nil {
return sdkerrors.Wrap(err, "params")
}
return nil
}
// DefaultGenesisState returns empty genesis state
// nolint: exhaustruct
func DefaultGenesisState() *GenesisState {
return &GenesisState{
Params: DefaultParams(),
SkywayNonces: []SkywayNonces{},
Batches: []OutgoingTxBatch{},
BatchConfirms: []MsgConfirmBatch{},
Attestations: []Attestation{},
Erc20ToDenoms: []ERC20ToDenom{},
UnbatchedTransfers: []OutgoingTransferTx{},
}
}