Skip to content

Commit 3063aae

Browse files
ian-shimhopeyen
authored andcommitted
[v2] Add quorum results to attestation (#1018)
1 parent d05863a commit 3063aae

File tree

11 files changed

+141
-77
lines changed

11 files changed

+141
-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, error) {
@@ -323,6 +325,7 @@ func (a *Attestation) ToProtobuf() (*disperserpb.Attestation, error) {
323325

324326
quorumAPKs := make([][]byte, len(a.QuorumAPKs))
325327
quorumNumbers := make([]uint32, len(a.QuorumNumbers))
328+
quorumResults := make([]uint8, len(a.QuorumResults))
326329
for i, q := range a.QuorumNumbers {
327330
quorumNumbers[i] = uint32(q)
328331

@@ -332,17 +335,19 @@ func (a *Attestation) ToProtobuf() (*disperserpb.Attestation, error) {
332335
}
333336
apkBytes := apk.Bytes()
334337
quorumAPKs[i] = apkBytes[:]
338+
quorumResults[i] = a.QuorumResults[q]
335339
}
336340

337341
apkG2Bytes := a.APKG2.Bytes()
338342
sigmaBytes := a.Sigma.Bytes()
339343

340344
return &disperserpb.Attestation{
341-
NonSignerPubkeys: nonSignerPubKeys,
342-
ApkG2: apkG2Bytes[:],
343-
QuorumApks: quorumAPKs,
344-
Sigma: sigmaBytes[:],
345-
QuorumNumbers: quorumNumbers,
345+
NonSignerPubkeys: nonSignerPubKeys,
346+
ApkG2: apkG2Bytes[:],
347+
QuorumApks: quorumAPKs,
348+
Sigma: sigmaBytes[:],
349+
QuorumNumbers: quorumNumbers,
350+
QuorumSignedPercentages: quorumResults,
346351
}, nil
347352
}
348353

disperser/common/v2/blobstore/dynamo_metadata_store_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,10 @@ func TestBlobMetadataStoreBatchAttestation(t *testing.T) {
460460
G1Point: core.NewG1Point(big.NewInt(9), big.NewInt(10)),
461461
},
462462
QuorumNumbers: []core.QuorumID{0, 1},
463+
QuorumResults: map[uint8]uint8{
464+
0: 100,
465+
1: 80,
466+
},
463467
}
464468

465469
err = blobMetadataStore.PutAttestation(ctx, attestation)

disperser/controller/dispatcher.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ func (d *Dispatcher) HandleSignatures(ctx context.Context, batchData *batchData,
274274
return fmt.Errorf("failed to aggregate signatures for batch %s: %w", batchHeaderHash, err)
275275
}
276276

277+
quorumResults := make(map[core.QuorumID]uint8)
278+
for quorumID, result := range quorumAttestation.QuorumResults {
279+
quorumResults[quorumID] = result.PercentSigned
280+
}
277281
err = d.blobMetadataStore.PutAttestation(ctx, &corev2.Attestation{
278282
BatchHeader: batchData.Batch.BatchHeader,
279283
AttestedAt: uint64(time.Now().UnixNano()),
@@ -282,6 +286,7 @@ func (d *Dispatcher) HandleSignatures(ctx context.Context, batchData *batchData,
282286
QuorumAPKs: aggSig.QuorumAggPubKeys,
283287
Sigma: aggSig.AggSignature,
284288
QuorumNumbers: nonZeroQuorums,
289+
QuorumResults: quorumResults,
285290
})
286291
putAttestationFinished := time.Now()
287292
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
}

0 commit comments

Comments
 (0)