forked from omni-network/omni
-
Notifications
You must be signed in to change notification settings - Fork 1
/
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
}