Skip to content

Commit

Permalink
fix(*): multiple fixes from the reports (#2080)
Browse files Browse the repository at this point in the history
Fixes for multiple reported issues in Cantina.

issue: none
  • Loading branch information
sideninja authored Oct 7, 2024
1 parent c54b88e commit 1992992
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions halo/attest/keeper/cpayload.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/omni-network/omni/halo/attest/types"
"github.com/omni-network/omni/lib/errors"
"github.com/omni-network/omni/lib/log"
"github.com/omni-network/omni/lib/xchain"
evmenginetypes "github.com/omni-network/omni/octane/evmengine/types"

Expand All @@ -32,8 +31,7 @@ var _ evmenginetypes.VoteExtensionProvider = (*Keeper)(nil)
func (k *Keeper) PrepareVotes(ctx context.Context, commit abci.ExtendedCommitInfo) ([]sdk.Msg, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)
if err := baseapp.ValidateVoteExtensions(sdkCtx, k.skeeper, sdkCtx.BlockHeight(), sdkCtx.ChainID(), commit); err != nil {
log.Error(ctx, "Cannot include invalid vote extensions in payload", err, "height", sdkCtx.BlockHeight())
return nil, nil
return nil, errors.Wrap(err, "validate extensions [BUG]")
}

// Adapt portal registry to the supportedChainFunc signature.
Expand Down
4 changes: 2 additions & 2 deletions halo/attest/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ func (k *Keeper) ExtendVote(ctx sdk.Context, _ *abci.RequestExtendVote) (*abci.R
// Make nice logs
const limit = 5
offsets := make(map[xchain.ChainVersion][]string)
for _, vote := range votes {
for _, vote := range filtered {
offset := offsets[vote.AttestHeader.XChainVersion()]
if len(offset) < limit {
offset = append(offset, strconv.FormatUint(vote.AttestHeader.AttestOffset, 10))
Expand All @@ -711,7 +711,7 @@ func (k *Keeper) ExtendVote(ctx sdk.Context, _ *abci.RequestExtendVote) (*abci.R
}
offsets[vote.AttestHeader.XChainVersion()] = offset
}
attrs := []any{slog.Int("votes", len(votes))}
attrs := []any{slog.Int("votes", len(offsets))}
for chainVer, offset := range offsets {
attrs = append(attrs, slog.String(
fmt.Sprintf("%d-%d", chainVer.ID, chainVer.ConfLevel),
Expand Down
2 changes: 1 addition & 1 deletion lib/cchain/provider/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,5 +739,5 @@ func attsFromAtHeight(ctx context.Context, cl atypes.QueryClient, chainVer xchai
return []xchain.Attestation{}, false, errors.Wrap(err, "attestations from proto")
}

return atts, len(resp.Attestations) != 0, nil
return atts, true, nil
}
2 changes: 2 additions & 0 deletions lib/xchain/provider/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ func getConsXBlock(ctx context.Context, ref xchain.EmitRef, cprov cchain.Provide
return xchain.Block{}, errors.Wrap(err, "fetch consensus xblock")
} else if !ok {
return xchain.Block{}, errors.New("no consensus xblocks [BUG]")
} else if len(xblock.Msgs) == 0 {
return xchain.Block{}, errors.New("empty consensus xblock [BUG]")
} else if xblock.Msgs[0].DestChainID != 0 {
return xchain.Block{}, errors.New("non-broadcast consensus chain xmsg [BUG]")
}
Expand Down

0 comments on commit 1992992

Please sign in to comment.