Skip to content

Commit

Permalink
Resolve +-1 question mark in MakeConsumerGenesis (#500)
Browse files Browse the repository at this point in the history
update MakeConsumerGenesis comments

Co-authored-by: Daniel T <[email protected]>
  • Loading branch information
mpoke and danwt authored Nov 21, 2022
1 parent 87c21be commit 25b0d01
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions x/ccv/provider/keeper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,11 @@ func (k Keeper) MakeConsumerGenesis(ctx sdk.Context) (gen consumertypes.GenesisS
height := clienttypes.GetSelfHeight(ctx)

clientState := k.GetTemplateClient(ctx)
clientState.ChainId = ctx.ChainID() // This will be the counter party chain ID for the consumer
clientState.LatestHeight = height //(+-1???)
// this is the counter party chain ID for the consumer
clientState.ChainId = ctx.ChainID()
// this is the latest height the client was updated at, i.e.,
// the height of the latest consensus state (see below)
clientState.LatestHeight = height
clientState.TrustingPeriod = providerUnbondingPeriod / time.Duration(k.GetTrustingPeriodFraction(ctx))
clientState.UnbondingPeriod = providerUnbondingPeriod

Expand All @@ -239,7 +242,8 @@ func (k Keeper) MakeConsumerGenesis(ctx sdk.Context) (gen consumertypes.GenesisS

gen.Params.Enabled = true
gen.NewChain = true
// This will become the ccv client state for the consumer
// the client state and consensus state needed by the consumer
// to create a client to the provider
gen.ProviderClientState = clientState
gen.ProviderConsensusState = consState.(*ibctmtypes.ConsensusState)

Expand Down

0 comments on commit 25b0d01

Please sign in to comment.