mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 01:41:48 +00:00
vm: copy argument in unary opcodes, fix #2051
We already do this in binary opcodes, let's be consistent. This fixes state difference at height 275663 for tx 3c498317684d63849b03e4c58ad57ce4b19bb206b7b01bcc64233de3b3e207f4 Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
ea9dde257c
commit
1863023e27
2 changed files with 15 additions and 3 deletions
|
@ -2050,6 +2050,18 @@ func TestDupInt(t *testing.T) {
|
|||
assert.Equal(t, int64(-1), vm.estack.Pop().BigInt().Int64())
|
||||
}
|
||||
|
||||
func TestNegateCopy(t *testing.T) {
|
||||
prog := makeProgram(opcode.NEGATE)
|
||||
v := load(prog)
|
||||
bi := stackitem.Make(-1)
|
||||
v.estack.PushVal(bi)
|
||||
v.estack.PushVal(bi)
|
||||
runVM(t, v)
|
||||
assert.Equal(t, 2, v.estack.Len())
|
||||
assert.Equal(t, int64(1), v.estack.Pop().BigInt().Int64())
|
||||
assert.Equal(t, int64(-1), v.estack.Pop().BigInt().Int64())
|
||||
}
|
||||
|
||||
func TestDupByteArray(t *testing.T) {
|
||||
prog := makeProgram(opcode.PUSHDATA1, 2, 1, 0,
|
||||
opcode.DUP,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue