aeternity / aesophia

Stand alone compiler for the Sophia smart contract language
https://docs.aeternity.com/aesophia
ISC License
51 stars 19 forks source link

[CERES] compiler crashing when using `Chain.network_id` #477

Closed marc0olo closed 1 year ago

marc0olo commented 1 year ago

I am currently "playing around" with the compiler that enables Ceres features. I have built the aesophia_http image which I have published here:

as the new AENSv2 namespace capability is working using this self-built image, I assume that I have done everything right. it was built using ref to aesophia commit 1538af79edfb55f67b8de801842f44f4c0476d6a, which should include that feature already.

example to reproduce

include "String.aes"

main contract NetworkIdCrash =

    stateful entrypoint provide_delegation_sig(delegation_sig: signature) : unit =
        let expected_msg = String.concats([Chain.network_id, Address.to_str(Call.caller), "AENS", Address.to_str(Contract.address)])
        require(Crypto.verify_sig(Crypto.blake2b(expected_msg), Call.caller, delegation_sig), "INVALID_DELEGATION_SIGNATURE")
        ()

displayed error

CompilerError: compile error:
data_error:0:0: Compiler crashed, with reason: undef
[{aeb_fate_ops,network_id,[{stack,0}],[]},
 {aeso_fcode_to_fate,builtin_to_scode,3,
                     [{file,"/app/_build/default/lib/aesophia/src/aeso_fcode_to_fate.erl"},
                      {line,572}]},
 {aeso_fcode_to_fate,to_scode1,2,
                     [{file,"/app/_build/default/lib/aesophia/src/aeso_fcode_to_fate.erl"},
                      {line,372}]},
 {aeso_fcode_to_fate,'-call_to_scode/3-lc$^0/1-0-',2,
                     [{file,"/app/_build/default/lib/aesophia/src/aeso_fcode_to_fate.erl"},
                      {line,522}]},
 {aeso_fcode_to_fate,'-call_to_scode/3-lc$^0/1-0-',2,
                     [{file,"/app/_build/default/lib/aesophia/src/aeso_fcode_to_fate.erl"},
                      {line,522}]},
 {aeso_fcode_to_fate,call_to_scode,3,
                     [{file,"/app/_build/default/lib/aesophia/src/aeso_fcode_to_fate.erl"},
                      {line,522}]},
 {aeso_fcode_to_fate,to_scode1,2,
                     [{file,"/app/_build/default/lib/aesophia/src/aeso_fcode_to_fate.erl"},
                      {line,333}]},
 {aeso_fcode_to_fate,'-call_to_scode/3-lc$^0/1-0-',2,
                     [{file,"/app/_build/default/lib/aesophia/src/aeso_fcode_to_fate.erl"},
                      {line,522}]}]
marc0olo commented 1 year ago

closing this. I didn't update the aebytecode dependency. I just rebuilt the compiler and now it compiles. I should consider to ditch the http compiler also locally 🙈