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

@ -1539,3 +1539,17 @@ func TestRemoveUntraceable(t *testing.T) {
require.NoError(t, err)
require.Len(t, b.Transactions, 0)
}
func TestInvalidNotification(t *testing.T) {
bc := newTestChain(t)
defer bc.Close()
cs, _ := getTestContractState(bc)
require.NoError(t, bc.contracts.Management.PutContractState(bc.dao, cs))
aer, err := invokeContractMethod(bc, 1_00000000, cs.Hash, "invalidStack")
require.NoError(t, err)
require.Equal(t, 2, len(aer.Stack))
require.Nil(t, aer.Stack[0])
require.Equal(t, stackitem.InteropT, aer.Stack[1].Type())
}