Skip to content

Commit 661afa2

Browse files
committed
Fix
1 parent bac26b4 commit 661afa2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

x/wasm/keeper/msg_dispatcher.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ func (d MessageDispatcher) dispatchMsgWithGasLimit(ctx sdk.Context, contractAddr
7070
if r := recover(); r != nil {
7171
// if it's not an OutOfGas error, raise it again
7272
if _, ok := r.(storetypes.ErrorOutOfGas); !ok {
73+
// always consume the gas used in the sub-context
74+
spent := subCtx.GasMeter().GasConsumed()
75+
ctx.GasMeter().ConsumeGas(spent, "From limited Sub-Message")
7376
// log it to get the original stack trace somewhere (as panic(r) keeps message but stacktrace to here
7477
moduleLogger(ctx).Info("SubMsg rethrowing panic: %#v", r)
7578
panic(r)

0 commit comments

Comments
 (0)