Skip to content

Commit

Permalink
e2etest: update generateProofs
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajdab authored and altergui committed Apr 17, 2023
1 parent 564d1e2 commit 6a0af57
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cmd/end2endtest/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (t electionBase) createElection(electionDescrip *vapi.ElectionDescription)
return election, nil
}

func (t electionBase) generateProofs(root types.HexBytes) map[string]*apiclient.CensusProof {
func (t electionBase) generateProofs(root types.HexBytes, isAnonymousVoting bool) map[string]*apiclient.CensusProof {
type voterProof struct {
proof *apiclient.CensusProof
address string
Expand All @@ -186,11 +186,18 @@ func (t electionBase) generateProofs(root types.HexBytes) map[string]*apiclient.
defer wg.Done()
log.Infof("generating %d voting proofs", len(accounts))
for _, acc := range accounts {
pr, err := t.api.CensusGenProof(root, acc.Address().Bytes())
voterKey := acc.Address().Bytes()
if isAnonymousVoting {
voterKey = t.api.MyZkAddress().Bytes()
}
pr, err := t.api.CensusGenProof(root, voterKey)
if err != nil {
log.Fatal(err)
}
pr.KeyType = models.ProofArbo_ADDRESS

if !isAnonymousVoting {
pr.KeyType = models.ProofArbo_ADDRESS
}
proofCh <- &voterProof{
proof: pr,
address: acc.Address().Hex(),
Expand Down Expand Up @@ -235,6 +242,7 @@ func getCensusParticipantKey(voterAccount *ethereum.SignKeys, censusType string)
case vapi.CensusTypeWeighted:
key = voterAccount.Address().Bytes()
case vapi.CensusTypeZKWeighted:
fmt.Println("salito")
zkAddr, err := zk.AddressFromSignKeys(voterAccount)
if err != nil {
return nil, err
Expand Down

0 comments on commit 6a0af57

Please sign in to comment.