Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: setConsensusState when light client is initialized #58

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions ibc/lightclients/groth16/client_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,15 @@ func (cs ClientState) ZeroCustomFields() exported.ClientState {
}
}

// initialize will check that initial consensus state is a groth16 consensus state
// and will store ProcessedTime for initial consensus state as ctx.BlockTime()
func (cs ClientState) initialize(ctx context.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, consState exported.ConsensusState) error {
if _, ok := consState.(*ConsensusState); !ok {
return sdkerrors.Wrapf(clienttypes.ErrInvalidConsensus, "invalid initial consensus state. expected type: %T, got: %T",
&ConsensusState{}, consState)
func (cs ClientState) initialize(ctx context.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, initialConsensusState exported.ConsensusState) error {
consensusState, ok := initialConsensusState.(*ConsensusState)
if !ok {
return sdkerrors.Wrapf(clienttypes.ErrInvalidConsensus, "invalid initial consensus state. expected type: %T, got: %T", &ConsensusState{}, initialConsensusState)
}
// TODO: should we be setting consensus state? probably (nina)
height := cs.GetLatestClientHeight()
SetConsensusState(clientStore, cdc, consensusState, height)
setConsensusMetadata(ctx, clientStore, height)
setClientState(clientStore, cdc, &cs)
// set metadata for initial consensus state.
setConsensusMetadata(ctx, clientStore, cs.GetLatestClientHeight())
return nil
}

Expand Down
Loading