compiler: reverse args in AppCall

Invoked contract is expecting first argument to be on top of the stack.
Change test to use non-commutative operation to catch this behaviour.
This commit is contained in:
Evgenii Stratonikov 2020-02-10 10:53:55 +03:00
parent 52d8d58593
commit 895a8d9ebc
2 changed files with 15 additions and 13 deletions

View file

@ -786,6 +786,9 @@ func (c *codegen) convertBuiltin(expr *ast.CallExpr) {
case "VerifySignature":
emit.Opcode(c.prog.BinWriter, opcode.VERIFY)
case "AppCall":
numArgs := len(expr.Args) - 1
c.emitReverse(numArgs)
emit.Opcode(c.prog.BinWriter, opcode.APPCALL)
buf := c.getByteArray(expr.Args[0])
if len(buf) != 20 {