-
Notifications
You must be signed in to change notification settings - Fork 56
/
genesis.go
33 lines (27 loc) · 981 Bytes
/
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
package cmd
import (
"github.com/omni-network/omni/halo/genutil"
"github.com/omni-network/omni/lib/netconf"
"github.com/cometbft/cometbft/crypto"
"github.com/cometbft/cometbft/types"
cmttime "github.com/cometbft/cometbft/types/time"
cosmostypes "github.com/cosmos/cosmos-sdk/types"
)
func MakeGenesis(network netconf.ID, valPubKeys ...crypto.PubKey) (*types.GenesisDoc, error) {
power := cosmostypes.DefaultPowerReduction // Use any non-zero power for this single validator.
cometVals := make([]types.GenesisValidator, 0, len(valPubKeys))
for _, pubkey := range valPubKeys {
cometVals = append(cometVals, types.GenesisValidator{
Address: pubkey.Address(),
PubKey: pubkey,
Power: power.Int64(),
})
}
return &types.GenesisDoc{
ChainID: network.Static().OmniConsensusChainIDStr(),
GenesisTime: cmttime.Now(),
ConsensusParams: genutil.DefaultConsensusParams(),
Validators: cometVals,
AppState: []byte("{}"),
}, nil
}