Skip to content

Commit

Permalink
make goose happy
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjit-bhat committed Oct 7, 2024
1 parent 118ac7c commit 9b3098c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
25 changes: 15 additions & 10 deletions kt/auditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,27 @@ type Auditor struct {
histInfo []*AdtrEpochInfo
}

func (a *Auditor) checkOneUpd(nextEpoch uint64, mapLabel, mapVal []byte) bool {
getReply := a.keyMap.Get([]byte(mapLabel))
if getReply.Error || getReply.ProofTy {
return true
}
// as long as we store the entire mapVal, don't think it matters
// if it has more bytes past the MapValPre.
valPre, _, err1 := MapValPreDecode(mapVal)
if err1 || valPre.Epoch != nextEpoch {
return true
}
return false
}

// checkUpd checks that updates are okay to apply, and errors on fail.
func (a *Auditor) checkUpd(upd map[string][]byte) bool {
nextEpoch := uint64(len(a.histInfo))
var err0 bool
for mapLabel, mapVal := range upd {
getReply := a.keyMap.Get([]byte(mapLabel))
if getReply.Error || getReply.ProofTy {
err0 = true
break
}
// as long as we store the entire mapVal, don't think it matters
// if it has more bytes past the MapValPre.
valPre, _, err1 := MapValPreDecode(mapVal)
if err1 || valPre.Epoch != nextEpoch {
if a.checkOneUpd(nextEpoch, []byte(mapLabel), mapVal) {
err0 = true
break
}
}
return err0
Expand Down
4 changes: 1 addition & 3 deletions kt/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func (c *Client) checkHist(uid uint64, dig []byte, membs []*MembHide) bool {
ver := uint64(ver0)
if c.checkMembHide(uid, ver, dig, memb) {
err0 = true
break
}
}
return err0
Expand Down Expand Up @@ -120,7 +119,7 @@ func (c *Client) Put(pk []byte) (uint64, *Evid, bool) {
if c.checkNonMemb(c.uid, c.nextVer+1, dig.Dig, bound) {
return 0, nil, true
}
c.nextVer++
c.nextVer += 1
return dig.Epoch, nil, false
}

Expand Down Expand Up @@ -217,7 +216,6 @@ func (c *Client) Audit(adtrAddr uint64, adtrPk cryptoffi.PublicKey) (*Evid, bool
if err2 {
evid0 = evid1
err1 = true
break
}
}
return evid0, err1
Expand Down
2 changes: 1 addition & 1 deletion kt/serde_misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func MembHideSlice1DDecode(b0 []byte) ([]*MembHide, []byte, bool) {
if err1 {
return nil, nil, true
}
loopO := make([]*MembHide, 0, length)
var loopO = make([]*MembHide, 0, length)
var loopErr bool
var loopB = b1
for i := uint64(0); i < length; i++ {
Expand Down
2 changes: 0 additions & 2 deletions kt/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ func GetTimeSeries(o []*TimeSeriesEntry, epoch uint64) (bool, []byte) {
if e.Epoch <= epoch {
isReg = true
val = e.TSVal
continue
}
break
}
return isReg, val
}
Expand Down

0 comments on commit 9b3098c

Please sign in to comment.