Use custom KV store config to handle progressively increasing gas usage (#30)

Part of [Create an external fixturenet-laconicd stack](https://www.notion.so/Create-an-external-fixturenet-laconicd-stack-3b33cc2317444f4da209c4472f4244ed)

Reviewed-on: cerc-io/laconic2d#30
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
2024-06-25 06:33:41 +00:00
committed by ashwin
parent 66df959d51
commit e63f51cacd
5 changed files with 93 additions and 0 deletions
+10
View File
@@ -3,6 +3,7 @@ package keeper
import (
"context"
"git.vdb.to/cerc-io/laconicd/utils"
auctiontypes "git.vdb.to/cerc-io/laconicd/x/auction"
sdk "github.com/cosmos/cosmos-sdk/types"
)
@@ -20,6 +21,7 @@ func NewMsgServerImpl(keeper *Keeper) auctiontypes.MsgServer {
func (ms msgServer) CreateAuction(c context.Context, msg *auctiontypes.MsgCreateAuction) (*auctiontypes.MsgCreateAuctionResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
if err != nil {
@@ -46,6 +48,8 @@ func (ms msgServer) CreateAuction(c context.Context, msg *auctiontypes.MsgCreate
),
})
utils.LogTxGasConsumed(ctx, ms.k.Logger(ctx), "CreateAuction")
return &auctiontypes.MsgCreateAuctionResponse{Auction: resp}, nil
}
@@ -57,6 +61,7 @@ func (ms msgServer) CommitBid(c context.Context, msg *auctiontypes.MsgCommitBid)
}
ctx := sdk.UnwrapSDKContext(c)
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
if err != nil {
@@ -81,6 +86,8 @@ func (ms msgServer) CommitBid(c context.Context, msg *auctiontypes.MsgCommitBid)
),
})
utils.LogTxGasConsumed(ctx, ms.k.Logger(ctx), "CommitBid")
return &auctiontypes.MsgCommitBidResponse{Bid: resp}, nil
}
@@ -92,6 +99,7 @@ func (ms msgServer) RevealBid(c context.Context, msg *auctiontypes.MsgRevealBid)
}
ctx := sdk.UnwrapSDKContext(c)
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
if err != nil {
@@ -116,5 +124,7 @@ func (ms msgServer) RevealBid(c context.Context, msg *auctiontypes.MsgRevealBid)
),
})
utils.LogTxGasConsumed(ctx, ms.k.Logger(ctx), "RevealBid")
return &auctiontypes.MsgRevealBidResponse{Auction: resp}, nil
}