Skip to content
Permalink
Browse files

Fixed comments

  • Loading branch information...
gertjaap committed Mar 8, 2019
1 parent b507b83 commit ce1193908e9d80f51648bb4766451c0905df5d05
Showing with 9 additions and 5 deletions.
  1. +2 −0 audit.go
  2. +2 −3 bank.go
  3. +1 −0 bank_test.go
  4. +2 −0 cmd/apl-auditor/auditor.go
  5. +2 −2 transaction.go
@@ -185,6 +185,7 @@ func (a *Auditor) computeSum(bank_i int) (*big.Int, bool) {
a.mu.Unlock()
gv := ZKLedgerCurve.Neg(ZKLedgerCurve.Mult(ZKLedgerCurve.G, rep.Sum)) // 1 / g^\sum{v_i}
T := ZKLedgerCurve.Add(comms, gv)
// TODO: Error handling
verifies, _ := rep.Eproof.Verify(ZKLedgerCurve, T, rtokens, ZKLedgerCurve.H, a.pki.Get(bank_i))
if !verifies {
Dprintf("[A] Bank %v proof didn't verify! Their total: %v\n", bank_i, rep.Sum)
@@ -219,6 +220,7 @@ func (a *Auditor) sumOneBank(wg *sync.WaitGroup, bank_i int, totals []*big.Int,
}
gv := ZKLedgerCurve.Neg(ZKLedgerCurve.Mult(ZKLedgerCurve.G, rep.Sum)) // 1 / g^\sum{v_i}
T := ZKLedgerCurve.Add(comms, gv)
// TODO: Error handling
verifies, _ := rep.Eproof.Verify(ZKLedgerCurve, T, rtokens, ZKLedgerCurve.H, a.pki.Get(bank_i))
if !verifies {
Dprintf("[A] Bank %v proof didn't verify! Their total: %v\n", bank_i, rep.Sum)
@@ -109,8 +109,8 @@ func MakeBank(id int, num int, l LedgerClient, pki *PKI) *Bank {
close(c)

for i := 0; i < num; i++ {
b.CommsCache[i] = zksigma.ECPoint{big.NewInt(0), big.NewInt(0)}
b.RTokenCache[i] = zksigma.ECPoint{big.NewInt(0), big.NewInt(0)}
b.CommsCache[i] = zksigma.Zero
b.RTokenCache[i] = zksigma.Zero
}
go b.start()
return b
@@ -392,7 +392,6 @@ func generateRangeProofs(num int, etx *EncryptedTransaction, bank_j int, id int,
etx.Entries[i].RP, etx.Entries[i].BAuxR, _ = zksigma.NewRangeProof(ZKLedgerCurve, value)
} else {
// TODO: Error handling

etx.Entries[i].RP, etx.Entries[i].BAuxR, _ = zksigma.NewRangeProof(ZKLedgerCurve, big.NewInt(0))
}
}
@@ -398,6 +398,7 @@ func benchmarkCreateLocalTxn(bnum int, b *testing.B) {

func BenchmarkUpdateCommCache(b *testing.B) {
value := new(big.Int).SetInt64(50)
// TODO: Error handling
comm, _, _ := zksigma.PedCommit(ZKLedgerCurve, value)
b.ResetTimer()
for n := 0; n < b.N; n++ {
@@ -141,6 +141,7 @@ func main() {
if *testName == "h" {
for i := 0; i < 20; i++ {
start = time.Now()
// TODO: Error handling
x, _ := auditor.Herfindahl(true, nil)
times[i] = time.Since(start)
total += times[i]
@@ -183,6 +184,7 @@ func main() {
total = 0
for i := 0; i < 20; i++ {
start = time.Now()
// TODO: Error handling
x, _ := auditor.Herfindahl(false, nil)
times[i] = time.Since(start)
total += times[i]
@@ -131,16 +131,15 @@ func (e *EncryptedTransaction) Verify(pks []zksigma.ECPoint, CommCache []zksigma
// Issuance
if e.Type == Issuance {
en := &e.Entries[e.Sender]
e.print_decrypted()
if en.V.Cmp(big.NewInt(0)) <= 0 {
Dprintf(" [%v] ETX %v Failed verify; issuance transaction values must be positive\n",
debug, e.Index)
return false
}
// Check proof of knowledge of sk_{asset issuer}
// TODO: Error handling
ok := false
if en.SKProof != nil {
// TODO: Error handling
ok, _ = en.SKProof.Verify(ZKLedgerCurve, pks[len(pks)-1])
}
if !ok {
@@ -158,6 +157,7 @@ func (e *EncryptedTransaction) Verify(pks []zksigma.ECPoint, CommCache []zksigma
return false
}
// Check proof of knowledge of sk_{bank}
// TODO: Error handling
ok, _ := en.SKProof.Verify(ZKLedgerCurve, pks[e.Sender])
if !ok {
Dprintf(" [%v] ETX %v Failed withdrawal: proof of knowledge of SK\n", debug, e.Index)

0 comments on commit ce11939

Please sign in to comment.
You can’t perform that action at this time.