Skip to content

Commit

Permalink
simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
antstalepresh committed Feb 14, 2024
1 parent bf19ff5 commit 2b807f9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions x/oracle/abci/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ func (h *ProposalHandler) PreBlocker(ctx sdk.Context, req *abci.RequestFinalizeB
}

// set oracle prices using the passed in context, which will make these prices available in the current block
if err := h.keeper.SetOraclePrices(ctx, injectedVoteExtTx.StakeWeightedPrices); err != nil {
return nil, err
}
h.keeper.SetOraclePrices(ctx, injectedVoteExtTx.StakeWeightedPrices)

// Do slash who did miss voting over threshold and
// reset miss counters of all validators at the last block of slash window
Expand Down
3 changes: 1 addition & 2 deletions x/oracle/abci/vote_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ func (h *VoteExtHandler) VerifyVoteExtensionHandler(_ OracleConfig) sdk.VerifyVo
}

// Verify incoming prices from a validator are valid. Note, verification during
// VerifyVoteExtensionHandler MUST be deterministic. For brevity and demo
// purposes, we omit implementation.
// VerifyVoteExtensionHandler MUST be deterministic.
if err := h.verifyOraclePrices(ctx, voteExt.Prices); err != nil {
return nil, fmt.Errorf("failed to verify oracle prices from validator %X: %w", req.ValidatorAddress, err)
}
Expand Down
3 changes: 1 addition & 2 deletions x/oracle/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,10 @@ func (k Keeper) GetSubspace() paramstypes.Subspace {
return k.paramSpace
}

func (k Keeper) SetOraclePrices(ctx sdk.Context, prices map[string]math.LegacyDec) error {
func (k Keeper) SetOraclePrices(ctx sdk.Context, prices map[string]math.LegacyDec) {
for b, q := range prices {
k.SetExchangeRateWithEvent(ctx, b, q)
}
return nil
}

type (
Expand Down

0 comments on commit 2b807f9

Please sign in to comment.