Fix progressively increasing gas usage #146
@ -3,6 +3,8 @@ package keeper
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/x/registry/types"
|
"github.com/cerc-io/laconicd/x/registry/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
)
|
)
|
||||||
@ -20,6 +22,8 @@ var _ types.MsgServer = msgServer{}
|
|||||||
|
|
||||||
func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types.MsgSetRecordResponse, error) {
|
func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types.MsgSetRecordResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
|
ctx = *m.ctxWithCustomKVGasConfig(&ctx)
|
||||||
|
|
||||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -284,3 +288,16 @@ func (m msgServer) ReAssociateRecords(c context.Context, msg *types.MsgReAssocia
|
|||||||
})
|
})
|
||||||
return &types.MsgReAssociateRecordsResponse{}, nil
|
return &types.MsgReAssociateRecordsResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m msgServer) ctxWithCustomKVGasConfig(ctx *sdk.Context) *sdk.Context {
|
||||||
|
updatedCtx := ctx.WithKVGasConfig(storetypes.GasConfig{
|
||||||
|
HasCost: 0,
|
||||||
|
DeleteCost: 0,
|
||||||
|
ReadCostFlat: 0,
|
||||||
|
ReadCostPerByte: 0,
|
||||||
|
WriteCostFlat: 0,
|
||||||
|
WriteCostPerByte: 0,
|
||||||
|
IterNextCostFlat: 0,
|
||||||
|
})
|
||||||
|
return &updatedCtx
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user