quadratic-funding / mpc-phase2-suite

The MPC suite of tools for conducting zkSNARK Phase 2 Trusted Setup ceremonies
MIT License
16 stars 6 forks source link

feat(ceremony verification): implemented ceremony finalization verification #348

Closed ctrlc03 closed 1 year ago

ctrlc03 commented 1 year ago

Implemented a function that given a ceremony prefix will verify whether the finalization was successful: all artifacts are uploaded and are valid. These are compared with local copies that are generated on the fly. Ceremony verification is now a Hardhat task as it requires smart contract interaction.

Closes:

baumstern commented 1 year ago

Couldn't deploy Firebase functions:

% firebase deploy --only functions --project p0tion-dev-branch

=== Deploying to 'p0tion-dev-branch'...

i  deploying functions
Running command: yarn --prefix "$RESOURCE_DIR" build
yarn run v1.22.19
$ rimraf dist && rollup -c rollup.config.ts --configPlugin typescript

src/functions/index.ts → ./dist/src/functions/index.node.js, ./dist/src/functions/index.node.mjs...
(!) Unresolved dependencies
https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
firebase/functions (imported by "../actions/src/helpers/functions.ts" and "../actions/src/helpers/services.ts")
mime-types (imported by "../actions/src/helpers/storage.ts" and "src/lib/utils.ts")
firebase/firestore (imported by "../actions/src/helpers/database.ts", "../actions/src/helpers/verification.ts" and "../actions/src/helpers/services.ts")
ffjavascript (imported by "../actions/src/helpers/utils.ts" and "../actions/src/helpers/contracts.ts")
firebase/app (imported by "../actions/src/helpers/services.ts")
firebase/auth (imported by "../actions/src/helpers/authentication.ts")
ethers (imported by "../actions/src/helpers/contracts.ts")
solc (imported by "../actions/src/helpers/contracts.ts")
firebase-admin/firestore (imported by "src/lib/utils.ts" and "src/functions/circuit.ts")
node:fs (imported by "src/lib/utils.ts")
node:stream (imported by "src/lib/utils.ts")
node:util (imported by "src/lib/utils.ts")
timers/promises (imported by "src/lib/utils.ts")
firebase-functions/v1 (imported by "src/functions/circuit.ts")
firebase-functions/v2 (imported by "src/functions/circuit.ts")
(!) "this" has been rewritten to "undefined"
https://rollupjs.org/guide/en/#error-this-is-undefined
../../node_modules/solc/index.js
1: "use strict";
2: var __importDefault = (this && this.__importDefault) || function (mod) {
                          ^
3:     return (mod && mod.__esModule) ? mod : { "default": mod };
4: };
...and 1 other occurrence
created ./dist/src/functions/index.node.js, ./dist/src/functions/index.node.mjs in 1.5s
✨  Done in 4.25s.
✔  functions: Finished running predeploy script.
i  functions: preparing codebase default for deployment
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  artifactregistry: required API artifactregistry.googleapis.com is enabled
⚠  functions: package.json indicates an outdated version of firebase-functions. Please upgrade using npm install --save firebase-functions@latest in your functions directory.
i  functions: Loaded environment variables from .env.
i  functions: preparing . directory for uploading...
i  functions: packaged /Users/daehyun/workspace/mpc-phase2-suite/packages/backend (655.8 KB) for uploading
i  functions: packaged /Users/daehyun/workspace/mpc-phase2-suite/packages/backend (656.01 KB) for uploading
i  functions: ensuring required API cloudscheduler.googleapis.com is enabled...
✔  functions: required API cloudscheduler.googleapis.com is enabled
i  functions: ensuring required API run.googleapis.com is enabled...
i  functions: ensuring required API eventarc.googleapis.com is enabled...
i  functions: ensuring required API pubsub.googleapis.com is enabled...
i  functions: ensuring required API storage.googleapis.com is enabled...
✔  functions: required API storage.googleapis.com is enabled
✔  functions: required API eventarc.googleapis.com is enabled
✔  functions: required API run.googleapis.com is enabled
✔  functions: required API pubsub.googleapis.com is enabled
i  functions: generating the service identity for pubsub.googleapis.com...
i  functions: generating the service identity for eventarc.googleapis.com...
✔  functions: . folder uploaded successfully
i  functions: Skipping the deploy of unchanged functions with experimental support for skipdeployingnoopfunctions
i  functions: updating Node.js 16 function checkAndPrepareCoordinatorForFinalization(us-central1)...
i  functions: updating Node.js 16 function checkAndRemoveBlockingContributor(us-central1)...
i  functions: updating Node.js 16 function checkIfObjectExist(us-central1)...
i  functions: updating Node.js 16 function checkParticipantForCeremony(us-central1)...
i  functions: updating Node.js 16 function completeMultiPartUpload(us-central1)...
i  functions: updating Node.js 16 function coordinateCeremonyParticipant(us-central1)...
i  functions: updating Node.js 16 function createBucket(us-central1)...
i  functions: updating Node.js 16 function finalizeCeremony(us-central1)...
i  functions: updating Node.js 16 function finalizeCircuit(us-central1)...
i  functions: updating Node.js 16 function generateGetObjectPreSignedUrl(us-central1)...
i  functions: updating Node.js 16 function generatePreSignedUrlsParts(us-central1)...
i  functions: updating Node.js 16 function initEmptyWaitingQueueForCircuit(us-central1)...
i  functions: updating Node.js 16 function permanentlyStoreCurrentContributionTimeAndHash(us-central1)...
i  functions: updating Node.js 16 function processSignUpWithCustomClaims(us-central1)...
i  functions: updating Node.js 16 function progressToNextCircuitForContribution(us-central1)...
i  functions: updating Node.js 16 function progressToNextContributionStep(us-central1)...
i  functions: updating Node.js 16 function refreshParticipantAfterContributionVerification(us-central1)...
i  functions: updating Node.js 16 function registerAuthUser(us-central1)...
i  functions: updating Node.js 16 function resumeContributionAfterTimeoutExpiration(us-central1)...
i  functions: updating Node.js 16 function setupCeremony(us-central1)...
i  functions: updating Node.js 16 function startCeremony(us-central1)...
i  functions: updating Node.js 16 function startMultiPartUpload(us-central1)...
i  functions: updating Node.js 16 function stopCeremony(us-central1)...
i  functions: updating Node.js 16 function temporaryStoreCurrentContributionMultiPartUploadId(us-central1)...
i  functions: updating Node.js 16 function temporaryStoreCurrentContributionUploadedChunkData(us-central1)...
✔  functions[verifycontribution(us-central1)] Skipped (No changes detected)
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.

