From 9de98f3c0581f523a4444c9768f0c524da0bf276 Mon Sep 17 00:00:00 2001 From: josh crites Date: Tue, 30 Jul 2024 16:17:13 -0400 Subject: [PATCH 01/31] updating foundry --- with-foundry/README.md | 32 +++++++++--- with-foundry/circuits/Nargo.toml | 2 +- with-foundry/contract/Starter.sol | 2 +- with-foundry/script/Starter.s.sol | 2 +- with-foundry/script/Verify.s.sol | 2 +- with-foundry/script/prove.sh | 5 +- with-foundry/test/Starter.t.sol | 84 ++++++++++++++++--------------- 7 files changed, 74 insertions(+), 55 deletions(-) diff --git a/with-foundry/README.md b/with-foundry/README.md index be39eaba..2bd7ad77 100644 --- a/with-foundry/README.md +++ b/with-foundry/README.md @@ -24,12 +24,27 @@ Install [noirup](https://noir-lang.org/docs/getting_started/installation/#instal noirup ``` -3. Install foundryup and follow the instructions on screen. You should then have all the foundry tools like `forge`, `cast`, `anvil` and `chisel`. +3. Install foundryup and follow the instructions on screen. You should then have all the foundry + tools like `forge`, `cast`, `anvil` and `chisel`. ```bash curl -L https://foundry.paradigm.xyz | bash ``` +4. Install the correct version of the + [Barretenberg](https://github.com/AztecProtocol/aztec-packages/tree/master/barretenberg/cpp/src/barretenberg/bb#version-compatibility-with-noir) + proving backend for Noir (bb). + + ```bash + curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install | bash + ``` + + then + + ```bash + bbup -v 0.46.1 # compatible with nargo 0.31.0 + ``` + ## Generate verifier contract and proof ### Contract @@ -38,21 +53,24 @@ The deployment assumes a verifier contract has been generated by nargo. In order ```bash cd circuits -nargo codegen-verifier +nargo compile +bb write_vk -b ./target/with_foundry.json +bb contract ``` -A file named `plonk_vk.sol` should appear in the `circuits/contracts/with_foundry` folder. +A file named `contract.sol` should appear in the `circuits/target` folder. #### Proof -You also need a proof, as this template currently doesn't employ `ffi` to call `nargo prove` by -itself. For this, ensure your prover parameters are correct in `Prover.toml` and run: +You also need a proof, as this template currently doesn't employ `ffi` to call `nargo execute` (to +generate the witness) and `bb prove` by itself. For this, ensure your prover parameters are correct +in `Prover.toml` and run: ```bash -nargo prove +bb prove -b ./target/with_foundry.json -w ./target/witness.gz -o ./target/with_foundry.proof ``` -A file named `with_foundry.proof` should appear in the `./circuits/proofs` folder. +A file named `with_foundry.proof` should appear in the `./circuits/target` folder. ### Test with Foundry diff --git a/with-foundry/circuits/Nargo.toml b/with-foundry/circuits/Nargo.toml index 3907d074..f9bc18a0 100644 --- a/with-foundry/circuits/Nargo.toml +++ b/with-foundry/circuits/Nargo.toml @@ -2,6 +2,6 @@ name="with_foundry" type="bin" authors = ["critesjosh"] -compiler_version = ">=0.27.0" +compiler_version = ">=0.31.0" [dependencies] diff --git a/with-foundry/contract/Starter.sol b/with-foundry/contract/Starter.sol index de49ac91..7359e602 100644 --- a/with-foundry/contract/Starter.sol +++ b/with-foundry/contract/Starter.sol @@ -1,6 +1,6 @@ pragma solidity ^0.8.17; -import "../circuits/contract/with_foundry/plonk_vk.sol"; +import "../circuits/target/contract.sol"; contract Starter { UltraVerifier public verifier; diff --git a/with-foundry/script/Starter.s.sol b/with-foundry/script/Starter.s.sol index 9b8e3a12..32cf575a 100644 --- a/with-foundry/script/Starter.s.sol +++ b/with-foundry/script/Starter.s.sol @@ -1,7 +1,7 @@ pragma solidity ^0.8.17; import "forge-std/Script.sol"; -import "../circuits/contract/with_foundry/plonk_vk.sol"; +import "../circuits/target/contract.sol"; import "../contract/Starter.sol"; contract StarterScript is Script { diff --git a/with-foundry/script/Verify.s.sol b/with-foundry/script/Verify.s.sol index 5f09f77b..e0ef4f47 100644 --- a/with-foundry/script/Verify.s.sol +++ b/with-foundry/script/Verify.s.sol @@ -1,7 +1,7 @@ pragma solidity ^0.8.17; import "forge-std/Script.sol"; -import "../circuits/contract/with_foundry/plonk_vk.sol"; +import "../circuits/target/contract.sol"; import "../contract/Starter.sol"; contract VerifyScript is Script { diff --git a/with-foundry/script/prove.sh b/with-foundry/script/prove.sh index beffbb58..e216e816 100755 --- a/with-foundry/script/prove.sh +++ b/with-foundry/script/prove.sh @@ -1,7 +1,6 @@ #!/bin/bash -if [ "$#" -ne 1 ] -then +if [ "$#" -ne 1 ]; then echo "Usage: ./prove.sh [TESTNAME_STRING]" exit 1 fi -cd /tmp/$1 && nargo prove && echo "Proof Generated" +cd /tmp/$1 && nargo execute witness && bb prove -b ./target/with_foundry.json -w ./target/witness.gz -o ./target/with_foundry.proof && echo "Proof Generated" diff --git a/with-foundry/test/Starter.t.sol b/with-foundry/test/Starter.t.sol index e626e54c..38619a63 100644 --- a/with-foundry/test/Starter.t.sol +++ b/with-foundry/test/Starter.t.sol @@ -2,7 +2,8 @@ pragma solidity ^0.8.17; import "forge-std/Test.sol"; import "../contract/Starter.sol"; -import "../circuits/contract/with_foundry/plonk_vk.sol"; +import "../circuits/target/contract.sol"; +import "forge-std/console.sol"; contract StarterTest is Test { Starter public starter; @@ -22,14 +23,15 @@ contract StarterTest is Test { } function testVerifyProof() public { - string memory proof = vm.readLine("./circuits/proofs/with_foundry.proof"); + string memory proof = vm.readLine("./circuits/target/with_foundry.proof"); + console.log("proof: ", proof); bytes memory proofBytes = vm.parseBytes(proof); starter.verifyEqual(proofBytes, correct); } function test_wrongProof() public { vm.expectRevert(); - string memory proof = vm.readLine("./circuits/proofs/with_foundry.proof"); + string memory proof = vm.readLine("./circuits/target/with_foundry.proof"); bytes memory proofBytes = vm.parseBytes(proof); starter.verifyEqual(proofBytes, wrong); } @@ -50,43 +52,43 @@ contract StarterTest is Test { starter.verifyEqual(proofBytes, dynamicCorrect); } - function test_dynamicProofSecondTest() public { - string[] memory _fieldNames = new string[](2); - string[] memory _fieldValues = new string[](2); - - _fieldNames[0] = "x"; - _fieldNames[1] = "y"; - _fieldValues[0] = "8"; - _fieldValues[1] = "8"; - - // Set expected dynamic proof outcome - dynamicCorrect[0] = bytes32(0x0000000000000000000000000000000000000000000000000000000000000008); - dynamicCorrect[1] = dynamicCorrect[0]; - bytes memory proofBytes = generateDynamicProof("test2", _fieldNames, _fieldValues); - starter.verifyEqual(proofBytes, dynamicCorrect); - } - - function test_dynamicProofThirdTest() public { - string[] memory _fieldNames = new string[](2); - string[] memory _fieldValues = new string[](2); - - _fieldNames[0] = "x"; - _fieldNames[1] = "y"; - _fieldValues[0] = "7"; - _fieldValues[1] = "7"; - - // Set expected dynamic proof outcome - dynamicCorrect[0] = bytes32(0x0000000000000000000000000000000000000000000000000000000000000007); - dynamicCorrect[1] = dynamicCorrect[0]; - bytes memory proofBytes = generateDynamicProof("test3", _fieldNames, _fieldValues); - starter.verifyEqual(proofBytes, dynamicCorrect); - } - - /// @dev This function generates dynamic proofs using 2 scripts in the /script directory - /// - /// @param _testName a random string to identify the test by, this is used to create a unique folder name in the /tmp directory - /// @param _fields The field names within the Prover.toml file - /// @param _fieldValues The field values associated with fields names within the Prover.toml file + // function test_dynamicProofSecondTest() public { + // string[] memory _fieldNames = new string[](2); + // string[] memory _fieldValues = new string[](2); + + // _fieldNames[0] = "x"; + // _fieldNames[1] = "y"; + // _fieldValues[0] = "8"; + // _fieldValues[1] = "8"; + + // // Set expected dynamic proof outcome + // dynamicCorrect[0] = bytes32(0x0000000000000000000000000000000000000000000000000000000000000008); + // dynamicCorrect[1] = dynamicCorrect[0]; + // bytes memory proofBytes = generateDynamicProof("test2", _fieldNames, _fieldValues); + // starter.verifyEqual(proofBytes, dynamicCorrect); + // } + + // function test_dynamicProofThirdTest() public { + // string[] memory _fieldNames = new string[](2); + // string[] memory _fieldValues = new string[](2); + + // _fieldNames[0] = "x"; + // _fieldNames[1] = "y"; + // _fieldValues[0] = "7"; + // _fieldValues[1] = "7"; + + // // Set expected dynamic proof outcome + // dynamicCorrect[0] = bytes32(0x0000000000000000000000000000000000000000000000000000000000000007); + // dynamicCorrect[1] = dynamicCorrect[0]; + // bytes memory proofBytes = generateDynamicProof("test3", _fieldNames, _fieldValues); + // starter.verifyEqual(proofBytes, dynamicCorrect); + // } + + // /// @dev This function generates dynamic proofs using 2 scripts in the /script directory + // /// + // /// @param _testName a random string to identify the test by, this is used to create a unique folder name in the /tmp directory + // /// @param _fields The field names within the Prover.toml file + // /// @param _fieldValues The field values associated with fields names within the Prover.toml file function generateDynamicProof(string memory _testName, string[] memory _fields, string[] memory _fieldValues) public returns (bytes memory) @@ -112,7 +114,7 @@ contract StarterTest is Test { ffi_command[1] = _testName; bytes memory commandResponse = vm.ffi(ffi_command); console.log(string(commandResponse)); - string memory _newProof = vm.readLine(string.concat("/tmp/", _testName, "/proofs/with_foundry.proof")); + string memory _newProof = vm.readLine(string.concat("/tmp/", _testName, "/target/with_foundry.proof")); return vm.parseBytes(_newProof); } } From fbfec7402238839647e96e1e5c1e5cd9695a67fc Mon Sep 17 00:00:00 2001 From: josh crites Date: Tue, 30 Jul 2024 21:17:35 -0400 Subject: [PATCH 02/31] passing tests --- with-foundry/test/Starter.t.sol | 124 +++++++++++++++++++------------- 1 file changed, 76 insertions(+), 48 deletions(-) diff --git a/with-foundry/test/Starter.t.sol b/with-foundry/test/Starter.t.sol index 38619a63..232e255b 100644 --- a/with-foundry/test/Starter.t.sol +++ b/with-foundry/test/Starter.t.sol @@ -22,18 +22,17 @@ contract StarterTest is Test { wrong[0] = bytes32(0x0000000000000000000000000000000000000000000000000000000000000004); } - function testVerifyProof() public { - string memory proof = vm.readLine("./circuits/target/with_foundry.proof"); - console.log("proof: ", proof); - bytes memory proofBytes = vm.parseBytes(proof); - starter.verifyEqual(proofBytes, correct); + function testVerifyProof() public view { + bytes memory proof_w_inputs = vm.readFileBinary("./circuits/target/with_foundry.proof"); + bytes memory last = sliceAfter64Bytes(proof_w_inputs); + starter.verifyEqual(last, correct); } function test_wrongProof() public { vm.expectRevert(); - string memory proof = vm.readLine("./circuits/target/with_foundry.proof"); - bytes memory proofBytes = vm.parseBytes(proof); - starter.verifyEqual(proofBytes, wrong); + bytes memory proof_w_inputs = vm.readFileBinary("./circuits/target/with_foundry.proof"); + bytes memory proof = sliceAfter64Bytes(proof_w_inputs); + starter.verifyEqual(proof, wrong); } function test_dynamicProof() public { @@ -49,46 +48,49 @@ contract StarterTest is Test { dynamicCorrect[0] = bytes32(0x0000000000000000000000000000000000000000000000000000000000000005); dynamicCorrect[1] = dynamicCorrect[0]; bytes memory proofBytes = generateDynamicProof("test1", _fieldNames, _fieldValues); - starter.verifyEqual(proofBytes, dynamicCorrect); + bytes memory proof = sliceAfter64Bytes(proofBytes); + starter.verifyEqual(proof, dynamicCorrect); } - // function test_dynamicProofSecondTest() public { - // string[] memory _fieldNames = new string[](2); - // string[] memory _fieldValues = new string[](2); - - // _fieldNames[0] = "x"; - // _fieldNames[1] = "y"; - // _fieldValues[0] = "8"; - // _fieldValues[1] = "8"; - - // // Set expected dynamic proof outcome - // dynamicCorrect[0] = bytes32(0x0000000000000000000000000000000000000000000000000000000000000008); - // dynamicCorrect[1] = dynamicCorrect[0]; - // bytes memory proofBytes = generateDynamicProof("test2", _fieldNames, _fieldValues); - // starter.verifyEqual(proofBytes, dynamicCorrect); - // } - - // function test_dynamicProofThirdTest() public { - // string[] memory _fieldNames = new string[](2); - // string[] memory _fieldValues = new string[](2); - - // _fieldNames[0] = "x"; - // _fieldNames[1] = "y"; - // _fieldValues[0] = "7"; - // _fieldValues[1] = "7"; - - // // Set expected dynamic proof outcome - // dynamicCorrect[0] = bytes32(0x0000000000000000000000000000000000000000000000000000000000000007); - // dynamicCorrect[1] = dynamicCorrect[0]; - // bytes memory proofBytes = generateDynamicProof("test3", _fieldNames, _fieldValues); - // starter.verifyEqual(proofBytes, dynamicCorrect); - // } - - // /// @dev This function generates dynamic proofs using 2 scripts in the /script directory - // /// - // /// @param _testName a random string to identify the test by, this is used to create a unique folder name in the /tmp directory - // /// @param _fields The field names within the Prover.toml file - // /// @param _fieldValues The field values associated with fields names within the Prover.toml file + function test_dynamicProofSecondTest() public { + string[] memory _fieldNames = new string[](2); + string[] memory _fieldValues = new string[](2); + + _fieldNames[0] = "x"; + _fieldNames[1] = "y"; + _fieldValues[0] = "8"; + _fieldValues[1] = "8"; + + // Set expected dynamic proof outcome + dynamicCorrect[0] = bytes32(0x0000000000000000000000000000000000000000000000000000000000000008); + dynamicCorrect[1] = dynamicCorrect[0]; + bytes memory proofBytes = generateDynamicProof("test2", _fieldNames, _fieldValues); + bytes memory proof = sliceAfter64Bytes(proofBytes); + starter.verifyEqual(proof, dynamicCorrect); + } + + function test_dynamicProofThirdTest() public { + string[] memory _fieldNames = new string[](2); + string[] memory _fieldValues = new string[](2); + + _fieldNames[0] = "x"; + _fieldNames[1] = "y"; + _fieldValues[0] = "7"; + _fieldValues[1] = "7"; + + // Set expected dynamic proof outcome + dynamicCorrect[0] = bytes32(0x0000000000000000000000000000000000000000000000000000000000000007); + dynamicCorrect[1] = dynamicCorrect[0]; + bytes memory proofBytes = generateDynamicProof("test3", _fieldNames, _fieldValues); + bytes memory proof = sliceAfter64Bytes(proofBytes); + starter.verifyEqual(proof, dynamicCorrect); + } + + /// @dev This function generates dynamic proofs using 2 scripts in the /script directory + /// + /// @param _testName a random string to identify the test by, this is used to create a unique folder name in the /tmp directory + /// @param _fields The field names within the Prover.toml file + /// @param _fieldValues The field values associated with fields names within the Prover.toml file function generateDynamicProof(string memory _testName, string[] memory _fields, string[] memory _fieldValues) public returns (bytes memory) @@ -114,7 +116,33 @@ contract StarterTest is Test { ffi_command[1] = _testName; bytes memory commandResponse = vm.ffi(ffi_command); console.log(string(commandResponse)); - string memory _newProof = vm.readLine(string.concat("/tmp/", _testName, "/target/with_foundry.proof")); - return vm.parseBytes(_newProof); + bytes memory _newProof = vm.readFileBinary(string.concat("/tmp/", _testName, "/target/with_foundry.proof")); + return _newProof; + } + + // Utility function, because the proof file includes the public inputs at the beginning + function sliceAfter64Bytes(bytes memory _bytes) internal pure returns (bytes memory) { + require(_bytes.length > 64, "Input must be longer than 64 bytes"); + + uint256 remainingLength = _bytes.length - 64; + bytes memory result = new bytes(remainingLength); + + assembly { + // Copy remaining bytes + let resultPtr := add(result, 32) // skipping the length field + let sourcePtr := add(_bytes, 96) // 32 (length field) + 64 (bytes to skip) + for { let i := 0 } lt(i, remainingLength) { i := add(i, 32) } { + mstore(add(resultPtr, i), mload(add(sourcePtr, i))) + } + + // Handle the last chunk if remaining length is not a multiple of 32 + let lastChunk := and(remainingLength, 0x1f) // remainingLength % 32 + if gt(lastChunk, 0) { + let mask := not(sub(exp(256, sub(32, lastChunk)), 1)) + mstore(add(resultPtr, remainingLength), and(mload(add(sourcePtr, remainingLength)), mask)) + } + } + + return result; } } From 03be8557ae9e8a40ea6d81eace1972e235daa48a Mon Sep 17 00:00:00 2001 From: josh crites Date: Tue, 30 Jul 2024 21:26:41 -0400 Subject: [PATCH 03/31] try install bb --- .github/workflows/with_foundry.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 4a0cb23c..da4691c4 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -31,14 +31,22 @@ jobs: - name: Set up foundry uses: ./.github/actions/setup-foundry + - name: Install bb + run: | + curl -L + https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install + | bash + source ~/.bashrc + bbup + - name: Generate verifier contract run: | - nargo codegen-verifier + nargo compile && bb write_vk -b ./target/with_foundry.json && bb contract working-directory: with-foundry/circuits - name: Generate proof run: | - nargo prove + bb prove -b ./target/with_foundry.json -w ./target/witness.gz -o ./target/with_foundry.proof working-directory: with-foundry/circuits - name: Test with Foundry From 441a56d4706c500cd8bb119f524aeaf40e5af10d Mon Sep 17 00:00:00 2001 From: josh crites Date: Tue, 30 Jul 2024 21:27:45 -0400 Subject: [PATCH 04/31] update --- .github/workflows/with_foundry.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index da4691c4..ea6fe6e3 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -33,9 +33,7 @@ jobs: - name: Install bb run: | - curl -L - https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install - | bash + curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install | bash source ~/.bashrc bbup From f66256ad47ee7fa1c76786d9a62ee1231c2eabab Mon Sep 17 00:00:00 2001 From: josh crites Date: Tue, 30 Jul 2024 21:28:56 -0400 Subject: [PATCH 05/31] update --- .github/workflows/with_foundry.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index ea6fe6e3..1064a259 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -34,7 +34,7 @@ jobs: - name: Install bb run: | curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install | bash - source ~/.bashrc + source /home/runner/.bashrc bbup - name: Generate verifier contract From 585815646d77a6cedaad740b3bc240605ca1e32e Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 08:46:27 -0400 Subject: [PATCH 06/31] try manually adding path --- .github/workflows/with_foundry.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 1064a259..67e4c14c 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -34,7 +34,7 @@ jobs: - name: Install bb run: | curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install | bash - source /home/runner/.bashrc + export PATH=$PATH:~/.bb/bb bbup - name: Generate verifier contract From 404a092ab7f0db58cd91343d718720452586fc94 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 08:48:48 -0400 Subject: [PATCH 07/31] add debug --- .github/workflows/with_foundry.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 67e4c14c..1327aa99 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -35,8 +35,15 @@ jobs: run: | curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install | bash export PATH=$PATH:~/.bb/bb + source /home/runner/.bashrc bbup + - name: Debug + run: | + echo $PATH + which bbup + ls -l /path/to/bbup/directory + - name: Generate verifier contract run: | nargo compile && bb write_vk -b ./target/with_foundry.json && bb contract From 03f7eef76ebf42a446e56447069d5765f5f6842a Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 08:49:59 -0400 Subject: [PATCH 08/31] debug --- .github/workflows/with_foundry.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 1327aa99..2cae26d2 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -34,15 +34,15 @@ jobs: - name: Install bb run: | curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install | bash - export PATH=$PATH:~/.bb/bb - source /home/runner/.bashrc - bbup - name: Debug run: | echo $PATH which bbup - ls -l /path/to/bbup/directory + ls -l ~/.bb + export PATH=$PATH:~/.bb/bb + source /home/runner/.bashrc + bbup - name: Generate verifier contract run: | From c3158f934603ed4828706088599fce264901205c Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 08:54:52 -0400 Subject: [PATCH 09/31] try again --- .github/workflows/with_foundry.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 2cae26d2..2244af43 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -34,6 +34,13 @@ jobs: - name: Install bb run: | curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install | bash + shell: bash + + - name: Source bashrc and use bbup + run: | + source ~/.bashrc + bbup --version # or any other bbup command you want to run + shell: bash - name: Debug run: | From 860d5392555d73ced5050625a77953b9cbd29388 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 08:55:47 -0400 Subject: [PATCH 10/31] typo --- .github/workflows/with_foundry.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 2244af43..f532c420 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -39,7 +39,7 @@ jobs: - name: Source bashrc and use bbup run: | source ~/.bashrc - bbup --version # or any other bbup command you want to run + bb --version # or any other bbup command you want to run shell: bash - name: Debug From f5894e9446b1285d00001165b48aaa5bacd47a2f Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 08:57:19 -0400 Subject: [PATCH 11/31] print bashrc --- .github/workflows/with_foundry.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index f532c420..b3dd6ea9 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -38,7 +38,8 @@ jobs: - name: Source bashrc and use bbup run: | - source ~/.bashrc + source /home/runner/.bashrc + cat /home/runner/.bashrc bb --version # or any other bbup command you want to run shell: bash From 3bd63a8660113803c1d0d493c28fa9cd1d86dc0d Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:30:46 -0400 Subject: [PATCH 12/31] ls -a --- .github/workflows/with_foundry.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index b3dd6ea9..d46fee7d 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -40,6 +40,7 @@ jobs: run: | source /home/runner/.bashrc cat /home/runner/.bashrc + ls -a /home/runner/.bb bb --version # or any other bbup command you want to run shell: bash From 58a89405d4e360841d18e10defeecb4dbfc6c564 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:32:50 -0400 Subject: [PATCH 13/31] bbup --- .github/workflows/with_foundry.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index d46fee7d..e1ad6aba 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -39,7 +39,8 @@ jobs: - name: Source bashrc and use bbup run: | source /home/runner/.bashrc - cat /home/runner/.bashrc + ls -a /home/runner/.bb + bbup ls -a /home/runner/.bb bb --version # or any other bbup command you want to run shell: bash From 7b6f4626d52ad5d773ff30fc2f1528fb17eb27c9 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:34:30 -0400 Subject: [PATCH 14/31] add to path --- .github/workflows/with_foundry.yaml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index e1ad6aba..ac31ca29 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -40,20 +40,13 @@ jobs: run: | source /home/runner/.bashrc ls -a /home/runner/.bb + export PATH=$PATH:~/.bb + echo $PATH bbup ls -a /home/runner/.bb bb --version # or any other bbup command you want to run shell: bash - - name: Debug - run: | - echo $PATH - which bbup - ls -l ~/.bb - export PATH=$PATH:~/.bb/bb - source /home/runner/.bashrc - bbup - - name: Generate verifier contract run: | nargo compile && bb write_vk -b ./target/with_foundry.json && bb contract From 71ad6d75b027ff1b56583949bb825f40312b7841 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:35:51 -0400 Subject: [PATCH 15/31] fix path --- .github/workflows/with_foundry.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index ac31ca29..77ef82c3 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -40,7 +40,7 @@ jobs: run: | source /home/runner/.bashrc ls -a /home/runner/.bb - export PATH=$PATH:~/.bb + export PATH=$PATH:/home/runner/.bb echo $PATH bbup ls -a /home/runner/.bb From 47387a4061cd851e4fe8c5c72f65e12d75d707bb Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:39:27 -0400 Subject: [PATCH 16/31] specify version --- .github/workflows/with_foundry.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 77ef82c3..09e0059c 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -38,12 +38,8 @@ jobs: - name: Source bashrc and use bbup run: | - source /home/runner/.bashrc - ls -a /home/runner/.bb export PATH=$PATH:/home/runner/.bb - echo $PATH - bbup - ls -a /home/runner/.bb + bbup -v 0.41.0 bb --version # or any other bbup command you want to run shell: bash From ec0c2c3cc317919ceb026cb82b65075160fe0780 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:45:19 -0400 Subject: [PATCH 17/31] save bbup and source --- .github/workflows/with_foundry.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 09e0059c..185d9874 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -38,13 +38,14 @@ jobs: - name: Source bashrc and use bbup run: | - export PATH=$PATH:/home/runner/.bb + echo "PATH=$PATH:/home/runner/.bb" >> $GITHUB_ENV bbup -v 0.41.0 bb --version # or any other bbup command you want to run shell: bash - name: Generate verifier contract run: | + source /home/runnner/.bashrc nargo compile && bb write_vk -b ./target/with_foundry.json && bb contract working-directory: with-foundry/circuits From b54165ab7996125fc92dd4b968df8944a22917c1 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:46:54 -0400 Subject: [PATCH 18/31] try just source --- .github/workflows/with_foundry.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 185d9874..59ce89a8 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -38,7 +38,7 @@ jobs: - name: Source bashrc and use bbup run: | - echo "PATH=$PATH:/home/runner/.bb" >> $GITHUB_ENV + export PATH=$PATH:/home/runner/.bb bbup -v 0.41.0 bb --version # or any other bbup command you want to run shell: bash From 95685b9eab5f05b0b8284b7c2145c0fbd6ebb31f Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:47:45 -0400 Subject: [PATCH 19/31] typo --- .github/workflows/with_foundry.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 59ce89a8..6e33ef7e 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -45,7 +45,7 @@ jobs: - name: Generate verifier contract run: | - source /home/runnner/.bashrc + source /home/runner/.bashrc nargo compile && bb write_vk -b ./target/with_foundry.json && bb contract working-directory: with-foundry/circuits From daacf87495fb57b6c3f746bd690817a5e00ded83 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:48:46 -0400 Subject: [PATCH 20/31] debug --- .github/workflows/with_foundry.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 6e33ef7e..00f831cf 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -41,6 +41,7 @@ jobs: export PATH=$PATH:/home/runner/.bb bbup -v 0.41.0 bb --version # or any other bbup command you want to run + which bb shell: bash - name: Generate verifier contract From c48e0bdb92ac59d19bf63dd80f1391a100f8d8d4 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:50:21 -0400 Subject: [PATCH 21/31] try adding path in each --- .github/workflows/with_foundry.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 00f831cf..127e3f96 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -46,12 +46,13 @@ jobs: - name: Generate verifier contract run: | - source /home/runner/.bashrc + export PATH=$PATH:/home/runner/.bb nargo compile && bb write_vk -b ./target/with_foundry.json && bb contract working-directory: with-foundry/circuits - name: Generate proof run: | + export PATH=$PATH:/home/runner/.bb bb prove -b ./target/with_foundry.json -w ./target/witness.gz -o ./target/with_foundry.proof working-directory: with-foundry/circuits From 9e898893fd9ebddb1f7ed42f5f14cc95ad6b8a2a Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:51:23 -0400 Subject: [PATCH 22/31] add witness --- .github/workflows/with_foundry.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 127e3f96..8a0577ff 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -53,6 +53,7 @@ jobs: - name: Generate proof run: | export PATH=$PATH:/home/runner/.bb + nargo exectue witness bb prove -b ./target/with_foundry.json -w ./target/witness.gz -o ./target/with_foundry.proof working-directory: with-foundry/circuits From ab7e7d8862f9428c05d05787f669672b9aa0b56f Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:53:43 -0400 Subject: [PATCH 23/31] typo, print --- .github/workflows/with_foundry.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 8a0577ff..7dedd8f0 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -53,7 +53,8 @@ jobs: - name: Generate proof run: | export PATH=$PATH:/home/runner/.bb - nargo exectue witness + cat /home/runner/.bashrc + nargo execute witness bb prove -b ./target/with_foundry.json -w ./target/witness.gz -o ./target/with_foundry.proof working-directory: with-foundry/circuits From 6d965e1bf19b088301b756ffe50e6bd5e52d21c0 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:56:19 -0400 Subject: [PATCH 24/31] bb for last step --- .github/workflows/with_foundry.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 7dedd8f0..e6f9e4df 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -52,12 +52,12 @@ jobs: - name: Generate proof run: | - export PATH=$PATH:/home/runner/.bb - cat /home/runner/.bashrc + source /home/runner/.bashrc nargo execute witness bb prove -b ./target/with_foundry.json -w ./target/witness.gz -o ./target/with_foundry.proof working-directory: with-foundry/circuits - name: Test with Foundry run: | + source /home/runner/.bashrc forge test --optimize --optimizer-runs 5000 --evm-version london From 71a37b660c9ea4d7bfbebca35be019e6db91af06 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:57:19 -0400 Subject: [PATCH 25/31] update bb path --- .github/workflows/with_foundry.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index e6f9e4df..3f4e61b3 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -52,12 +52,12 @@ jobs: - name: Generate proof run: | - source /home/runner/.bashrc + export PATH=$PATH:/home/runner/.bb nargo execute witness bb prove -b ./target/with_foundry.json -w ./target/witness.gz -o ./target/with_foundry.proof working-directory: with-foundry/circuits - name: Test with Foundry run: | - source /home/runner/.bashrc + export PATH=$PATH:/home/runner/.bb forge test --optimize --optimizer-runs 5000 --evm-version london From b1797100d8d7d37c5071c3cafa85bc38beed95d6 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 09:59:52 -0400 Subject: [PATCH 26/31] update step title --- .github/workflows/with_foundry.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 3f4e61b3..79c6abf4 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -36,7 +36,7 @@ jobs: curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install | bash shell: bash - - name: Source bashrc and use bbup + - name: Use bbup run: | export PATH=$PATH:/home/runner/.bb bbup -v 0.41.0 From 01900e13ee61cbc06486c472185890061fb59084 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 10:28:02 -0400 Subject: [PATCH 27/31] update --- .github/workflows/with_foundry.yaml | 1 - .github/workflows/with_foundry_nightly.yaml | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 79c6abf4..0e7f08e0 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -41,7 +41,6 @@ jobs: export PATH=$PATH:/home/runner/.bb bbup -v 0.41.0 bb --version # or any other bbup command you want to run - which bb shell: bash - name: Generate verifier contract diff --git a/.github/workflows/with_foundry_nightly.yaml b/.github/workflows/with_foundry_nightly.yaml index 8e4f94f3..839347be 100644 --- a/.github/workflows/with_foundry_nightly.yaml +++ b/.github/workflows/with_foundry_nightly.yaml @@ -88,18 +88,30 @@ jobs: echo LOCALHOST_PRIVATE_KEY="${{ secrets.LOCALHOST_PRIVATE_KEY }}" >> .env echo ANVIL_RPC="${{ secrets.ANVIL_RPC }}" >> .env + - name: Install bb + run: | + curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install | bash + export PATH=$PATH:/home/runner/.bb + bbup -v 0.46.1 + bb --version # or any other bbup command you want to run + shell: bash + - name: Generate verifier contract run: | - nargo codegen-verifier + export PATH=$PATH:/home/runner/.bb + nargo compile && bb write_vk -b ./target/with_foundry.json && bb contract working-directory: with-foundry/circuits - name: Generate proof run: | - nargo prove + export PATH=$PATH:/home/runner/.bb + nargo execute witness + bb prove -b ./target/with_foundry.json -w ./target/witness.gz -o ./target/with_foundry.proof working-directory: with-foundry/circuits - name: Test with Foundry run: | + export PATH=$PATH:/home/runner/.bb forge test --optimize --optimizer-runs 5000 --evm-version london - name: Send GitHub Action trigger data to Slack workflow - Stable From bc7ccd2e227429abe06d0b0b9cc547d40f416dee Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 11:31:37 -0400 Subject: [PATCH 28/31] try setting env --- .github/workflows/with_foundry.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 0e7f08e0..cc36f924 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -34,29 +34,26 @@ jobs: - name: Install bb run: | curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install | bash + echo "PATH=$PATH:/home/runner/.bb" >> $GITHUB_ENV shell: bash - name: Use bbup run: | - export PATH=$PATH:/home/runner/.bb bbup -v 0.41.0 bb --version # or any other bbup command you want to run shell: bash - name: Generate verifier contract run: | - export PATH=$PATH:/home/runner/.bb nargo compile && bb write_vk -b ./target/with_foundry.json && bb contract working-directory: with-foundry/circuits - name: Generate proof run: | - export PATH=$PATH:/home/runner/.bb nargo execute witness bb prove -b ./target/with_foundry.json -w ./target/witness.gz -o ./target/with_foundry.proof working-directory: with-foundry/circuits - name: Test with Foundry run: | - export PATH=$PATH:/home/runner/.bb forge test --optimize --optimizer-runs 5000 --evm-version london From 7b6658939fc6df44cb5031b8850327f7410179d8 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 11:31:49 -0400 Subject: [PATCH 29/31] rm nightly test --- .github/workflows/with_foundry_nightly.yaml | 137 -------------------- 1 file changed, 137 deletions(-) delete mode 100644 .github/workflows/with_foundry_nightly.yaml diff --git a/.github/workflows/with_foundry_nightly.yaml b/.github/workflows/with_foundry_nightly.yaml deleted file mode 100644 index 839347be..00000000 --- a/.github/workflows/with_foundry_nightly.yaml +++ /dev/null @@ -1,137 +0,0 @@ -name: Nightly With-Foundry drift test - -on: - # Giving ourselves a way to trigger this manually - workflow_dispatch: - schedule: - # Run a nightly release at 2 AM UTC - - cron: '0 2 * * *' - pull_request: - paths: - - 'with-foundry/**' - -jobs: - with-foundry-setup: - runs-on: ubuntu-latest - outputs: - versions: ${{ steps.set-matrix.outputs.versions }} - versions_map: ${{ steps.set-matrix.outputs.versions_map }} - steps: - - uses: actions/checkout@v4 - - - name: Get versions to test for drift - id: versions_step - run: | - output=$(node ./.github/scripts/latest.js) - echo "Output from Node.js script: $output" - echo "::set-output name=versionsMap::$output" - - - name: Set Up Matrix - id: set-matrix - run: | - VERSIONS_MAP='${{ steps.versions_step.outputs.versionsMap }}' - echo "Versions out of script: $VERSIONS_MAP" - - VERSIONS=$(echo "$VERSIONS_MAP" | jq -c '[.[]]') - echo "::set-output name=versions::$VERSIONS" - echo "::set-output name=versions_map::$VERSIONS_MAP" - - with-foundry-test-drift: - needs: with-foundry-setup - runs-on: ubuntu-latest - defaults: - run: - working-directory: with-foundry - strategy: - fail-fast: false - matrix: - version: ${{ fromJson(needs.with-foundry-setup.outputs.versions) }} - steps: - - uses: actions/checkout@v4 - - - name: Set up nargo - uses: ./.github/actions/setup-nargo - with: - version: ${{ matrix.version }} - - - name: Set up foundry - uses: ./.github/actions/setup-foundry - - - name: Get stability - id: get-stability - env: - VERSIONS_MAP: ${{ needs.with-foundry-setup.outputs.versions_map }} - run: | - VERSION="${{ matrix.version }}" - echo "Version Number: $VERSION" - - STABLE_VERSION=$(echo "$VERSIONS_MAP" | jq -r --arg VERSION "$VERSION" '.stable') - if [ "$STABLE_VERSION" == "$VERSION" ]; then - IS_STABLE="true" - else - IS_STABLE="false" - fi - echo "Is stable: $IS_STABLE" - echo "::set-output name=is_stable::$IS_STABLE" - - - name: Install test version - run: | - yarn add \ - @noir-lang/noir_js@${{ matrix.version }} \ - @noir-lang/backend_barretenberg@${{ matrix.version }} \ - @noir-lang/noir_wasm@${{ matrix.version }} \ - @noir-lang/types@${{ matrix.version }} - - - name: 'Create env file' - run: | - touch .env - echo LOCALHOST_PRIVATE_KEY="${{ secrets.LOCALHOST_PRIVATE_KEY }}" >> .env - echo ANVIL_RPC="${{ secrets.ANVIL_RPC }}" >> .env - - - name: Install bb - run: | - curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/install | bash - export PATH=$PATH:/home/runner/.bb - bbup -v 0.46.1 - bb --version # or any other bbup command you want to run - shell: bash - - - name: Generate verifier contract - run: | - export PATH=$PATH:/home/runner/.bb - nargo compile && bb write_vk -b ./target/with_foundry.json && bb contract - working-directory: with-foundry/circuits - - - name: Generate proof - run: | - export PATH=$PATH:/home/runner/.bb - nargo execute witness - bb prove -b ./target/with_foundry.json -w ./target/witness.gz -o ./target/with_foundry.proof - working-directory: with-foundry/circuits - - - name: Test with Foundry - run: | - export PATH=$PATH:/home/runner/.bb - forge test --optimize --optimizer-runs 5000 --evm-version london - - - name: Send GitHub Action trigger data to Slack workflow - Stable - uses: slackapi/slack-github-action@v1.24.0 - if: ${{ failure() && steps.get-stability.outputs.is_stable == 'true' }} - with: - payload: | - { - "text": "Oooops, seems like latest stable Noir breaks noir-starter! Projects needing updating: with-foundry ${{ matrix.version }}" - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - - - name: Send GitHub Action trigger data to Slack workflow - Prerelease - uses: slackapi/slack-github-action@v1.24.0 - if: ${{ failure() && steps.get-stability.outputs.is_stable == 'false' }} - with: - payload: | - { - "text": "Heads up DevRel! Once the prerelease becomes stable, the following project will break: with-foundry ${{ matrix.version }}" - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} From 7f213005fe522fc6f8cd06f1855fbeab32ef7b20 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 11:39:32 -0400 Subject: [PATCH 30/31] Update with-foundry/README.md Co-authored-by: Savio <72797635+Savio-Sou@users.noreply.github.com> --- with-foundry/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/with-foundry/README.md b/with-foundry/README.md index 2bd7ad77..68a2aa27 100644 --- a/with-foundry/README.md +++ b/with-foundry/README.md @@ -42,7 +42,7 @@ curl -L https://foundry.paradigm.xyz | bash then ```bash - bbup -v 0.46.1 # compatible with nargo 0.31.0 + bbup -v 0.41.0 # compatible with nargo 0.31.0 ``` ## Generate verifier contract and proof From 7c51a88391fd0177ce3ea9e9435475462c3a9150 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 31 Jul 2024 13:01:04 -0400 Subject: [PATCH 31/31] simplify --- with-foundry/test/Starter.t.sol | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/with-foundry/test/Starter.t.sol b/with-foundry/test/Starter.t.sol index 232e255b..f93d90db 100644 --- a/with-foundry/test/Starter.t.sol +++ b/with-foundry/test/Starter.t.sol @@ -121,28 +121,13 @@ contract StarterTest is Test { } // Utility function, because the proof file includes the public inputs at the beginning - function sliceAfter64Bytes(bytes memory _bytes) internal pure returns (bytes memory) { - require(_bytes.length > 64, "Input must be longer than 64 bytes"); - - uint256 remainingLength = _bytes.length - 64; - bytes memory result = new bytes(remainingLength); - - assembly { - // Copy remaining bytes - let resultPtr := add(result, 32) // skipping the length field - let sourcePtr := add(_bytes, 96) // 32 (length field) + 64 (bytes to skip) - for { let i := 0 } lt(i, remainingLength) { i := add(i, 32) } { - mstore(add(resultPtr, i), mload(add(sourcePtr, i))) - } - - // Handle the last chunk if remaining length is not a multiple of 32 - let lastChunk := and(remainingLength, 0x1f) // remainingLength % 32 - if gt(lastChunk, 0) { - let mask := not(sub(exp(256, sub(32, lastChunk)), 1)) - mstore(add(resultPtr, remainingLength), and(mload(add(sourcePtr, remainingLength)), mask)) - } + function sliceAfter64Bytes(bytes memory data) internal pure returns (bytes memory) { + uint256 length = data.length - 64; + bytes memory result = new bytes(data.length - 64); + for (uint i = 0; i < length; i++) { + result[i] = data[i + 64]; } - return result; } + }