state: allow to encode AppExecResult with recursive items

1. Encode them to a special type, decode to `nil`.
2. `Interop` can be encoded in JSON, this info should also be preserved.
This commit is contained in:
Evgenii Stratonikov 2020-12-18 12:28:01 +03:00
parent c13d6ecc55
commit 8c22d27acc
6 changed files with 164 additions and 52 deletions

View file

@ -506,6 +506,10 @@ func getTestContractState(bc *Blockchain) (*state.Contract, *state.Contract) {
emit.String(w.BinWriter, "destroy")
emit.AppCall(w.BinWriter, mgmtHash)
emit.Opcodes(w.BinWriter, opcode.RET)
invalidStackOff := w.Len()
emit.Opcodes(w.BinWriter, opcode.NEWARRAY0, opcode.DUP, opcode.DUP, opcode.APPEND, opcode.NEWMAP)
emit.Syscall(w.BinWriter, interopnames.SystemIteratorCreate)
emit.Opcodes(w.BinWriter, opcode.RET)
script := w.Bytes()
h := hash.Hash160(script)
@ -604,6 +608,11 @@ func getTestContractState(bc *Blockchain) (*state.Contract, *state.Contract) {
Offset: destroyOff,
ReturnType: smartcontract.VoidType,
},
{
Name: "invalidStack",
Offset: invalidStackOff,
ReturnType: smartcontract.VoidType,
},
}
cs := &state.Contract{
Script: script,