aeternity / aesophia_http

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception error: {encode_expr_todo,'-'}

dincho opened this issue · comments

2020-03-18 13:29:05=CRASH REPORT==== 18-Mar-2020::11:29:05 ===
2020-03-18 13:29:05 crasher:
2020-03-18 13:29:05 initial call: cowboy_stream_h:request_process/3
2020-03-18 13:29:05 pid: <0.9457.0>
2020-03-18 13:29:05 registered_name: []
2020-03-18 13:29:05 exception error: {encode_expr_todo,'-'}
2020-03-18 13:29:05 in function aeso_aci:encode_expr/1 (/app/_build/default/lib/aesophia/src/aeso_aci.erl, line 204)
2020-03-18 13:29:05 in call from aeso_aci:encode_expr/1 (/app/_build/default/lib/aesophia/src/aeso_aci.erl, line 198)
2020-03-18 13:29:05 in call from aesophia_http_handler:decode_call_result/5 (/app/apps/aesophia_http/src/aesophia_http_handler.erl, line 505)
2020-03-18 13:29:05 in call from aesophia_http_handler:handle_request_json/2 (/app/apps/aesophia_http/src/aesophia_http_handler.erl, line 39)
2020-03-18 13:29:05 in call from cowboy_rest:call/3 (/app/_build/default/lib/cowboy/src/cowboy_rest.erl, line 1182)
2020-03-18 13:29:05=CRASH REPORT==== 18-Mar-2020::11:29:05 ===
2020-03-18 13:29:05 crasher:
2020-03-18 13:29:05 initial call: cowboy_stream_h:request_process/3
2020-03-18 13:29:05 pid: <0.9457.0>
2020-03-18 13:29:05 registered_name: []
2020-03-18 13:29:05 exception error: {encode_expr_todo,'-'}
2020-03-18 13:29:05 in function aeso_aci:encode_expr/1 (/app/_build/default/lib/aesophia/src/aeso_aci.erl, line 204)
2020-03-18 13:29:05 in call from aeso_aci:encode_expr/1 (/app/_build/default/lib/aesophia/src/aeso_aci.erl, line 198)
2020-03-18 13:29:05 in call from aesophia_http_handler:decode_call_result/5 (/app/apps/aesophia_http/src/aesophia_http_handler.erl, line 505)
2020-03-18 13:29:05 in call from aesophia_http_handler:handle_request_json/2 (/app/apps/aesophia_http/src/aesophia_http_handler.erl, line 39)
2020-03-18 13:29:05 in call from cowboy_rest:call/3 (/app/_build/default/lib/cowboy/src/cowboy_rest.erl, line 1182)
2020-03-18 13:29:05 in call from cowboy_rest:process_content_type/3 (/app/_build/default/lib/cowboy/src/cowboy_rest.erl, line 986)
2020-03-18 13:29:05 in call from cowboy_rest:upgrade/4 (/app/_build/default/lib/cowboy/src/cowboy_rest.erl, line 260)
2020-03-18 13:29:05 in call from cowboy_stream_h:execute/3 (/app/_build/default/lib/cowboy/src/cowboy_stream_h.erl, line 249)
2020-03-18 13:29:05 ancestors: [<0.9454.0>,<0.566.0>,<0.565.0>,ranch_sup,<0.550.0>]
2020-03-18 13:29:05 message_queue_len: 0
2020-03-18 13:29:05 messages: []
2020-03-18 13:29:05 links: [<0.9454.0>]
2020-03-18 13:29:05 dictionary: [{'$current_file',no_file},{aeso_ast_infer_types,#{}}]
2020-03-18 13:29:05 trap_exit: false
2020-03-18 13:29:05 status: running
2020-03-18 13:29:05 heap_size: 46422
2020-03-18 13:29:05=CRASH REPORT==== 18-Mar-2020::11:29:05 ===
2020-03-18 13:29:05 crasher:
2020-03-18 13:29:05 initial call: cowboy_stream_h:request_process/3
2020-03-18 13:29:05 pid: <0.9457.0>
2020-03-18 13:29:05 registered_name: []
2020-03-18 13:29:05 exception error: {encode_expr_todo,'-'}
2020-03-18 13:29:05 in function aeso_aci:encode_expr/1 (/app/_build/default/lib/aesophia/src/aeso_aci.erl, line 204)
2020-03-18 13:29:05 in call from aeso_aci:encode_expr/1 (/app/_build/default/lib/aesophia/src/aeso_aci.erl, line 198)
2020-03-18 13:29:05 in call from aesophia_http_handler:decode_call_result/5 (/app/apps/aesophia_http/src/aesophia_http_handler.erl, line 505)
2020-03-18 13:29:05 in call from aesophia_http_handler:handle_request_json/2 (/app/apps/aesophia_http/src/aesophia_http_handler.erl, line 39)
2020-03-18 13:29:05 in call from cowboy_rest:call/3 (/app/_build/default/lib/cowboy/src/cowboy_rest.erl, line 1182)
2020-03-18 13:29:05 in call from cowboy_rest:process_content_type/3 (/app/_build/default/lib/cowboy/src/cowboy_rest.erl, line 986)
2020-03-18 13:29:05 in call from cowboy_rest:upgrade/4 (/app/_build/default/lib/cowboy/src/cowboy_rest.erl, line 260)
2020-03-18 13:29:05 in call from cowboy_stream_h:execute/3 (/app/_build/default/lib/cowboy/src/cowboy_stream_h.erl, line 249)
2020-03-18 13:29:05 ancestors: [<0.9454.0>,<0.566.0>,<0.565.0>,ranch_sup,<0.550.0>]
2020-03-18 13:29:05 message_queue_len: 0
2020-03-18 13:29:05 messages: []
2020-03-18 13:29:05 links: [<0.9454.0>]
2020-03-18 13:29:05 dictionary: [{'$current_file',no_file},{aeso_ast_infer_types,#{}}]
2020-03-18 13:29:05 trap_exit: false
2020-03-18 13:29:05 status: running
2020-03-18 13:29:05 heap_size: 46422
2020-03-18 13:29:05 stack_size: 27
2020-03-18 13:29:05 reductions: 233711
2020-03-18 13:29:05 neighbours:
2020-03-18 13:29:05=ERROR REPORT==== 18-Mar-2020::11:29:05 ===

The trigger is possibly:

curl 'https://latest.compiler.aepps.com/decode-call-result' \
-XPOST \
-H 'Accept: application/json, text/plain, */*' \
-v -H 'Content-Type: application/json' \
-H 'Origin: https://contracts.aepps.com' \
-H 'Referer: https://contracts.aepps.com/' \
--data-binary '{"function":"getMapNegative","source":"contract MapTest =\n    record state = { tMap : map(int, int) }\n\n    stateful entrypoint init() = { tMap = {} }\n\n    entrypoint getMapPositive(index: int) =\n      state.tMap[index = 5]\n\n    entrypoint getMapNegative(index: int) =\n      state.tMap[index = -5]","call-result":"ok","call-value":"cb_igCOSxs=","options":{"backend":"fate","clientTtl":1,"nameTtl":50000,"deposit":0,"gasPrice":1000000000,"amount":0,"gas":1000000,"options":"","dryRunAccount":{"pub":"ak_11111111111111111111111111111111273Yts","amount":"100000000000000000000000000000000000"},"queryFee":30000,"oracleTtl":{"type":"delta","value":500},"queryTtl":{"type":"delta","value":10},"responseTtl":{"type":"delta","value":10},"skipArgsConvert":false,"skipTransformDecoded":false,"callStatic":false,"top":null,"waitMined":true,"verify":false,"filesystem":{},"owner":"ak_2bKhoFWgQ9os4x8CaeDTHZRGzUcSwcXYUrM12gZHKTdyreGRgG","code":"contract MapTest =\n    record state = { tMap : map(int, int) }\n\n    stateful entrypoint init() = { tMap = {} }\n\n    entrypoint getMapPositive(index: int) =\n      state.tMap[index = 5]\n\n    entrypoint getMapNegative(index: int) =\n      state.tMap[index = -5]","fee":null,"callData":"","file_system":{}}}'

The contract from the example above:

contract MapTest =

    record state = { tMap : map(int, int) }

    stateful entrypoint init() = { tMap = {} }

    entrypoint getMapPositive(index: int) =
        state.tMap[index = 5]

    entrypoint getMapNegative(index: int) =
        state.tMap[index = -5]

Looks like the aci can't handle negative numbers. PR above

Does it work now?

Does it work now?

The upstream fix has to be integration in this repo and new release published

Closing since the PR has been merged.

@tolbrino what PR ? While the upstream fixed it, it's not fixed in this repo yet

My fault.