From 990ef5525c48a29d1147ccf55505c9a0178ab156 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 21 Jul 2020 14:23:52 +0300 Subject: [PATCH] core: adjust System.Runtime.GasLeft interop Part of #1055. In test mode it should return -1. --- pkg/core/interop/runtime/util.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/core/interop/runtime/util.go b/pkg/core/interop/runtime/util.go index e1200055c..522940381 100644 --- a/pkg/core/interop/runtime/util.go +++ b/pkg/core/interop/runtime/util.go @@ -11,7 +11,11 @@ import ( // GasLeft returns remaining amount of GAS. func GasLeft(_ *interop.Context, v *vm.VM) error { - v.Estack().PushVal(v.GasLimit - v.GasConsumed()) + if v.GasLimit == -1 { + v.Estack().PushVal(v.GasLimit) + } else { + v.Estack().PushVal(v.GasLimit - v.GasConsumed()) + } return nil }