Skip to content

Commit

Permalink
chore: minor audit fixes (#227)
Browse files Browse the repository at this point in the history
* add len

* format

* map cap

* typo

* typo

* typo
  • Loading branch information
Alex Johnson authored Mar 21, 2024
1 parent 8bd29f5 commit 4acd691
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions pkg/math/median/median.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ func ComputeMedian() types.PriceAggregationFn {
}
}

medianPrices := make(types.TickerPrices)

medianPrices := make(types.TickerPrices, len(pricesByAsset))
// Iterate through all assets and compute the median price
for cp, prices := range pricesByAsset {
if len(prices) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/math/oracle/median.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewMedianAggregator(logger *zap.Logger, cfg mmtypes.MarketMap) (*MedianAggr
}, nil
}

// AggregatedData implements the aggregate function for the median price calculation. Specifically, this
// AggregateData implements the aggregate function for the median price calculation. Specifically, this
// aggregation function aggregates the prices seen by each provider by first converting each price to a
// common ticker and then calculating the median of the converted prices. Prices are converted either
//
Expand Down
4 changes: 2 additions & 2 deletions x/oracle/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func DefaultGenesisState() *GenesisState {
}

// Validate validates the currency-pair geneses that the Genesis-State is composed of
// valid CurrencyPairGeneses, and that no ID for a currency-pair is repeated.
// valid CurrencyPairGenesis, and that no ID for a currency-pair is repeated.
func (gs *GenesisState) Validate() error {
ids := make(map[uint64]struct{})
cps := make(map[string]struct{})
Expand All @@ -48,7 +48,7 @@ func (gs *GenesisState) Validate() error {
return err
}

// check if the ID > that gs.NextID
// check if the ID > gs.NextID
if cpg.Id >= gs.NextId {
return fmt.Errorf("invalid id: %v, must be less than next id: %v", cpg.Id, gs.NextId)
}
Expand Down
2 changes: 1 addition & 1 deletion x/sla/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (m *MsgServer) AddSLAs(goCtx context.Context, req *slatypes.MsgAddSLAs) (*s
}

// RemoveSLAs defines a method that removes a set of SLAs from the store. The SLAs provided must
// do not need to exist in the store, and the signer of the message must be the module authority.
// exist in the store, and the signer of the message must be the module authority.
func (m *MsgServer) RemoveSLAs(goCtx context.Context, req *slatypes.MsgRemoveSLAs) (*slatypes.MsgRemoveSLAsResponse, error) {
// Remove the SLAs in message from state.
ctx := sdk.UnwrapSDKContext(goCtx)
Expand Down

0 comments on commit 4acd691

Please sign in to comment.