Skip to content

Commit

Permalink
chore: address rootulp feedback on PR 1095 (#1145)
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp authored Dec 21, 2022
1 parent d24af41 commit 8226479
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion x/blob/keeper/gas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestPayForBlobGas(t *testing.T) {
{
name: "1024 byte blob", // occupies 3 shares because share prefix (e.g. namespace, info byte)
msg: types.MsgPayForBlob{BlobSize: 1024},
wantGasConsumed: uint64(13348), // 3 shares * 512 bytes per share * 8 gas per byte + 1060 gas for fetching param = 12288 gas
wantGasConsumed: uint64(13348), // 3 shares * 512 bytes per share * 8 gas per byte + 1060 gas for fetching param = 13348 gas
},
}

Expand Down
6 changes: 3 additions & 3 deletions x/blob/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {
func (k Keeper) PayForBlob(goCtx context.Context, msg *types.MsgPayForBlob) (*types.MsgPayForBlobResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

// calculate gas per message share by fetching the constant share size and the gas cost per byte from the KV store
gasPerMsgShare := appconsts.ShareSize * k.GasPerBlobByte(ctx)
gasToConsume := uint64(shares.BlobSharesUsed(int(msg.BlobSize)) * int(gasPerMsgShare))
// calculate gas per blob share by fetching the constant share size and the gas cost per byte from the KV store
gasPerBlobShare := appconsts.ShareSize * k.GasPerBlobByte(ctx)
gasToConsume := uint64(shares.BlobSharesUsed(int(msg.BlobSize)) * int(gasPerBlobShare))
ctx.GasMeter().ConsumeGas(gasToConsume, payForBlobGasDescriptor)

err := ctx.EventManager().EmitTypedEvent(
Expand Down

0 comments on commit 8226479

Please sign in to comment.