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

feature: vote endpoint #12

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

feature: vote endpoint #12

wants to merge 4 commits into from

Conversation

lucasmenendez
Copy link
Contributor

  • Common structs refactored
  • Initial endpoint to include a vote in a sequencer
  • Tests endpoints to replace smart contract functionality

@lucasmenendez lucasmenendez added the enhancement New feature or request label Jan 7, 2025
@lucasmenendez lucasmenendez requested a review from p4u January 7, 2025 12:48
@lucasmenendez lucasmenendez self-assigned this Jan 7, 2025
Copy link
Member

@p4u p4u left a comment

Choose a reason for hiding this comment

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

LGTM. Minor comments, please address them.
Also please run gofumpt -w .

ProcessesEndpoint = "/processes"
// ProcessEndpoint is the endpoint to get the process info
ProcessURLParam = "processId"
ProcessEndpoint = "/processes/{" + ProcessURLParam + "}"
Copy link
Member

Choose a reason for hiding this comment

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

I'd hardcode the full URL, I think it is OK and more readable.

Consider making all these constants private.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it because in this way we can reference the param to get the data in its place ensuring that if it changes, the new value is propagated in every place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we make them private, then they will not be accessible by other packages like api/client...

api/test.go Show resolved Hide resolved
api/test.go Show resolved Hide resolved
api/test.go Show resolved Hide resolved
api/test.go Show resolved Hide resolved
ProcessID types.HexBytes `json:"processId"`
Commitment types.HexBytes `json:"commitment"`
Nullifier types.HexBytes `json:"nullifier"`
Cipherfields elgamal.Ciphertexts `json:"cipherfields"`
Copy link
Member

Choose a reason for hiding this comment

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

It should be a pointer to the struct

Nullifier types.HexBytes `json:"nullifier"`
Cipherfields elgamal.Ciphertexts `json:"cipherfields"`
CensusProof types.CensusProof `json:"censusProof"`
BallotProof parser.CircomProof `json:"ballotProof"`
Copy link
Member

Choose a reason for hiding this comment

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

Same

CensusProof types.CensusProof `json:"censusProof"`
BallotProof parser.CircomProof `json:"ballotProof"`
BallotInputsHash types.HexBytes `json:"ballotInputsHash"`
PublicKey types.HexBytes `json:"publicKey"`
Copy link
Member

Choose a reason for hiding this comment

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

I'd not include PublicKey here, the Sequencer must take it from the State instead.

api/vote.go Outdated Show resolved Hide resolved
@lucasmenendez
Copy link
Contributor Author

It is so far to be done that it is not yet ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants