Skip to content

Improve constructor syntax check #3630

@simon-something

Description

@simon-something

TL;DR: wrong constructor syntax should be caught and have a proper error message, same as a missing constructor.

  • It would be nice to have a specific error message when using this (wrong) syntax:

     #[aztec(private)]
     constructor() {
         (...)
     }
    

    as this fails to compile either with a generic parsing error (Expected an end of input but found contract, which is easy to understand) or, if storage is used and there is some logic inside the constructor, a compute_note_hash_and_nullifier function not found (yes, this is a bit painful to debug the first time).

  • A missing constructor isn't currently caught before attempting to deploy (while it is a mandatory fn), maybe it would be nice to enforce this when compiling.

Rationale is, due to context switching with Solidity or JS (which I guess is to expect), these are difficult errors to catch, especially with the misleading compute_note_hash_and_nullifier error (Rustaceans should be fine tho).

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-bugType: Bug. Something is broken.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions