Skip to content

Commit

Permalink
fix(noir-compiler): compile time error if ctor is missing (#3649)
Browse files Browse the repository at this point in the history
Fix a part of the problem highlighted by #3630 

Also created 
* noir-lang/noir#3768
* [Discussion to see why we prioritise Aztec-nr issues over noir syntax
issues. E.g. if we have storage and a syntax error in a method, instead
of showinf the syntax error, we say "no
compute_note_hash_and_nullifier()
found"](https://aztecprotocol.slack.com/archives/C03P17YHVK8/p1702312023384759)
  • Loading branch information
rahul-kothari authored Dec 12, 2023
1 parent 1696a8f commit 12249bf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions yarn-project/noir-compiler/src/contract-interface-gen/abi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export function generateContractArtifact(
{ contract, debug }: NoirContractCompilationArtifacts,
aztecNrVersion?: string,
): ContractArtifact {
const constructorArtifact = contract.functions.find(({ name }) => name === 'constructor');

This comment has been minimized.

Copy link
@simon-something

simon-something Dec 12, 2023

const constructorArtifact = contract.functions.find(({ name }) => name === 'fn constructor'); ?
😇

if (constructorArtifact === undefined) {
throw new Error('Contract must have a constructor function');
}
if (contract.functions.length > 2 ** FUNCTION_TREE_HEIGHT) {
throw new Error(`Contract can only have a maximum of ${2 ** FUNCTION_TREE_HEIGHT} functions`);
}
Expand Down

0 comments on commit 12249bf

Please sign in to comment.