Skip to content

Commit

Permalink
add logging mesages
Browse files Browse the repository at this point in the history
  • Loading branch information
insumity committed Feb 8, 2024
1 parent 3402f75 commit 07e5d4f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions x/ccv/provider/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ func (h Hooks) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr s

consAddr, err := validator.GetConsAddr()
if err != nil {
h.k.Logger(ctx).Error("could not extract validator's consensus address",
"error", err.Error(),
"validator acc addr", voterAddr,
)
return
}

Expand All @@ -195,13 +199,21 @@ func (h Hooks) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr s

vote, found := h.k.govKeeper.GetVote(ctx, proposalID, voterAddr)
if !found {
h.k.Logger(ctx).Error("could not find vote for validator",
"validator acc addr", voterAddr,
"proposalID", proposalID,
)
return
}

if len(vote.Options) == 1 && vote.Options[0].Option == v1.VoteOption_VOTE_OPTION_YES {
// only consider votes that vote YES with 100% weight
weight, err := sdk.NewDecFromStr(vote.Options[0].Weight)
if err != nil {
h.k.Logger(ctx).Error("could not extract decimal value from vote's weight",
"vote", vote,
"error", err.Error(),
)
return
}
if !weight.Equal(math.LegacyNewDec(1)) {
Expand Down

0 comments on commit 07e5d4f

Please sign in to comment.