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

feat(deployer): add service in maci repo #2138

Draft
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

NicoSerranoP
Copy link
Member

Description

We are moving the coordinator service (built in NestJS) to the MACI protocol repository. This service allows users to deploy MACI and polls using a easy-to-use REST API service.

Pending

  • Finish e2e tests to deploy MACI
  • Finish e2e test to deploy a poll in a MACI instance

Related issue(s)

Confirmation

Important

We do not accept minor grammatical fixes (e.g., correcting typos, rewording sentences) unless they significantly improve clarity in technical documentation. These contributions, while appreciated, are not a priority for merging. If there is a grammatical error feel free to message the team.

Copy link

vercel bot commented Feb 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
maci-website ✅ Ready (Inspect) Visit Preview Feb 20, 2025 8:10am

Copy link
Collaborator

@ctrlc03 ctrlc03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I left some comments to address

"download-zkeys:latest": "pnpm run run:node ./scripts/downloadZKeys.ts latest ./zkeys",
"download-zkeys:test": "pnpm run run:node ./scripts/downloadZKeys.ts test ./zkeys",
"download-zkeys:prod": "pnpm run run:node ./scripts/downloadZKeys.ts prod ./zkeys",
"upload-round-metadata": "pnpm run run:node ./scripts/uploadRoundMetadata.ts",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remove upload-round-metadata (was for maci platform only)

@@ -0,0 +1,9 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@@ -0,0 +1,166 @@
import { put } from "@vercel/blob";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove


expect(response.status).toBe(201);
// TODO: check MACI address is valid
// TODO: should we check that subgraph is working?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subgraph is optional, let's focus deploy tests on contract deployment only

gatekeeper: {
type: EGatekeepers.FreeForAll,
},
initialVoiceCreditsProxy: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

voice credit proxy not needed at the maci level but poll level only

config.pollDuration,
{
intStateTreeDepth: config.intStateTreeDepth,
messageTreeSubDepth: config.messageTreeSubDepth,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in maci v3 there is no messageTreeSubDepth nor messageTreeDepth - it's messageBatchSize only

/**
* Determines the message batch size
*/
messageTreeSubDepth: number;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove messageTreeSubDepth and messageTreeDepth - it's only messageBatchSize

await prover.submitResults(tallyData, Number.parseInt(recipientCount.toString(), 10));
*/
// submit results
await prover.submitResults(tallyData, Number.parseInt(numSignUps.toString(), 10));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would not work cause num signups can be way more than vote options. use this variable https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/Poll.sol#L179

@@ -0,0 +1,9 @@
# Session Keys module

This module is responsible for session keys management. These keys (private are stored in the service, public are sent to the client) are used to generate the ZeroDev KernelClient. This way we are not storing any master keypair in the server that could be stolen. The point of these sessions keys were that they would be short-lived (~2min). All its endpoints are protected by the `AccountSignatureGuard` middleware, which checks the signature of the request against the `COORDINATOR_ADDRESSES` environment variable.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking that eventually we could even remove the account signature guard from certain endpoints like deployment as with the session key flow we use the initiator account not the coordinator one (we'd need to properly manage local storage of deployed addresses though as calls by others could cause deletion of the json file) but for now this works

* Chain Name
*/
@ApiProperty({
description: "Chain to which to deploy the contract(s)",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guess this comment is not accurate? it's DeactivateSessionKeyDto so maybe should be related to deactivation?

@@ -0,0 +1,73 @@
# Rate limit configuation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's put coordinator in apps/ not packages/

# RPC API KEY for Alchemy
RPC_API_KEY=""

# A private key for e2e tests (in formate 0x${private_key})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants