Giter VIP home page Giter VIP logo

concordium-governance-committee-voting's Introduction

concordium-governance-committee-voting

This repository contains the different components for runnning a Concordium governance committtee election. The source code is rust and typescript.

Dependencies

The dependencies needed on the host machine to build and run the different components included in the repository are:

  • Rust (version specified in ./.github/workflows/check-crates.yaml)
  • NodeJS (version specified in ./.github/workflows/check-apps.yml)
  • Yarn

concordium-governance-committee-voting's People

Contributors

abizjak avatar eb-concordium avatar emilkwarmdahl avatar mh-concordium avatar soerenbf avatar tschudid avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

concordium-governance-committee-voting's Issues

Finalizing result is possible only if all of the guardians have registered their proofs to decrypt the tally

Bug Description
Combining shares fails in case not all the guardians have registered their proofs. This happens always, even if the threshold is lowered than max number of guardians.

Steps to Reproduce

  1. Setup election with 5 guardians ("n": 5) with threshold value 3 ("k": 3).
  2. set up all the guardians.
  3. Submit one vote.
  4. After election end date and time has reached, generate decryption shares for all 5 guardians.
  5. Generate proofs to decrypt the tally for the first 3 guardians.
  6. Run the coordinator tool final-result

Expected Result
Show better error message that would explain what happened top the user. Maybe something like
It is not possible to combine proofs, some of the guardians have not generated proofs required to finalize the result.

Actual Result

Error: Failed to combine proof shares: The commit message (a_i != a_i') of guardian 1 is inconsistent!

Caused by:
    The commit message (a_i != a_i') of guardian 1 is inconsistent!

Versions

  • Software Version: coordinator-tool 0.1.0
  • OS: Windows

Implement election smart contract (setup phase)

Task description
A continuation of #8.

We will use the smart contract as a way for guardians to communicate. The authentication is via their account address. The contract will have a way for a guardian to register a complaint. Once that is done the setup process terminates and a manual resolution of the problem will be attempted. Once that is resolved a new instance will be created and a new setup will start from scratch.

Sub-tasks

  • Receive guardian key registration
  • Receive guardian keys verification
    • Guardians sign that the set of keys registered is indeed the set of keys agreed on

Add deadline for registration of decryption shares by guardians

Task description
As we cannot be certain all guardians will partake in the decryption of the election result, any set of guardians above the threshold specified in the election guard parameters can be used to complete this phase. As such, we need to introduce a deadline for registering decryption shares to be able to reliably drive the election forward:

Guardians can respond to decryption share challenges when either:

  • All guardians have registered decryption shares
  • The deadline for registering decryption shares has passed

Sub-tasks

  • Add decryption registration deadline to election configuration
  • Use deadline in guardian application to move forward with subset of guardians
  • Introduce guards against registering decryption shares/response share proofs based on deadline

Disable confirm button after it was pressed

Bug Description
After selecting Submit button, button turns into the spinning wheel and keeps spinning until Browser Wallet pops up. Afterwards, it is possible to select Submit again.

Similar issue appears using mobile wallets. Is it possible to know (get the information back) from wallet connect when the page for signing was actually opened. If yes, Ideally, spinning wheel would be working until the page for signing would open.

Steps to Reproduce
Submit a vote.

Expected Result
Spinning wheel works until a wallet pops up then it is disabled.

Actual Result
Spinning wheel works until a wallet pops up then it is possible to press Confirm again.

Versions

  • Software Version: 0.1.0

Document required version of rust to build the coordinator tool

Task description
After trying to build on Windows with older version of Rust I got an error. It would be nice to document which version of Rust is required to build the tool.

cargo build --release
error: package `clap_lex v0.7.0` cannot be built because it requires rustc 1.74 or newer, while the currently active rustc version is 1.71.1
Either upgrade to rustc 1.74 or newer, or use
cargo update -p [email protected] --precise ver
where `ver` is the latest version of `clap_lex` supporting rustc 1.71.1

[guardian app] Unique bundle ID per distribution

Task description
To ensure that user configuration and data storage for different contracts and networks do not override each other, the bundle ID of the final distribution needs to be unique for each network/contract combination.

It's possible to merge configurations using yarn tauri build --config. An idea could be to make a script to build the following:

{
  "tauri": {
    "bundle": {"identifier": "com.concordium.guardian.<net>.<index>.<subindex>"}
  }
}

and then merge it with the global config.

Guardian App - Show error message if the app can't connect to the node

Bug Description
If the app was built with wrong build configuration, application will start but will not be able to connect to the node without any explanation.

Steps to Reproduce

  1. Build app with CCD_ELECTION_NODE="https://node.testnet.concordium.com:20000"
  2. Start the app.

Expected Result
Error message explaining the error since the app can't connect to the node.

Actual Result
Nothing happens except indicator is red.

Versions

  • Software Version: 0.0.0

Setup repository workspace

Task description
Set up repository with workspace for applications needed to facilitate governance committee elections.

Sub-tasks

  • Add yarn workspace for frontend apps
  • Configure eslint + prettier + tsconfig base
  • Setup CI

[Election contract] change schema type of byte registrations to hex strings

Description
To improve the experience when submitting ballots through the voting app (and also view contract state for debugging), it would be useful to represent byte arrays registered in the contract as hex strings.

  • Ballot submissions
  • Guardian public key registration
  • Guardian encrypted shares registration
  • Guardian decryption share registration
  • Guardian decryption proof registration

Voting dApp - if the election ended, user can still try to cast a vote and nothing happens

Bug Description
Past the election, even though the end time is written on the top, user can try to submit a vote and will not get any errors.

Steps to Reproduce
Try to cast a vote after the election.

Expected Result
Error message, "Window for casting votes has ended."

Actual Result
Nothing happens. Wallet doesn't pop up.

Versions

  • Software Version
  • OS
  • Browser
  • Mobile device, if applicable

[guardian app] Implement guardian setup phase actions

As a guardian, I would like to be able to generate the key pair and decryption share for elections in their setup phase. If the parts received from other guardians are invalid, a corresponding complaint should be filed to the contract.

Sub-tasks

  • Enable setup actions only in the setup phase of the election
  • Generate private key, publish public key
  • Validate guardian keys + generate decryption share, publish encrypted share
  • Validate encrypted shares of other guardians, file complaint/signal OK

Script for generating the initial weights

Task description

The weights for each account for voting are the average CCD in the account over a certain time period (e.g., 3 months). We need a script that will generate the list of accounts and weights given a beginning and end date.

Document that we need to run the database and how simplest to do it

Bug Description
It is not straight forward from the documentation that it is expected form the coordinator to setup and run the database.
It would be good to document that.

Steps to Reproduce
Look at the documentation.

Expected Result
Section about setting up the db.

Actual Result
It is only visible from the http/indexer arguments that db is needed.

Setup voting application

Task description
This task pertains to scaffolding the voting application with wallet connections.

Sub-tasks

  • Create application
  • Setup wallet connection management

Guardian application UI - Generate & register guardian key dialogue

Description
I think this looks a bit strange. There is like a spinning wheel and the text next to it "Awaiting transaction approval".
So this spinning (loading) wheel usually means to me that system is working on something and I should wait. Here in this situation, the system is waiting on me to "Send key registration".

I also think we should align terminology in a sense if we wrote that we are "waiting for transaction approval" then on the button it should say "approve transaction". Or we could just remove the spinning wheel and write "Register key" instead of "waiting for transaction approval"

Steps to Reproduce
Register a guardian key.

Expected Result
One of the recommendations written above.

Actual Result
image

Versions

  • Software Version:0.0.0
  • OS: Windows

Typo in Guardian App GUI text

Description
Please see attached image. "encryption shares" should be changed to "encrypted shares"

image

Steps to Reproduce

Expected Result

Actual Result

Versions

  • Software Version
  • OS
  • Browser
  • Mobile device, if applicable

List of ballot submissions is not easy to find

Bug Description
It is not clear that it is needed to click on address to see the list of the ballot submissions.

Steps to Reproduce
Click on the address once wallet is connected.

Expected Result
I don't know how to solve this best but maybe another button that would point to the list of ballot submissions.

Actual Result
User needs to click on the address to see the list of ballot submissions.

[coordinator tool] Encrypted ballots are not scaled as expected when voting for multiple candidates

Bug Description
If a voter with X weight votes for 3 candidates in an election, it seems that each candidate result is scaled with X instead of X/3.

Steps to Reproduce

  • Set up an election
  • In the voting phase of an election, submit a vote for multiple candidates from an eligible account
  • Tally + decrypt (joint effort by coordinator + guardians

Expected Result
The result produced for each candidate is scaled by the voting power of the voter divided with the number of candidates selected in the ballot

Actual Result
The result produced for each candidate is scaled by the voting power of the voter

Enable querying delegation registrations for accounts

Task description
As a user, I would like to be able to see if my voting power delegation has been successfully registered. As delegation is done by submitting a transfer with a memo that needs to match a specific string according to the election configuration, merely checking the transaction status from a wallet will not be enough for the user.

Sub-tasks

  • Add delegation registrations to the database
  • Expose an endpoint for querying delegations related to an account
  • Add page in the voting dApp for querying delegations + final weight for an account

Guardian app - network and contract indicators are not green while there seems to be connection to both

Bug Description
Tested on Windows.

It seems that the indicators are not working correctly. Importing account key that is not registered as Guardian throws error Imported account is not a guardian in the election, however indicators for network and the contract are grey.

Steps to Reproduce

  1. Build app and run it on Windows with config parameters:
CCD_ELECTION_CONTRACT_ADDRESS="<8011,0>"
CCD_ELECTION_NETWORK="testnet"
CCD_ELECTION_NODE="https://grpc.testnet.concordium.com:20000"
  1. Import key that is not registered as Guardian.

Expected Result
Error shows up that account is not a guardian and indicators for connection to Testnet and to the contract are green.

Actual Result

Given that I get the error message makes me think app has actually checked if my account is in the contract and I actually am connected but the indicators are not showing it.

image

Versions

  • Software Version: 0.1.0
  • OS: Windows

[guardian app] Add election and user configuration

Task description
The election configuration (chain + contract index) should be built into the application. The user credentials are imported by the user on application load.

Sub-tasks

  • Build election configuration into the application
  • Import wallet export into application

Display current delegators in voting dapp

Task description
Display who all are delegating to your account in the sidebar so that it's clear that you are casting a vote on behalf of others who have delegated to you.

Add label for component and priority.

Allow election coordinator to reset the finalization phase

When the set of guardians used to decrypt the election result is agreed on (i.e. all guardians that have registered their decryption shares in the contract, as long as this number is above the threshold defined in the election guard parameters), the decryption can still fail if any of the guardians included in this set are inactive through the remaining part of the finalization phase.

If this happens, we need to be able to restart the finalization phase, which requires guardians to be able to recompute and re-register their decryptions, after which a new set of guardians to complete the decryption is selected.

The proposed solution to this would be to allow the election coordinator (registered in the election contract as the "admin" account) to be able to invoke an endpoint which would reset the necessary state for each guardian and set a new deadline for registering new decryption shares.

Sub tasks

  • Add entrypoint to election contract for resetting the finalization phase
  • Add command to coordinator tool for resetting the finalization phase
  • Enable marking guardians as excluded (when validation of decryption proofs fail) by coordinator

[election dApp] Home page should depend on election state

Task description

Home page should vary depending on:

  • if the election is over we'll want to show a different page with just the results (or intermediate states until guardians have completed their work).
  • if the election did not start yet we probably want to display something else (to be clarified).
  • there'll be more election information setting the context, etc (to be clarified).

Write guardian application for voting

Task description
Write a desktop application that allows a guardian to generate keys and to perform its part of the decryption of the tallied result. It should invoke ElectionGuard for both things.

Sub-tasks

  • Key generation
  • Decryption

Coordinator tool - print if `--admin-keys` are not provided

Description
It is possible to run several commands without --admin-keys for verification purposes. However adding --admin-keys allow interaction with contract where it is necessary.

Steps to Reproduce
Run functions:
tally
final-result

Expected Result
Print message in case --admin-keys is not used

Actual Result
No message is printed

Versions

  • Software Version: 0.1.0

The election server should have an endpoint to check weight of account

Task description

The election server currently serves the entire list of voters with their weight. This is problematic since this list must be loaded each time by the frontend, and on mainnet it will be several MB. Sending and parsing this list will be very resource intensive.

Instead the server should serve an endpoint that takes an address and returns the weight.

The server should also expect a list as a CSV file, not JSON.

Setup election server

This task pertains to setting up the election server. The server will be written in rust. It depends on the implementation of the election guard rust library, but parts of it can be written without:

  • Setup server configuration
  • Setup database structure
  • Serve eligible voters JSON file
  • Collect and store ballot submissions + accounts by monitoring chain
  • Expose endpoint to query status of ballot submissions

Coordinator tool - final phase - showing the final result in a better way

Bug Description
Add better presentation of the final results in the end.

Steps to Reproduce
Running the final-result command, result is printed to the command line.

Expected Result
Present the data in a nicer way. I don't know if it is possible to actually read candidate urls from the contract or somehow else relate nominees to the values shown.

Actual Result

PS C:\test\voting> .\election-coordinator.exe final-result --contract "<8216,0>" --node "https://grpc.testnet.concordium.com:20000"
[]
[]
[44352837]

Versions

  • Software Version: 0.1.0

[guardian app] Implement finalization phase steps

As a guardian in a Concordium GC election, I need to be able to perform decryption of my share of the election tally.

Sub tasks

  • Decrypt + register share of tally
  • Generate decryption proof response share

Implement election smart contract (naive election phase)

The smart contract should contain the following information:

  • Description of the election, e.g., election to the Concordium GC, June 2024.
  • Address of the server that has all the data.
  • An ordered list of candidates that will uniquely match the candidate to the corresponding vote, since a ballot contains a vote per candidate.
  • A hash of the list of accounts and weights. Which accounts can vote and how the weights are computed is still open. One option is to take the average CCD for every account in the 3 months prior to the election. The corresponding weights should be published on the server. The hash is put in the SC so that the data cannot be manipulated.
  • The account addresses of the guardians.
  • The opening and closing days and times of the voting.

This task only pertains to a naive implementation of vote collection and election result. A complete implementation depends on the implementation of #10.

Subtasks

  • Init
  • View contract config
    • candidates
    • start/end time
    • description
    • contract admin
    • guardian accounts
    • eligible voters (url + checksum)
  • Receive vote
  • Receive election result

Improve error message for mismatched hashes/checksums

Description
If one tries to start indexer while the file hashes are not matching, error message only states that there is a mismatch but doesn't inform which files were compared.

Steps to Reproduce
Attempt to start indexer with config files that computed hashes do not match with ones in the contract that was deployed.

Expected Result
Inform about the mismatch in hashes but also explain which file.

Actual Result
Error: Hash of file did not match checksum

Versions

  • Software Version: 0.1.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.