[ENG-613]: Linting fixes (#32)

Co-authored-by: Aleksandr Bezobchuk <aleks.bezobchuk@gmail.com>
This commit is contained in:
David Terpay
2023-03-20 16:58:19 +00:00
committed by GitHub
co-authored by Aleksandr Bezobchuk
parent 99b4bc2da2
commit 9e350bc7f7
9 changed files with 18 additions and 29 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ func (k Keeper) ValidateAuctionMsg(ctx sdk.Context, bidder sdk.AccAddress, bid,
}
if protectionEnabled {
if err := k.ValidateAuctionBundle(ctx, bidder, transactions); err != nil {
if err := k.ValidateAuctionBundle(bidder, transactions); err != nil {
return err
}
}
@@ -88,7 +88,7 @@ func (k Keeper) ValidateAuctionBid(ctx sdk.Context, bidder sdk.AccAddress, bid,
// 2. valid: [tx1, tx2, tx3, tx4] where tx1 - tx4 are signed by the bidder.
// 3. invalid: [tx1, tx2, tx3] where tx1 and tx3 are signed by the bidder and tx2 is signed by some other signer. (possible sandwich attack)
// 4. invalid: [tx1, tx2, tx3] where tx1 is signed by the bidder, and tx2 - tx3 are signed by some other signer. (possible front-running attack)
func (k Keeper) ValidateAuctionBundle(ctx sdk.Context, bidder sdk.AccAddress, transactions []sdk.Tx) error {
func (k Keeper) ValidateAuctionBundle(bidder sdk.AccAddress, transactions []sdk.Tx) error {
if len(transactions) <= 1 {
return nil
}
+1 -1
View File
@@ -290,7 +290,7 @@ func (suite *KeeperTestSuite) TestValidateBundle() {
}
// Validate the bundle
err := suite.auctionKeeper.ValidateAuctionBundle(suite.ctx, bidder.Address, bundle)
err := suite.auctionKeeper.ValidateAuctionBundle(bidder.Address, bundle)
if tc.pass {
suite.Require().NoError(err)
} else {
+1 -1
View File
@@ -20,7 +20,7 @@ func NewQueryServer(keeper Keeper) *QueryServer {
}
// Params queries all parameters of the auction module.
func (q QueryServer) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
func (q QueryServer) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
params, err := q.keeper.GetParams(ctx)
+3 -3
View File
@@ -52,7 +52,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
}
// ValidateGenesis performs genesis state validation for the auction module.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error {
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var genState types.GenesisState
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
@@ -97,12 +97,12 @@ func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
// RegisterServices registers a the gRPC Query and Msg services for the x/auction
// module.
func (am AppModule) RegisterServices(cfg module.Configurator) {
func (am AppModule) RegisterServices(_ module.Configurator) {
// TODO: Define the gRPC querier service and register it with the auction module configurator
// TODO: Define the gRPC Msg service and register it with the auction module configurator
}
func (a AppModuleBasic) RegisterRESTRoutes(ctx client.Context, r *mux.Router) {}
func (a AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {}
// RegisterInvariants registers the invariants of the module. If an invariant
// deviates from its predicted value, the InvariantRegistry triggers appropriate
+1 -5
View File
@@ -16,9 +16,5 @@ func DefaultGenesisState() *GenesisState {
// Validate performs basic validation of the auction module genesis state.
func (gs GenesisState) Validate() error {
if err := gs.Params.Validate(); err != nil {
return err
}
return nil
return gs.Params.Validate()
}
+1 -5
View File
@@ -30,11 +30,7 @@ func (m MsgUpdateParams) ValidateBasic() error {
return errors.Wrap(err, "invalid authority address")
}
if err := m.Params.Validate(); err != nil {
return err
}
return nil
return m.Params.Validate()
}
// GetSignBytes implements the LegacyMsg interface.
+1 -5
View File
@@ -67,11 +67,7 @@ func (p Params) Validate() error {
return fmt.Errorf("invalid minimum bid increment (%s)", err)
}
if err := validateProposerFee(p.ProposerFee); err != nil {
return err
}
return nil
return validateProposerFee(p.ProposerFee)
}
func validateProposerFee(v sdk.Dec) error {