fluencelabs/aquavm

Bug: inproper data handling in ap

Closed this issue · 0 comments

This bug encounters when an ap instruction generates an error. Consider the following script:

(xor
    (seq
        (call some_peer_id ("" "") [] value)
        (ap value.$.non_exist_field $stream) ;; (1)
    )
    (call %init_peer_id% ("" "") []) ;; (2)
)

Here if (1) encounters an error (f.e. if value doesn't have an appropriate field) then (2) is called and since (1) was executed on peer with some_peer_id peer id, then data'll contain sent_by state for (2). It's an expected behaviour. But then execution flow moves to %init_peer_id% and ap instrustion'll first try to find corresponding state from data before checking arguments. That why this "strange" error message

trace handler encountered an error: state from current `Call(RequestSentBy(PeerId(\"12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi\")))` is incompatible with expected ap

will occur. And this is essentially a bug, because first argument checking/preprocessing should be done.