From 94f08389266a1549b30a074e55086b5d0ab80c0f Mon Sep 17 00:00:00 2001 From: benesjan Date: Wed, 2 Aug 2023 08:51:52 +0000 Subject: [PATCH] fix: noir contract build fixes --- yarn-project/noir-contracts/scripts/compile.sh | 2 +- .../noir-contracts/src/contracts/child_contract/Nargo.toml | 2 +- .../src/contracts/easy_zk_token_contract/Nargo.toml | 2 +- .../src/contracts/ecdsa_account_contract/Nargo.toml | 2 +- .../src/contracts/escrow_contract/Nargo.toml | 2 +- .../src/contracts/lending_contract/Nargo.toml | 2 +- .../src/contracts/non_native_token_contract/Nargo.toml | 2 +- .../src/contracts/parent_contract/Nargo.toml | 2 +- .../src/contracts/pending_commitments_contract/Nargo.toml | 2 +- .../src/contracts/pokeable_token_contract/Nargo.toml | 2 +- .../src/contracts/public_token_contract/Nargo.toml | 2 +- .../schnorr_multi_key_account_contract/Nargo.toml | 2 +- .../schnorr_single_key_account_contract/Nargo.toml | 2 +- .../noir-contracts/src/contracts/test_contract/Nargo.toml | 2 +- .../src/contracts/uniswap_contract/Nargo.toml | 2 +- .../src/contracts/zk_token_contract/Nargo.toml | 2 +- yarn-project/noir-contracts/src/scripts/copy_output.ts | 7 ++++--- yarn-project/noir-libs/easy-private-state/Nargo.toml | 2 +- yarn-project/noir-libs/noir-aztec/Nargo.toml | 2 +- yarn-project/noir-libs/value-note/Nargo.toml | 2 +- 20 files changed, 23 insertions(+), 22 deletions(-) diff --git a/yarn-project/noir-contracts/scripts/compile.sh b/yarn-project/noir-contracts/scripts/compile.sh index 707af363b24..4e0770431a2 100755 --- a/yarn-project/noir-contracts/scripts/compile.sh +++ b/yarn-project/noir-contracts/scripts/compile.sh @@ -39,7 +39,7 @@ build() { # If VERBOSE is not set, compile with 'nargo' and redirect standard error (stderr) to /dev/null and standard output (stdout) to /dev/null. # If the compilation fails, rerun the compilation with 'nargo' and show the compiler output. - nargo compile main --contracts; + nargo compile --contracts; } process() { diff --git a/yarn-project/noir-contracts/src/contracts/child_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/child_contract/Nargo.toml index a3878b2825c..7c96aee5fd7 100644 --- a/yarn-project/noir-contracts/src/contracts/child_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/child_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "child-contract" +name = "child_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/easy_zk_token_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/easy_zk_token_contract/Nargo.toml index f5fc68e039f..4b040bb699d 100644 --- a/yarn-project/noir-contracts/src/contracts/easy_zk_token_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/easy_zk_token_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "easy-zk-token-contract" +name = "easy_zk_token_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/ecdsa_account_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/ecdsa_account_contract/Nargo.toml index 09bb5d3e625..be0bf7e29cb 100644 --- a/yarn-project/noir-contracts/src/contracts/ecdsa_account_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/ecdsa_account_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "ecdsa-account-contract" +name = "ecdsa_account_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/escrow_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/escrow_contract/Nargo.toml index 5716aec9f07..5083b93b66f 100644 --- a/yarn-project/noir-contracts/src/contracts/escrow_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/escrow_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "escrow-contract" +name = "escrow_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/lending_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/lending_contract/Nargo.toml index cc8e31c7609..d26d7583b12 100644 --- a/yarn-project/noir-contracts/src/contracts/lending_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/lending_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "lending-contract" +name = "lending_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/non_native_token_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/non_native_token_contract/Nargo.toml index b7e8e10246b..63751f02c86 100644 --- a/yarn-project/noir-contracts/src/contracts/non_native_token_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/non_native_token_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "non-native-token-contract" +name = "non_native_token_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/parent_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/parent_contract/Nargo.toml index d8c6432a9b5..a7f57efaf5c 100644 --- a/yarn-project/noir-contracts/src/contracts/parent_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/parent_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "parent-contract" +name = "parent_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/pending_commitments_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/pending_commitments_contract/Nargo.toml index 7bb93273991..1d914763c7a 100644 --- a/yarn-project/noir-contracts/src/contracts/pending_commitments_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/pending_commitments_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "pending-commitments-contract" +name = "pending_commitments_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/pokeable_token_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/pokeable_token_contract/Nargo.toml index 477074432ff..8557d4f3dd4 100644 --- a/yarn-project/noir-contracts/src/contracts/pokeable_token_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/pokeable_token_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "pokable-token-contract" +name = "pokeable_token_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/public_token_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/public_token_contract/Nargo.toml index 452418f666b..258bb88aa39 100644 --- a/yarn-project/noir-contracts/src/contracts/public_token_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/public_token_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "public-token-contract" +name = "public_token_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/schnorr_multi_key_account_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/schnorr_multi_key_account_contract/Nargo.toml index f17aadf2fdc..38858a840d4 100644 --- a/yarn-project/noir-contracts/src/contracts/schnorr_multi_key_account_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/schnorr_multi_key_account_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "schnorr-multi-key-account-contract" +name = "schnorr_multi_key_account_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/Nargo.toml index 1d9794874c1..1a585dda179 100644 --- a/yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "schnorr-single-key-account-contract" +name = "schnorr_single_key_account_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/test_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/test_contract/Nargo.toml index 8d5249dbd4c..1cc0ca4d27c 100644 --- a/yarn-project/noir-contracts/src/contracts/test_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/test_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "test-contract" +name = "test_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/uniswap_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/uniswap_contract/Nargo.toml index 636bbd7ffc9..72685a5207a 100644 --- a/yarn-project/noir-contracts/src/contracts/uniswap_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/uniswap_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "uniswap-contract" +name = "uniswap_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/contracts/zk_token_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/zk_token_contract/Nargo.toml index 5a2e62d9c97..7096f5fa8be 100644 --- a/yarn-project/noir-contracts/src/contracts/zk_token_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/zk_token_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "zk-token-contract" +name = "zk_token_contract" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-contracts/src/scripts/copy_output.ts b/yarn-project/noir-contracts/src/scripts/copy_output.ts index b097ab47413..21954579569 100644 --- a/yarn-project/noir-contracts/src/scripts/copy_output.ts +++ b/yarn-project/noir-contracts/src/scripts/copy_output.ts @@ -105,10 +105,11 @@ const main = () => { const name = process.argv[2]; if (!name) throw new Error(`Missing argument contract name`); - const folder = `src/contracts/${snakeCase(name)}_contract`; - const source = readFileSync(`${folder}/src/main.nr`).toString(); + const folderName = `${snakeCase(name)}_contract`; + const folderPath = `src/contracts/${folderName}`; + const source = readFileSync(`${folderPath}/src/main.nr`).toString(); const contractName = process.argv[3] ?? upperFirst(camelCase(name)); - const build = JSON.parse(readFileSync(`${folder}/target/main-${contractName}.json`).toString()); + const build = JSON.parse(readFileSync(`${folderPath}/target/${folderName}-${contractName}.json`).toString()); const artifacts = 'src/artifacts'; const abi = { diff --git a/yarn-project/noir-libs/easy-private-state/Nargo.toml b/yarn-project/noir-libs/easy-private-state/Nargo.toml index c8efb71d005..5cb4146f22b 100644 --- a/yarn-project/noir-libs/easy-private-state/Nargo.toml +++ b/yarn-project/noir-libs/easy-private-state/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "easy-private-state" +name = "easy_private_state" authors = ["aztec-labs"] compiler_version = "0.7.1" diff --git a/yarn-project/noir-libs/noir-aztec/Nargo.toml b/yarn-project/noir-libs/noir-aztec/Nargo.toml index ac30862b554..9681257346d 100644 --- a/yarn-project/noir-libs/noir-aztec/Nargo.toml +++ b/yarn-project/noir-libs/noir-aztec/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "noir-aztec" +name = "noir_aztec" authors = [""] compiler_version = "0.1" diff --git a/yarn-project/noir-libs/value-note/Nargo.toml b/yarn-project/noir-libs/value-note/Nargo.toml index a6da913e38b..ed87714a07f 100644 --- a/yarn-project/noir-libs/value-note/Nargo.toml +++ b/yarn-project/noir-libs/value-note/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "value-note" +name = "value_note" authors = ["aztec-labs"] compiler_version = "0.7.1"