Skip to content

Commit c56beeb

Browse files
committed
add quorum results
1 parent b679a14 commit c56beeb

File tree

10 files changed

+137
-77
lines changed

10 files changed

+137
-77
lines changed

api/docs/disperser_v2.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ <h3 id="disperser.v2.Attestation">Attestation</h3>
288288
<td>quorum_apks</td>
289289
<td><a href="#bytes">bytes</a></td>
290290
<td>repeated</td>
291-
<td><p>Serialized bytes of aggregate public keys (G1 points) from all nodes for each quorum </p></td>
291+
<td><p>Serialized bytes of aggregate public keys (G1 points) from all nodes for each quorum
292+
The order of the quorum_apks should match the order of the quorum_numbers </p></td>
292293
</tr>
293294

294295
<tr>
@@ -305,6 +306,14 @@ <h3 id="disperser.v2.Attestation">Attestation</h3>
305306
<td><p>Relevant quorum numbers for the attestation </p></td>
306307
</tr>
307308

309+
<tr>
310+
<td>quorum_signed_percentages</td>
311+
<td><a href="#bytes">bytes</a></td>
312+
<td></td>
313+
<td><p>The attestation rate for each quorum.
314+
The order of the quorum_signed_percentages should match the order of the quorum_numbers </p></td>
315+
</tr>
316+
308317
</tbody>
309318
</table>
310319

