-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Backup proof failures to google cloud storage (#11255)
Backups failed proof inputs to a configurable google cloud storage bucket. Uploads are done from the `BrokerCircuitProverFacade` using an optional `ProofStore` for failed proofs. Adds a new `GoogleCloudProofStore` that stores proof inputs (outputs not implemented) in a google cloud storage bucket. Uses Application Default Credentials for connecting, which works locally after configuring gcloud credentials locally. Pending configuring the k8s cluster so pods there have access to gcs. The store is enabled via a config var `PROVER_FAILED_PROOF_STORE=gs://aztec-develop/dev/palla/`, which defines bucket and path. Failed jobs are logged with their uri: ``` [19:32:12.167] INFO: prover-client:broker-circuit-prover-facade Stored proof inputs for failed job id=3:PUBLIC_VM:7967c3a6f2c5728a94be3643db4ac088a057392f24f897cbbff4b0ea4fc8bc83 type=PUBLIC_VM at gs://aztec-develop/dev/palla/proofs/inputs/PUBLIC_VM/3:PUBLIC_VM:7967c3a6f2c5728a94be3643db4ac088a057392f24f897cbbff4b0ea4fc8bc83 {"id":"3:PUBLIC_VM:7967c3a6f2c5728a94be3643db4ac088a057392f24f897cbbff4b0ea4fc8bc83","type":0,"uri":"gs://aztec-develop/dev/palla/proofs/inputs/PUBLIC_VM/3:PUBLIC_VM:7967c3a6f2c5728a94be3643db4ac088a057392f24f897cbbff4b0ea4fc8bc83"} ``` This PR also adds `get-proof-inputs` a command to download the proof inputs via uri and write them locally using the same filenames that bb expects (only implemented for AVM for now): ``` $ yarn get-proof-inputs gs://aztec-develop/dev/palla/proofs/inputs/PUBLIC_VM/3:PUBLIC_VM:4e30aa697f479043cabfab9fab561b7195e2996cbb276cefdd8c6f1f29b60e69 [20:07:15.153] INFO: prover-client:proof-store Creating google cloud proof store at aztec-develop {"bucket":"aztec-develop","path":"dev/palla/proofs/inputs/PUBLIC_VM/3:PUBLIC_VM:4e30aa697f479043cabfab9fab561b7195e2996cbb276cefdd8c6f1f29b60e69"} [20:07:15.153] INFO: prover-client:get-proof-inputs Processing uri gs://aztec-develop/dev/palla/proofs/inputs/PUBLIC_VM/3:PUBLIC_VM:4e30aa697f479043cabfab9fab561b7195e2996cbb276cefdd8c6f1f29b60e69 [20:07:17.512] INFO: prover-client:get-proof-inputs Found inputs for PUBLIC_VM [20:07:17.514] INFO: prover-client:get-proof-inputs Wrote AVM public inputs to avm_public_inputs.bin [20:07:17.516] INFO: prover-client:get-proof-inputs Wrote AVM hints to avm_hints.bin ``` Fixes #11062
- Loading branch information
1 parent
fbcc8ef
commit b4775fd
Showing
24 changed files
with
588 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* eslint-disable no-console */ | ||
import { AVM_HINTS_FILENAME, AVM_PUBLIC_INPUTS_FILENAME } from '@aztec/bb-prover'; | ||
import { type ProofUri, ProvingJobInputs, ProvingRequestType } from '@aztec/circuit-types'; | ||
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc'; | ||
import { createLogger } from '@aztec/foundation/log'; | ||
|
||
import { mkdirSync, writeFileSync } from 'fs'; | ||
|
||
import { createProofStoreForUri } from '../proving_broker/index.js'; | ||
|
||
const logger = createLogger('prover-client:get-proof-inputs'); | ||
|
||
function printUsage() { | ||
console.error('Usage: get-proof-inputs <proof-uri> [out-dir=.]'); | ||
} | ||
|
||
async function main() { | ||
if (process.argv[2] === '--help') { | ||
printUsage(); | ||
return; | ||
} | ||
|
||
const uri = process.argv[2]; | ||
const outDir = process.argv[3] || '.'; | ||
if (!uri) { | ||
printUsage(); | ||
throw new Error('Missing proof URI'); | ||
} | ||
|
||
mkdirSync(outDir, { recursive: true }); | ||
|
||
const proofStore = createProofStoreForUri(uri); | ||
logger.info(`Processing uri ${uri}`); | ||
const input = await proofStore.getProofInput(uri as ProofUri); | ||
logger.info(`Found inputs for ${ProvingRequestType[input.type]}`); | ||
writeProofInputs(input, outDir); | ||
|
||
console.log(jsonParseWithSchema(jsonStringify(input), ProvingJobInputs).inputs); | ||
} | ||
|
||
// This mimics the behavior of bb-prover/src/bb/execute.ts | ||
function writeProofInputs(input: ProvingJobInputs, outDir: string) { | ||
switch (input.type) { | ||
case ProvingRequestType.PUBLIC_VM: { | ||
writeFileSync(`${outDir}/${AVM_PUBLIC_INPUTS_FILENAME}`, input.inputs.output.toBuffer()); | ||
logger.info(`Wrote AVM public inputs to ${AVM_PUBLIC_INPUTS_FILENAME}`); | ||
writeFileSync(`${outDir}/${AVM_HINTS_FILENAME}`, input.inputs.avmHints.toBuffer()); | ||
logger.info(`Wrote AVM hints to ${AVM_HINTS_FILENAME}`); | ||
break; | ||
} | ||
default: { | ||
throw new Error(`Unimplemented proving request type: ${ProvingRequestType[input.type]}`); | ||
} | ||
} | ||
} | ||
|
||
main().catch(err => { | ||
console.error(err); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.