Skip to content

Commit 41dbb48

Browse files
chore: Update index.js so that HAS_ZK and PUBLIC_INPUTS variables must always be set in tests (#19884)
Update `index.js` so that `HAS_ZK` and `PUBLIC_INPUTS` variables must always be set in tests. These code paths were leftovers from Plonk. Closes AztecProtocol/barretenberg#1316
1 parent b090d22 commit 41dbb48

File tree

1 file changed

+7
-20
lines changed
  • barretenberg/acir_tests/sol-test/src

1 file changed

+7
-20
lines changed

barretenberg/acir_tests/sol-test/src/index.js

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ const GEMINI_CHALLENGE_IN_SUBGROUP = "0x835eb8f7";
2727
// 5. Run the test against the deployed contract
2828
// 6. Kill the anvil instance
2929

30-
const getEnvVarCanBeUndefined = (envvar) => {
31-
const varVal = process.env[envvar];
32-
if (!varVal) {
33-
return false;
34-
}
35-
return varVal;
36-
};
37-
3830
const getEnvVar = (envvar) => {
3931
const varVal = process.env[envvar];
4032
if (!varVal) {
@@ -55,7 +47,7 @@ const [test, verifier] = await Promise.all([
5547
fsPromises.readFile(verifierPath, encoding),
5648
]);
5749

58-
const hasZK = getEnvVarCanBeUndefined("HAS_ZK");
50+
const hasZK = getEnvVar("HAS_ZK");
5951

6052
export const compilationInput = {
6153
language: "Solidity",
@@ -230,7 +222,6 @@ const killAnvil = () => {
230222
console.log(testName, " complete");
231223
};
232224

233-
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1316): Clean this code up. We are trying to use this logic for three different flows: bb plonk, bb honk, and bbjs honk, and all three have different setups.
234225
try {
235226
const proofPath = getEnvVar("PROOF");
236227

@@ -239,7 +230,7 @@ try {
239230
const proof = readFileSync(proofPath);
240231
proofStr = proof.toString("hex");
241232

242-
let publicInputsPath = getEnvVarCanBeUndefined("PUBLIC_INPUTS");
233+
let publicInputsPath = getEnvVar("PUBLIC_INPUTS");
243234
var publicInputs = [];
244235
let numExtraPublicInputs = 0;
245236
let extraPublicInputs = [];
@@ -251,15 +242,11 @@ try {
251242
[numExtraPublicInputs, extraPublicInputs] = readPublicInputs(proofAsFields);
252243
}
253244

254-
// Read public inputs from binary file if available
255-
if (publicInputsPath) {
256-
const publicInputsBinary = readFileSync(publicInputsPath);
257-
const innerPublicInputs = binaryToFields(publicInputsBinary);
258-
publicInputs = innerPublicInputs.concat(extraPublicInputs);
259-
} else {
260-
// for plonk, the extraPublicInputs are all of the public inputs
261-
publicInputs = extraPublicInputs;
262-
}
245+
// Read public inputs from binary file
246+
const publicInputsBinary = readFileSync(publicInputsPath);
247+
const innerPublicInputs = binaryToFields(publicInputsBinary);
248+
publicInputs = innerPublicInputs.concat(extraPublicInputs);
249+
263250
proofStr = proofStr.substring(64 * numExtraPublicInputs);
264251
proofStr = "0x" + proofStr;
265252

0 commit comments

Comments
 (0)