Closed andreslucena closed 8 months ago
This is the issue with a high grade of difficult after our meeting. Some pointers that the Vocdoni team shared with us:
Andres I assign this issue to you as you said that is in your roof. Let us know if you need anything! @microstudi
Adding some notes from our last meeting regarding the implementation
We discarded the blind CSP option as we think it maybe overkill at the moment. Another reason to prefer the dynamicCensus
approach is that we can provide more transparency to the whole process, as anyone can check the changes made in the Census in real time.
In the SDK this will use the
dynamicCensus: true, // if the census can be changed
From the electionType
configuration. This means that in the Decidim side we need a callback so that each time a new user verifies agains the Decidim application it gets sent to the Vocdoni API.
This callback would be using ActiveSupport::Notifications or whatever Rails API that we see better. Probably for the batch process we need to use ActiveJob and a rake task with some documentation on how to configure (via Cron as explained in the Decidim official docs).
For performance reasons and to not make too many requests to the Vocdoni API in cases where potentially dozens of participants are verifying at the same time, we will queue all the requests and send them on a batch every minute. That means that a participant needs to wait for a maximum of 70 seconds (1 minute + 10 seconds for the Vochain to confirm the operation). We need to show a spinner telling the participant that we're adding them to the census in this period of time.
Some snippets of code regarding the implementation at the SDK level:
const numVotes = 10;
const service = new CensusService({ url: URL, chunk_size: CENSUS_CHUNK_SIZE });
const participants: Wallet[] = [...new Array(numVotes)].map(() => Wallet.createRandom());
const census = await service.create(CensusType.WEIGHTED);
await service.add(
census.id,
participants.map((p) => ({ key: p.address, weight: BigInt(1) }))
);
await service.publish(census.id);
With this in the census
object you would have something similar to { id: string; auth: string }
. The census.id
is the census identifier (as usual) and the census.auth
is a token that proves that you're the census owner (so you can modify it). We need to save that auth string in our database.
Now, later, when we want to modify the census, we need to do:
const service = new CensusService({ url: URL, chunk_size: CENSUS_CHUNK_SIZE, auth: { identifier: census.auth } });
await service.add(census.id, [{ key: Wallet.createRandom().address, weight: BigInt(1) }]);
const info = await service.publish(census.id);
Now that we've used the id
and auth
from the census generated before and we've added a new person, when publishing it, we have the following information in the info
object: { censusID: string; uri: string }
Finally, you need to change the election in the census:
await client.changeElectionCensus(electionId, info.censusID, info.uri);
We detected one bug @antopalidi.
If I am added later with the census update, I receive a message that I cannot vote, as I have already voted.
This is not correct, as this is the first time I have accessed this screen.
To reproduce:
1- Create a vocdoni election
2- Census by verifier (in this case, organisation census)
3- The user is not verified before making the election.
4- Voting starts, the user is verified.
5- Update the census dynamically (manually)
6- You get this error
Also @carolromero will make some mock up for texts
@antopalidi I just went through the whole voting flow with the internal census system, and you've done a great job!! :tada:
Here are some suggestions to improve some of the flow steps:
External census
Internal census
Scenario 1: Election without additional authorization required:
Scenario 2: Election with additional authorization required. The participant has not validated the authorization:
- [ ] Once the participant validates the authorization, can we redirect her to vote? Or is this a general bug of the authorizations I should report?
Scenario 3: Election with additional authorization required. The participant has validated the authorization:
Scenario 4: Election with additional authorization required. The participant has validated the authorization but the census is not updated:
[x] Again, here we remind the admin what type of census and authorizations they have selected. And for the time being, until we better narrow down the cost of this transaction I would leave the sentence about credits. In short, it would look like this:
[x] Clicking on "Update census now" is a bit confusing because the success message appears immediately, but the operation is not yet complete. Could we display the success message once the census has actually been updated?
Clicked on "update census now"
After a while
I think with this we should have this feature ready! Please let me know if you have any questions 😊.
@antopalidi I almost forgot! Regarding the scenario of using an authorization without records at the time of setting up the election (when technical voter record should be created), I have not been able to reproduce it. Selecting for example the organization's census and making sure it is empty, it tells me that there are 6 records when setting up the election:
And, even ignoring this, when I get to setup the election I get an error :thinking::
Ref: VOC-SEC-02
Currently, for setting up the module, and administrator need to upload a CSV file with an email and a token as a census.
On Decidim there's already an API for allowing the participants to make some actions inside this particular component, the Authorizations API. As the documentation says:
There are several use cases for this, such as
As an example of a real world kind of voting where this was used, we can find processes like the Voting for the Sindicatura de Greuges de Barcelona 2021-2026 in Barcelona. It was used with the Municipal Census verification API, an external SOAP service that checks if someone resides in the city of Barcelona.
There should be two options for the "Census type":
Mockups
CSV file
Verifications systems
Acceptance criteria