api/docs/disperser_v2.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@
4444
| ----- | ---- | ----- | ----------- |
4545
| non_signer_pubkeys | [bytes](#bytes) | repeated | Serialized bytes of non signer public keys (G1 points) |
4646
| apk_g2 | [bytes](#bytes) | | Serialized bytes of G2 point that represents aggregate public key of all signers |
47-
| quorum_apks | [bytes](#bytes) | repeated | Serialized bytes of aggregate public keys (G1 points) from all nodes for each quorum |
47+
| quorum_apks | [bytes](#bytes) | repeated | Serialized bytes of aggregate public keys (G1 points) from all nodes for each quorum The order of the quorum_apks should match the order of the quorum_numbers |
4848
| sigma | [bytes](#bytes) | | Serialized bytes of aggregate signature |
4949
| quorum_numbers | [uint32](#uint32) | repeated | Relevant quorum numbers for the attestation |
50+
| quorum_signed_percentages | [bytes](#bytes) | | The attestation rate for each quorum. The order of the quorum_signed_percentages should match the order of the quorum_numbers |
5051

5152

5253

api/docs/eigenda-protos.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,8 @@ <h3 id="disperser.v2.Attestation">Attestation</h3>
19591959
<td>quorum_apks</td>
19601960
<td><a href="#bytes">bytes</a></td>
19611961
<td>repeated</td>
1962-
<td><p>Serialized bytes of aggregate public keys (G1 points) from all nodes for each quorum </p></td>
1962+
<td><p>Serialized bytes of aggregate public keys (G1 points) from all nodes for each quorum
1963+
The order of the quorum_apks should match the order of the quorum_numbers </p></td>
19631964
</tr>
19641965

19651966
<tr>
@@ -1976,6 +1977,14 @@ <h3 id="disperser.v2.Attestation">Attestation</h3>
19761977
<td><p>Relevant quorum numbers for the attestation </p></td>
19771978
</tr>
19781979

1980+
<tr>
1981+
<td>quorum_signed_percentages</td>
1982+
<td><a href="#bytes">bytes</a></td>
1983+
<td></td>
1984+
<td><p>The attestation rate for each quorum.
1985+
The order of the quorum_signed_percentages should match the order of the quorum_numbers </p></td>
1986+
</tr>
1987+
19791988
</tbody>
19801989
</table>
19811990

api/docs/eigenda-protos.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,10 @@ If DisperseBlob returns the following error codes: INVALID_ARGUMENT (400): reque
746746
| ----- | ---- | ----- | ----------- |
747747
| non_signer_pubkeys | [bytes](#bytes) | repeated | Serialized bytes of non signer public keys (G1 points) |
748748
| apk_g2 | [bytes](#bytes) | | Serialized bytes of G2 point that represents aggregate public key of all signers |
749-
| quorum_apks | [bytes](#bytes) | repeated | Serialized bytes of aggregate public keys (G1 points) from all nodes for each quorum |
749+
| quorum_apks | [bytes](#bytes) | repeated | Serialized bytes of aggregate public keys (G1 points) from all nodes for each quorum The order of the quorum_apks should match the order of the quorum_numbers |
750750
| sigma | [bytes](#bytes) | | Serialized bytes of aggregate signature |
751751
| quorum_numbers | [uint32](#uint32) | repeated | Relevant quorum numbers for the attestation |
752+
| quorum_signed_percentages | [bytes](#bytes) | | The attestation rate for each quorum. The order of the quorum_signed_percentages should match the order of the quorum_numbers |
752753

753754

754755

api/grpc/disperser/v2/disperser_v2.pb.go

Lines changed: 83 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/proto/disperser/v2/disperser_v2.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,15 @@ message Attestation {
138138
// Serialized bytes of G2 point that represents aggregate public key of all signers
139139
bytes apk_g2 = 2;
140140
// Serialized bytes of aggregate public keys (G1 points) from all nodes for each quorum
141+
// The order of the quorum_apks should match the order of the quorum_numbers
141142
repeated bytes quorum_apks = 3;
142143
// Serialized bytes of aggregate signature
143144
bytes sigma = 4;
144145
// Relevant quorum numbers for the attestation
145146
repeated uint32 quorum_numbers = 5;
147+
// The attestation rate for each quorum.
148+
// The order of the quorum_signed_percentages should match the order of the quorum_numbers
149+
bytes quorum_signed_percentages = 6;
146150
}
147151

148152
message PaymentGlobalParams {

core/v2/types.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ type Attestation struct {
312312
Sigma *core.Signature
313313
// QuorumNumbers contains the quorums relevant for the attestation
314314
QuorumNumbers []core.QuorumID
315+
// QuorumResults contains the results of the quorum verification
316+
QuorumResults map[core.QuorumID]uint8
315317
}
316318

317319
func (a *Attestation) ToProtobuf() *disperserpb.Attestation {
@@ -328,19 +330,22 @@ func (a *Attestation) ToProtobuf() *disperserpb.Attestation {
328330
}
329331

330332
quorumNumbers := make([]uint32, len(a.QuorumNumbers))
333+
quorumResults := make([]uint8, len(a.QuorumResults))
331334
for i, q := range a.QuorumNumbers {
332335
quorumNumbers[i] = uint32(q)
336+
quorumResults[i] = a.QuorumResults[q]
333337
}
334338

335339
apkG2Bytes := a.APKG2.Bytes()
336340
sigmaBytes := a.Sigma.Bytes()
337341

338342
return &disperserpb.Attestation{
339-
NonSignerPubkeys: nonSignerPubKeys,
340-
ApkG2: apkG2Bytes[:],
341-
QuorumApks: quorumAPKs,
342-
Sigma: sigmaBytes[:],
343-
QuorumNumbers: quorumNumbers,
343+
NonSignerPubkeys: nonSignerPubKeys,
344+
ApkG2: apkG2Bytes[:],
345+
QuorumApks: quorumAPKs,
346+
Sigma: sigmaBytes[:],
347+
QuorumNumbers: quorumNumbers,
348+
QuorumSignedPercentages: quorumResults,
344349
}
345350
}
346351

disperser/controller/dispatcher.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ func (d *Dispatcher) HandleSignatures(ctx context.Context, batchData *batchData,
246246
return fmt.Errorf("failed to aggregate signatures: %w", err)
247247
}
248248

249+
quorumResults := make(map[core.QuorumID]uint8)
250+
for quorumID, result := range quorumAttestation.QuorumResults {
251+
quorumResults[quorumID] = result.PercentSigned
252+
}
249253
err = d.blobMetadataStore.PutAttestation(ctx, &corev2.Attestation{
250254
BatchHeader: batchData.Batch.BatchHeader,
251255
AttestedAt: uint64(time.Now().UnixNano()),
@@ -254,6 +258,7 @@ func (d *Dispatcher) HandleSignatures(ctx context.Context, batchData *batchData,
254258
QuorumAPKs: aggSig.QuorumAggPubKeys,
255259
Sigma: aggSig.AggSignature,
256260
QuorumNumbers: quorums,
261+
QuorumResults: quorumResults,
257262
})
258263
putAttestationFinished := time.Now()
259264
d.metrics.reportPutAttestationLatency(putAttestationFinished.Sub(aggregateSignaturesFinished))

disperser/controller/dispatcher_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ func TestDispatcherHandleBatch(t *testing.T) {
112112
require.Len(t, att.QuorumAPKs, 2)
113113
require.NotNil(t, att.Sigma)
114114
require.ElementsMatch(t, att.QuorumNumbers, []core.QuorumID{0, 1})
115+
require.InDeltaMapValues(t, map[core.QuorumID]uint8{0: 100, 1: 100}, att.QuorumResults, 0)
115116

116117
deleteBlobs(t, components.BlobMetadataStore, objs.blobKeys, [][32]byte{bhh})
117118
}

inabox/tests/integration_v2_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ var _ = Describe("Inabox v2 Integration", func() {
9393
Expect(batchHeader1.GetReferenceBlockNumber()).To(BeNumerically(">", 0))
9494
attestation := reply1.GetSignedBatch().GetAttestation()
9595
Expect(attestation).To(Not(BeNil()))
96+
Expect(attestation.QuorumNumbers).To(Equal([]uint32{0, 1}))
97+
Expect(len(attestation.NonSignerPubkeys)).To(Equal(0))
98+
Expect(attestation.ApkG2).To(Not(BeNil()))
99+
Expect(len(attestation.QuorumApks)).To(Equal(2))
100+
Expect(attestation.QuorumSignedPercentages).To(Equal([]byte{100, 100}))
96101
blobVerification := reply1.GetBlobVerificationInfo()
97102
Expect(blobVerification).To(Not(BeNil()))
98103
Expect(blobVerification.GetBlobCertificate()).To(Not(BeNil()))
@@ -116,6 +121,11 @@ var _ = Describe("Inabox v2 Integration", func() {
116121
Expect(batchHeader2.GetReferenceBlockNumber()).To(BeNumerically(">", 0))
117122
attestation = reply2.GetSignedBatch().GetAttestation()
118123
Expect(attestation).To(Not(BeNil()))
124+
Expect(attestation.QuorumNumbers).To(Equal([]uint32{0, 1}))
125+
Expect(len(attestation.NonSignerPubkeys)).To(Equal(0))
126+
Expect(attestation.ApkG2).To(Not(BeNil()))
127+
Expect(len(attestation.QuorumApks)).To(Equal(2))
128+
Expect(attestation.QuorumSignedPercentages).To(Equal([]byte{100, 100}))
119129
blobVerification = reply2.GetBlobVerificationInfo()
120130
Expect(blobVerification).To(Not(BeNil()))
121131
Expect(blobVerification.GetBlobCertificate()).To(Not(BeNil()))

0 commit comments

Comments
 (0)