Fix progressively increasing gas usage #146
@ -8,7 +8,6 @@ linters:
|
|||||||
- bodyclose
|
- bodyclose
|
||||||
# - depguard # 20231120 disable until https://github.com/golangci/golangci-lint/issues/3906 is released
|
# - depguard # 20231120 disable until https://github.com/golangci/golangci-lint/issues/3906 is released
|
||||||
- dogsled
|
- dogsled
|
||||||
- dupl
|
|
||||||
- errcheck
|
- errcheck
|
||||||
- goconst
|
- goconst
|
||||||
- gocritic
|
- gocritic
|
||||||
|
@ -94,11 +94,10 @@ func (s *websocketsServer) Start() {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
var err error
|
var err error
|
||||||
/* #nosec G114 -- http functions have no support for timeouts */
|
|
||||||
if s.certFile == "" || s.keyFile == "" {
|
if s.certFile == "" || s.keyFile == "" {
|
||||||
err = http.ListenAndServe(s.wsAddr, ws)
|
err = http.ListenAndServe(s.wsAddr, ws) /* #nosec G114 -- http functions have no support for timeouts */
|
||||||
} else {
|
} else {
|
||||||
err = http.ListenAndServeTLS(s.wsAddr, s.certFile, s.keyFile, ws)
|
err = http.ListenAndServeTLS(s.wsAddr, s.certFile, s.keyFile, ws) // #nosec G114
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -55,7 +55,6 @@ func (s msgServer) CreateAuction(c context.Context, msg *types.MsgCreateAuction)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CommitBid is the command for committing a bid
|
// CommitBid is the command for committing a bid
|
||||||
//nolint: all
|
|
||||||
func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types.MsgCommitBidResponse, error) {
|
func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types.MsgCommitBidResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||||
@ -89,7 +88,6 @@ func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RevealBid is the command for revealing a bid
|
// RevealBid is the command for revealing a bid
|
||||||
//nolint: all
|
|
||||||
func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) {
|
func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||||
@ -122,7 +120,7 @@ func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types
|
|||||||
return &types.MsgRevealBidResponse{Auction: resp}, nil
|
return &types.MsgRevealBidResponse{Auction: resp}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m msgServer) logTxGasConsumed(ctx sdk.Context, tx string) {
|
func (s msgServer) logTxGasConsumed(ctx sdk.Context, tx string) {
|
||||||
gasConsumed := ctx.GasMeter().GasConsumed()
|
gasConsumed := ctx.GasMeter().GasConsumed()
|
||||||
m.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed))
|
s.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed))
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,6 @@ func (k msgServer) CreateBond(c context.Context, msg *types.MsgCreateBond) (*typ
|
|||||||
return &types.MsgCreateBondResponse{}, nil
|
return &types.MsgCreateBondResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint: all
|
|
||||||
func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*types.MsgRefillBondResponse, error) {
|
func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*types.MsgRefillBondResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||||
@ -86,7 +85,6 @@ func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*typ
|
|||||||
return &types.MsgRefillBondResponse{}, nil
|
return &types.MsgRefillBondResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint: all
|
|
||||||
func (k msgServer) WithdrawBond(c context.Context, msg *types.MsgWithdrawBond) (*types.MsgWithdrawBondResponse, error) {
|
func (k msgServer) WithdrawBond(c context.Context, msg *types.MsgWithdrawBond) (*types.MsgWithdrawBondResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||||
@ -151,7 +149,7 @@ func (k msgServer) CancelBond(c context.Context, msg *types.MsgCancelBond) (*typ
|
|||||||
return &types.MsgCancelBondResponse{}, nil
|
return &types.MsgCancelBondResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m msgServer) logTxGasConsumed(ctx sdk.Context, tx string) {
|
func (k msgServer) logTxGasConsumed(ctx sdk.Context, tx string) {
|
||||||
gasConsumed := ctx.GasMeter().GasConsumed()
|
gasConsumed := ctx.GasMeter().GasConsumed()
|
||||||
m.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed))
|
k.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed))
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,10 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #nosec 101
|
|
||||||
const (
|
const (
|
||||||
OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer"
|
OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer" // #nosec G101
|
||||||
OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract"
|
OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract" // #nosec G101
|
||||||
OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract"
|
OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract" // #nosec G101
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -54,7 +54,6 @@ func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types
|
|||||||
return &types.MsgSetRecordResponse{Id: record.ID}, nil
|
return &types.MsgSetRecordResponse{Id: record.ID}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint: all
|
|
||||||
func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.MsgSetNameResponse, error) {
|
func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.MsgSetNameResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||||
@ -121,7 +120,6 @@ func (m msgServer) ReserveName(c context.Context, msg *types.MsgReserveAuthority
|
|||||||
return &types.MsgReserveAuthorityResponse{}, nil
|
return &types.MsgReserveAuthorityResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint: all
|
|
||||||
func (m msgServer) SetAuthorityBond(c context.Context, msg *types.MsgSetAuthorityBond) (*types.MsgSetAuthorityBondResponse, error) {
|
func (m msgServer) SetAuthorityBond(c context.Context, msg *types.MsgSetAuthorityBond) (*types.MsgSetAuthorityBondResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||||
@ -213,7 +211,6 @@ func (m msgServer) RenewRecord(c context.Context, msg *types.MsgRenewRecord) (*t
|
|||||||
return &types.MsgRenewRecordResponse{}, nil
|
return &types.MsgRenewRecordResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint: all
|
|
||||||
func (m msgServer) AssociateBond(c context.Context, msg *types.MsgAssociateBond) (*types.MsgAssociateBondResponse, error) {
|
func (m msgServer) AssociateBond(c context.Context, msg *types.MsgAssociateBond) (*types.MsgAssociateBondResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user