diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index 6d6e81129..2c131c772 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -51,8 +51,8 @@ const ( // on all stacks at once. MaxStackSize = 2 * 1024 - maxSHLArg = 256 - minSHLArg = -256 + maxSHLArg = MaxBigIntegerSizeBits + minSHLArg = -MaxBigIntegerSizeBits ) // VM represents the virtual machine. diff --git a/pkg/vm/vm_test.go b/pkg/vm/vm_test.go index e5ffac7c0..5ace7a9e3 100644 --- a/pkg/vm/vm_test.go +++ b/pkg/vm/vm_test.go @@ -624,7 +624,7 @@ func TestSHRSmallValue(t *testing.T) { prog := makeProgram(SHR) vm := load(prog) vm.estack.PushVal(5) - vm.estack.PushVal(-257) + vm.estack.PushVal(minSHLArg - 1) checkVMFailed(t, vm) } @@ -660,7 +660,7 @@ func TestSHLBigValue(t *testing.T) { prog := makeProgram(SHL) vm := load(prog) vm.estack.PushVal(5) - vm.estack.PushVal(257) + vm.estack.PushVal(maxSHLArg + 1) checkVMFailed(t, vm) }