-
Notifications
You must be signed in to change notification settings - Fork 0
/
consumer.go
32 lines (28 loc) · 1.58 KB
/
consumer.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
package testutil
import (
"time"
ibctypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v3/modules/core/23-commitment/types"
ibctmtypes "github.com/cosmos/ibc-go/v3/modules/light-clients/07-tendermint/types"
ccvconsumertypes "github.com/cosmos/interchain-security/x/ccv/consumer/types"
ccvprovidertypes "github.com/cosmos/interchain-security/x/ccv/provider/types"
)
// This function creates consumer module genesis state that is used as starting point for modifications
// that allow imperator chain to be started locally without having to start the provider chain and the relayer.
// It is also used in tests that are starting the chain node.
func CreateMinimalConsumerTestGenesis() *ccvconsumertypes.GenesisState {
genesisState := ccvconsumertypes.DefaultGenesisState()
genesisState.Params.Enabled = true
genesisState.NewChain = true
genesisState.ProviderClientState = ccvprovidertypes.DefaultParams().TemplateClient
genesisState.ProviderClientState.ChainId = "imperator"
genesisState.ProviderClientState.LatestHeight = ibctypes.Height{RevisionNumber: 0, RevisionHeight: 1}
genesisState.ProviderClientState.TrustingPeriod = genesisState.Params.UnbondingPeriod / ccvprovidertypes.DefaultTrustingPeriodFraction
genesisState.ProviderClientState.UnbondingPeriod = genesisState.Params.UnbondingPeriod
genesisState.ProviderClientState.MaxClockDrift = ccvprovidertypes.DefaultMaxClockDrift
genesisState.ProviderConsensusState = &ibctmtypes.ConsensusState{
Timestamp: time.Now().UTC(),
Root: types.MerkleRoot{Hash: []byte("dummy")},
}
return genesisState
}