Skip to content

Commit

Permalink
fix: Generate noir interface for constructors (#5352)
Browse files Browse the repository at this point in the history
With the last changes for contract deployment, a contract **can** call
another contract's initializer.

Co-authored-by: ludamad <adam.domurad@gmail.com>
  • Loading branch information
spalladino and ludamad authored Mar 21, 2024
1 parent dc51c2b commit 8434d2f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions yarn-project/noir-compiler/src/contract-interface-gen/noir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,8 @@ ${contractImpl}
* @returns The corresponding ts code.
*/
export function generateNoirContractInterface(artifact: ContractArtifact) {
// We don't allow calling a constructor, internal fns, or unconstrained fns from other contracts
const methods = artifact.functions.filter(
f => f.name !== 'constructor' && !f.isInternal && f.functionType !== FunctionType.UNCONSTRAINED,
);
// We don't allow calling internal fns or unconstrained fns from other contracts
const methods = artifact.functions.filter(f => !f.isInternal && f.functionType !== FunctionType.UNCONSTRAINED);
const paramStructs = methods.flatMap(m => collectStructs(m.parameters, [m.name])).map(generateStruct);
const privateContractStruct = generateContractStruct(artifact.name, 'private', methods);
const publicContractStruct = generateContractStruct(artifact.name, 'public', methods);
Expand Down

0 comments on commit 8434d2f

Please sign in to comment.