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

Forc ABI generation doesn't fail for scripts #526

Closed
adlerjohn opened this issue Dec 29, 2021 · 6 comments · Fixed by #1105
Closed

Forc ABI generation doesn't fail for scripts #526

adlerjohn opened this issue Dec 29, 2021 · 6 comments · Fixed by #1105
Assignees
Labels
bug Something isn't working forc good first issue Good for newcomers

Comments

@adlerjohn
Copy link
Contributor

Forc version: v0.1.6

Running forc json-abi for a script project gives the following output instead of an error:

$ forc json-abi
  Compiled library "core".
  Compiled library "core".
  Compiled library "lib-std".
  Compiled script "foo".
[]

Only contracts have an ABI, so forc json-abi should fail with an explanative error otherwise.

@adlerjohn adlerjohn added bug Something isn't working good first issue Good for newcomers forc labels Dec 29, 2021
@adlerjohn
Copy link
Contributor Author

For posterity, libraries could have their ABI dumped with a flag, but by default settings to prevent user error the compiler should error if a non-contract tries to dump ABI.

@adlerjohn adlerjohn moved this to Todo in Fuel Network Jan 6, 2022
@eureka-cpu eureka-cpu self-assigned this Mar 28, 2022
@eureka-cpu
Copy link
Contributor

@adlerjohn can you think of any other instance where the json-abi output would be empty?

@adlerjohn
Copy link
Contributor Author

Empty, or error?

@eureka-cpu
Copy link
Contributor

Empty, or error?

Maybe I'm misinterpreting, it is giving an empty json abi output, right? This is should give an error message: Cannot generate JSON ABI for non-contracts. But if there are any other reasons the command would produce an empty output, would we want it to catch that as an error too, or just leave as is?

@eureka-cpu
Copy link
Contributor

Essentially, I'm asking if we actually need to check if it's a script, or if we can assume based on the empty output that it's a non-contract?

@adlerjohn
Copy link
Contributor Author

You have to check that it's a script or a predicate. It may be the case that a contract with no ABI produces an empty ABI file. That could happen if the contract is meant to be an upgradable implementation for example.

Repository owner moved this from Todo to Done in Fuel Network Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forc good first issue Good for newcomers
Projects
Archived in project
2 participants