Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yul compilation failed: DeclarationError: Function not found. #353

Closed
agroce opened this issue Apr 6, 2021 · 2 comments · Fixed by #435
Closed

Yul compilation failed: DeclarationError: Function not found. #353

agroce opened this issue Apr 6, 2021 · 2 comments · Fixed by #435
Assignees

Comments

@agroce
Copy link

agroce commented Apr 6, 2021

Compiling this file:

contract o:
 def __init__(l:string0,e:string0):y:u256
thread 'main' panicked at 'Yul compilation failed: {"errors":[{"component":"general","formattedMessage":"DeclarationError: Function not found.\n --> input.yul:1:355:\n  |\n1 |  ... _string0_mem(params_start_mem, 0), abi_decode_string0_mem(params_start_mem, 32)) function co ...\n  |                                         ^^^^^^^^^^^^^^^^^^^^^^\n\n","message":"Function not found.","severity":"error","sourceLocation":{"end":376,"file":"input.yul","start":354},"type":"DeclarationError"},{"component":"general","formattedMessage":"TypeError: Expected expression to evaluate to one value, but got 0 values instead.\n --> input.yul:1:355:\n  |\n1 |  ... _string0_mem(params_start_mem, 0), abi_decode_string0_mem(params_start_mem, 32)) function contract_create2(data_pt ...\n  |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n","message":"Expected expression to evaluate to one value, but got 0 values instead.","severity":"error","sourceLocation":{"end":398,"file":"input.yul","start":354},"type":"TypeError"},{"component":"general","formattedMessage":"DeclarationError: Function not found.\n --> input.yul:1:310:\n  |\n1 |  ... $l, $e) { let $y := 0 } $$__init__(abi_decode_string0_mem(params_start_mem, 0), abi_decode_s ...\n  |                                         ^^^^^^^^^^^^^^^^^^^^^^\n\n","message":"Function not found.","severity":"error","sourceLocation":{"end":331,"file":"input.yul","start":309},"type":"DeclarationError"},{"component":"general","formattedMessage":"TypeError: Expected expression to evaluate to one value, but got 0 values instead.\n --> input.yul:1:310:\n  |\n1 |  ... $l, $e) { let $y := 0 } $$__init__(abi_decode_string0_mem(params_start_mem, 0), abi_decode_string0_mem(params_sta ...\n  |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n","message":"Expected expression to evaluate to one value, but got 0 values instead.","severity":"error","sourceLocation":{"end":352,"file":"input.yul","start":309},"type":"TypeError"}]}', compiler/src/lib.rs:56:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

You've hit an internal compiler error. This is a bug in the Fe compiler.
Fe is still under heavy development, and isn't yet ready for production use.

If you would, please report this bug at the following URL:
  https://github.com/ethereum/fe/issues/new
Aborted

On latest github master, built with

[profile.dev]
debug = true
panic = "abort"

for fuzzing. Using https://github.com/agroce/afl-compiler-fuzzer

@g-r-a-n-t
Copy link
Member

original file fails to parse, but this one still panics

contract o:
 def __init__(l: string0, e: string0):
  y: u256

@g-r-a-n-t g-r-a-n-t self-assigned this May 25, 2021
@g-r-a-n-t
Copy link
Member

g-r-a-n-t commented May 25, 2021

Looks like this is happening because the __init__ function is not pub and therefore the functions required for decoding the input are not added to the runtime.

Simple fix is to error if the __init__ function is not pub, which I'm surprised we're not already doing.

@g-r-a-n-t g-r-a-n-t mentioned this issue Jun 1, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants