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(x/consensus)!: update cons params parsing checks (backport #21484) #21493

Merged
merged 3 commits into from
Sep 2, 2024
Merged
Changes from 1 commit
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
34 changes: 34 additions & 0 deletions x/consensus/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,49 @@
return nil, err
}

paramsProto, err := k.ParamsStore.Get(ctx)

Check failure on line 77 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / dependency-review

paramsProto declared and not used
if err != nil {
return nil, err
}
<<<<<<< HEAD

Check failure on line 81 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / dependency-review

expected statement, found '<<'

Check failure on line 81 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (02)

syntax error: unexpected <<, expected }

Check failure on line 81 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (03)

syntax error: unexpected <<, expected }

Check failure on line 81 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (03)

syntax error: unexpected <<, expected }

Check failure on line 81 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: unexpected <<, expected }

Check failure on line 81 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: unexpected <<, expected }

Check failure on line 81 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected <<, expected }

Check failure on line 81 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected <<, expected }

Check failure on line 81 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected <<, expected }

Check failure on line 81 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected <<, expected }
params := cmttypes.ConsensusParamsFromProto(paramsProto)
=======

if err := k.ParamsStore.Set(ctx, nextParams.ToProto()); err != nil {

Check failure on line 85 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: nextParams
return nil, err
}

if err := k.EventService.EventManager(ctx).EmitKV(

Check failure on line 89 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / dependency-review

k.EventService undefined (type Keeper has no field or method EventService)
"update_consensus_params",
event.NewAttribute("authority", msg.Authority),

Check failure on line 91 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: event.NewAttribute
event.NewAttribute("parameters", consensusParams.String())); err != nil {

Check failure on line 92 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: event.NewAttribute
return nil, err
}

return &types.MsgUpdateParamsResponse{}, nil
}

// paramCheck validates the consensus params
func (k Keeper) paramCheck(ctx context.Context, consensusParams cmtproto.ConsensusParams) (*cmttypes.ConsensusParams, error) {
var params cmttypes.ConsensusParams

paramsProto, err := k.ParamsStore.Get(ctx)
if err == nil {
// initialize version params with zero value if not set
if paramsProto.Version == nil {
paramsProto.Version = &cmtproto.VersionParams{}
}
params = cmttypes.ConsensusParamsFromProto(paramsProto)
} else if errors.Is(err, collections.ErrNotFound) {

Check failure on line 110 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: errors.Is
params = cmttypes.ConsensusParams{}
} else {
return nil, err
}
>>>>>>> f79b3802a (fix(x/consensus)!: update cons params parsing checks (#21484))

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / dependency-review

expected statement, found '>>'

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / dependency-review

illegal character U+0023 '#'

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (02)

syntax error: unexpected >>, expected }

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (02)

invalid character U+0023 '#'

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (03)

syntax error: unexpected >>, expected }

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (03)

invalid character U+0023 '#'

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (03)

syntax error: unexpected >>, expected }

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (03)

invalid character U+0023 '#'

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: unexpected >>, expected }

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (01)

invalid character U+0023 '#'

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: unexpected >>, expected }

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (01)

invalid character U+0023 '#'

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected >>, expected }

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (00)

invalid character U+0023 '#'

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected >>, expected }

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (00)

invalid character U+0023 '#'

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected >>, expected }

Check failure on line 115 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / tests (00)

invalid character U+0023 '#'

nextParams := params.Update(&consensusParams)

if err := nextParams.ValidateBasic(); err != nil {

Check failure on line 119 in x/consensus/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: nextParams
return nil, err
}

Expand Down
Loading