M election/msg.go => election/msg.go +4 -8
@@ 444,7 444,6 @@ func (elections *ElectionsMap) onKeysMessage(evt *event.Event, client *mautrix.C
errorf("couldn't download eval proving key: %s", err)
return
}
- tryEvalPk:
var buf bytes.Buffer
_, err = buf.Write(byts)
if err != nil {
@@ 454,9 453,8 @@ func (elections *ElectionsMap) onKeysMessage(evt *event.Event, client *mautrix.C
evalProvingKey = groth16.NewProvingKey(ecc.BLS12_381)
_, err = evalProvingKey.ReadFrom(&buf)
if err != nil {
- log.Errorf("couldn't read eval key from downloaded eval proving keys file: %s", err)
- log.Debug("trying again...")
- goto tryEvalPk
+ errorf("couldn't read eval key from downloaded eval proving keys file: %s", err)
+ return
}
}
@@ 467,7 465,6 @@ func (elections *ElectionsMap) onKeysMessage(evt *event.Event, client *mautrix.C
errorf("couldn't download sum proving key: %s", err)
return
}
- trySumPk:
var buf bytes.Buffer
_, err = buf.Write(byts)
if err != nil {
@@ 477,9 474,8 @@ func (elections *ElectionsMap) onKeysMessage(evt *event.Event, client *mautrix.C
sumProvingKey = groth16.NewProvingKey(ecc.BLS12_381)
_, err = sumProvingKey.ReadFrom(&buf)
if err != nil {
- log.Errorf("couldn't read sum key from downloaded sum keys file: %s", err)
- log.Debug("trying again...")
- goto trySumPk
+ errorf("couldn't read sum key from downloaded sum keys file: %s", err)
+ return
}
}
M election/voter.go => election/voter.go +2 -13
@@ 188,18 188,7 @@ func (el *Election) SendProvingKeys(client *mautrix.Client, eventStore *EventSto
}
var evalPkBytes bytes.Buffer
- // TODO: change back to WriteTo. There seems to be a bug in
- // gnark/gurvy (or a misunderstanding on my part) where
- // decompression fails
- // ignoring ...'s keys msg ($tsSEYHiouPdJlaTqAOG2q_4t9MZa0OGHtJPD95jOvAg) since couldn't read sum key from bytes buffer: invalid compressed coordinate: square root doesn't exist
- // The file was successfully processed on one side (who
- // coincidentally was the sender) but not on the other
- // NOTE: it's plausible this was fixed in gurvy (now gnark-crypto) 0.4.0:
- //
- // point.SetBytes can now be called concurently with same byte slice input
- //
- // https://github.com/ConsenSys/gnark-crypto/releases/tag/v0.4.0
- evalProvingKey.WriteRawTo(&evalPkBytes)
+ evalProvingKey.WriteTo(&evalPkBytes)
uploadResp, err := client.UploadMedia(mautrix.ReqUploadMedia{
Content: &evalPkBytes,
ContentLength: int64(evalPkBytes.Len()),
@@ 241,7 230,7 @@ func (el *Election) SendProvingKeys(client *mautrix.Client, eventStore *EventSto
var sumPkBytes bytes.Buffer
// TODO: see above
- sumProvingKey.WriteRawTo(&sumPkBytes)
+ sumProvingKey.WriteTo(&sumPkBytes)
uploadResp, err := client.UploadMedia(mautrix.ReqUploadMedia{
Content: &sumPkBytes,
ContentLength: int64(sumPkBytes.Len()),