diff --git a/api/apihttp/apihttp_test.go b/api/apihttp/apihttp_test.go index 372057340..00f1162ec 100644 --- a/api/apihttp/apihttp_test.go +++ b/api/apihttp/apihttp_test.go @@ -44,7 +44,7 @@ type fakeRaftBalloon struct { } func (b fakeRaftBalloon) Add(event []byte) (*balloon.Commitment, error) { - return &balloon.Commitment{hashing.Digest{0x00}, hashing.Digest{0x01}, 0}, nil + return &balloon.Commitment{hashing.Digest{0x02}, hashing.Digest{0x00}, hashing.Digest{0x01}, 0}, nil } func (b fakeRaftBalloon) Join(nodeID, addr string) error { diff --git a/balloon/balloon.go b/balloon/balloon.go index a693fdec3..9b8e4b0f3 100644 --- a/balloon/balloon.go +++ b/balloon/balloon.go @@ -209,6 +209,7 @@ func (b *Balloon) Add(event []byte) (*Commitment, []*storage.Mutation, error) { mutations = append(mutations, historyMutations...) commitment := &Commitment{ + EventDigest: eventDigest, HistoryDigest: historyDigest, HyperDigest: hyperDigest, Version: version, diff --git a/balloon/balloon_test.go b/balloon/balloon_test.go index bdf327fce..6aec9531b 100644 --- a/balloon/balloon_test.go +++ b/balloon/balloon_test.go @@ -123,6 +123,7 @@ func TestMembershipProofVerify(t *testing.T) { for i, c := range testCases { event := []byte("Yadda yadda") commitment := &Commitment{ + event, //TODO: should be eventDigest and used in the test hashing.Digest("Some hyperDigest"), hashing.Digest("Some historyDigest"), c.actualVersion, diff --git a/client/client.go b/client/client.go index 784996c54..ba16251d5 100644 --- a/client/client.go +++ b/client/client.go @@ -171,6 +171,7 @@ func (c HttpClient) Verify(result *protocol.MembershipResult, snap *protocol.Sna proof := protocol.ToBalloonProof([]byte(c.apiKey), result, hasherF) return proof.Verify(snap.EventDigest, &balloon.Commitment{ + snap.EventDigest, snap.HistoryDigest, snap.HyperDigest, snap.Version, @@ -183,11 +184,13 @@ func (c HttpClient) VerifyIncremental(result *protocol.IncrementalResponse, star proof := protocol.ToIncrementalProof(result, hasher) startCommitment := &balloon.Commitment{ + startSnapshot.EventDigest, startSnapshot.HistoryDigest, startSnapshot.HyperDigest, startSnapshot.Version, } endCommitment := &balloon.Commitment{ + endSnapshot.EventDigest, endSnapshot.HistoryDigest, endSnapshot.HyperDigest, endSnapshot.Version, diff --git a/cmd/client_add.go b/cmd/client_add.go index 98f6a9749..ef84292d9 100644 --- a/cmd/client_add.go +++ b/cmd/client_add.go @@ -38,8 +38,17 @@ func newAddCommand(ctx *clientContext) *cobra.Command { return err } - log.Infof("Received snapshot with values: \n\tEvent: %s\n\tHyperDigest: %x\n\tHistoryDigest: %x\n\tVersion: %d\n", - snapshot.EventDigest, snapshot.HyperDigest, snapshot.HistoryDigest, snapshot.Version) + log.Infof(` +Received snapshot with values: + EventDigest: %s + HyperDigest: %x + HistoryDigest: %x + Version: %d +`, + snapshot.EventDigest, + snapshot.HyperDigest, + snapshot.HistoryDigest, + snapshot.Version) return nil },