Skip to content

Commit

Permalink
fix(evmengine): nil panic with optimistic build enabled (piplabs#128)
Browse files Browse the repository at this point in the history
cmtAPI is lazily set, so during replyBlocks it is nil.
  • Loading branch information
zsystm authored and leeren committed Oct 10, 2024
1 parent fe9350a commit 53a7d6a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client/x/evmengine/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ func (k *Keeper) parseAndVerifyProposedPayload(ctx context.Context, msg *types.M
//
// Note that the validator set can change, so this is an optimistic check.
func (k *Keeper) isNextProposer(ctx context.Context, currentProposer []byte, currentHeight int64) (bool, error) {
// PostFinalize can be called during block replay (performed in newCometNode),
// but cmtAPI is set only after newCometNode completes (see app.SetCometAPI), so a nil check is necessary.
if k.cmtAPI == nil {
return false, nil
}

valset, ok, err := k.cmtAPI.Validators(ctx, currentHeight)
if err != nil {
return false, err
Expand Down

0 comments on commit 53a7d6a

Please sign in to comment.