Functions deploy had errors with the following functions:
        checkAndPrepareCoordinatorForFinalization(us-central1)
        checkAndRemoveBlockingContributor(us-central1)
        checkIfObjectExist(us-central1)
        checkParticipantForCeremony(us-central1)
        completeMultiPartUpload(us-central1)
        coordinateCeremonyParticipant(us-central1)
        createBucket(us-central1)
        finalizeCeremony(us-central1)
        finalizeCircuit(us-central1)
        generateGetObjectPreSignedUrl(us-central1)
        generatePreSignedUrlsParts(us-central1)
        initEmptyWaitingQueueForCircuit(us-central1)
        permanentlyStoreCurrentContributionTimeAndHash(us-central1)
        processSignUpWithCustomClaims(us-central1)
        progressToNextCircuitForContribution(us-central1)
        progressToNextContributionStep(us-central1)
        refreshParticipantAfterContributionVerification(us-central1)
        registerAuthUser(us-central1)
        resumeContributionAfterTimeoutExpiration(us-central1)
        setupCeremony(us-central1)
        startCeremony(us-central1)
        startMultiPartUpload(us-central1)
        stopCeremony(us-central1)
        temporaryStoreCurrentContributionMultiPartUploadId(us-central1)
        temporaryStoreCurrentContributionUploadedChunkData(us-central1)
i  functions: cleaning up build files...
Error: There was an error deploying functions:
- Error Failed to update function resumeContributionAfterTimeoutExpiration in region us-central1
- Error Failed to update function permanentlyStoreCurrentContributionTimeAndHash in region us-central1
- Error Failed to update function generateGetObjectPreSignedUrl in region us-central1
- Error Failed to update function progressToNextContributionStep in region us-central1
- Error Failed to update function progressToNextCircuitForContribution in region us-central1
- Error Failed to update function temporaryStoreCurrentContributionMultiPartUploadId in region us-central1
- Error Failed to update function generatePreSignedUrlsParts in region us-central1
- Error Failed to update function checkIfObjectExist in region us-central1
- Error Failed to update function createBucket in region us-central1
- Error Failed to update function checkAndRemoveBlockingContributor in region us-central1
- Error Failed to update function checkAndPrepareCoordinatorForFinalization in region us-central1
- Error Failed to update function processSignUpWithCustomClaims in region us-central1
- Error Failed to update function stopCeremony in region us-central1
- Error Failed to update function refreshParticipantAfterContributionVerification in region us-central1
- Error Failed to update function initEmptyWaitingQueueForCircuit in region us-central1
- Error Failed to update function coordinateCeremonyParticipant in region us-central1
- Error Failed to update function temporaryStoreCurrentContributionUploadedChunkData in region us-central1
- Error Failed to update function startCeremony in region us-central1
- Error Failed to update function finalizeCeremony in region us-central1
- Error Failed to update function startMultiPartUpload in region us-central1
- Error Failed to update function completeMultiPartUpload in region us-central1
- Error Failed to update function finalizeCircuit in region us-central1
- Error Failed to update function checkParticipantForCeremony in region us-central1
- Error Failed to update function setupCeremony in region us-central1
- Error Failed to update function registerAuthUser in region us-central1
0xjei commented 1 year ago

@ctrlc03 @gurrpi I can handle this quickly. I will add a review after verifying the solution locally.

baumstern commented 1 year ago

yarn test:dev passed locally. Please ignore the false failure of CI for now.

Test Suites: 15 passed, 15 total
Tests:       4 skipped, 150 passed, 154 total
Snapshots:   0 total
Time:        254.885 s