Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor Solidity Transcript and improve error handling in sol_honk flow #11158

Merged
merged 5 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions barretenberg/acir_tests/sol-test/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import solc from "solc";
const NUMBER_OF_FIELDS_IN_PLONK_PROOF = 93;
const NUMBER_OF_FIELDS_IN_HONK_PROOF = 443;

const WRONG_PUBLIC_INPUTS_LENGTH = "0xfa066593";
const SUMCHECK_FAILED = "0x9fc3a218";
const SHPLEMINI_FAILED = "0xa5d82e8a";

// We use the solcjs compiler version in this test, although it is slower than foundry, to run the test end to end
// it simplifies of parallelising the test suite

Expand Down Expand Up @@ -94,7 +98,7 @@ if (!testingHonk) {
}

var output = JSON.parse(solc.compile(JSON.stringify(compilationInput)));
if (output.errors.some((e) => e.type == "Error")) {
if (output.errors.some((e) => e.severity == "error")) {
throw new Error(JSON.stringify(output.errors, null, 2));
}
const contract = output.contracts["Test.sol"]["Test"];
Expand Down Expand Up @@ -236,8 +240,20 @@ try {
const result = await contract.test(proofStr, publicInputs);
if (!result) throw new Error("Test failed");
} catch (e) {
console.error(testName, " failed");
console.log(e);
console.error(testName, "failed");
if (testingHonk) {
var errorType = e.data;
switch (errorType) {
case WRONG_PUBLIC_INPUTS_LENGTH:
throw new Error("Number of inputs in the proof is wrong");
case SUMCHECK_FAILED:
throw new Error("Sumcheck round failed");
case SHPLEMINI_FAILED:
throw new Error("PCS round failed");
default:
throw e;
}
}
throw e;
} finally {
// Kill anvil at the end of running
Expand Down
Loading
Loading