From 6a0af578fc166aec86cc2f817e2ffffe56466335 Mon Sep 17 00:00:00 2001 From: maria jose Date: Fri, 14 Apr 2023 23:47:38 -0400 Subject: [PATCH] e2etest: update generateProofs --- cmd/end2endtest/helpers.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmd/end2endtest/helpers.go b/cmd/end2endtest/helpers.go index 3896ee10a..079195b42 100644 --- a/cmd/end2endtest/helpers.go +++ b/cmd/end2endtest/helpers.go @@ -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 @@ -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(), @@ -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