You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CertificateVerifier contracts are responsible for verifying certificates from an offchain task, on-chain. The operatorSet tables are configured by the [`OperatorTableUpdater`](./OperatorTableUpdater.md) and updated in the `CertificateVerifier` by an offchain process. These contracts support two signature schemes: ECDSA for individual signatures and BN254 for aggregated signatures.
26
26
27
-
Both verifiers implement staleness checks based on a `maxStalenessPeriod` to ensure certificates are not verified against outdated operator information.
27
+
Certificates can be created at any time, but must contain a `referenceTimestamp`, which informs the contract of which operator table for the `operatorSet` to use. Both certificate verifiers implement staleness checks based on a `maxStalenessPeriod` to ensure certificates are not verified against outdated operator information.
28
28
29
29
**Note: Setting a max staleness period to 0 enables certificates to be confirmed against any `referenceTimestamp`. In addition, setting a `maxStalenessPeriod` that is greater than 0 and less than the frequency of table updates (daily on testnet, weekly on mainnet) is impossible due bounds enfroced by the [`CrossChainRegistry`](../source/CrossChainRegistry.md#parameterization).** See the [staleness period](#staleness-period) in the appendix for some examples.
30
30
@@ -106,8 +106,7 @@ For the `msgHash`, it is up to the off-chain AVS software to add relevant metada
106
106
```solidity
107
107
/**
108
108
* @notice A Certificate used to verify a set of ECDSA signatures
109
-
* @param referenceTimestamp the timestamp at which the certificate was
110
-
* created, which MUST correspond to a reference timestamp of the operator table update
109
+
* @param referenceTimestamp a reference timestamp that corresponds to an operator table update
111
110
* @param messageHash the hash of the message that was signed by the operators.
112
111
* The messageHash should be calculated using `calculateCertificateDigest`
113
112
* @param sig the concatenated signature of each signing operator, in ascending order of signer address
@@ -121,10 +120,12 @@ struct ECDSACertificate {
121
120
122
121
/**
123
122
* @notice verifies a certificate
123
+
* @param operatorSet the operatorSet that the certificate is for
124
124
* @param cert a certificate
125
-
* @return signedStakes amount of stake that signed the certificate for each stake
126
-
* type. Each index corresponds to a stake type in the `weights` array in the `ECDSAOperatorInfo`
125
+
* @return totalSignedStakeWeights total stake weight that signed the certificate for each stake type. Each
126
+
* index corresponds to a stake type in the `weights` array in the `ECDSAOperatorInfo`
127
127
* @return signers array of addresses that signed the certificate
128
+
* @dev This function DOES NOT support smart contact signatures
128
129
*/
129
130
function verifyCertificate(
130
131
OperatorSet calldata operatorSet,
@@ -361,8 +362,7 @@ The contract supports 3 verification patterns:
361
362
```solidity
362
363
/**
363
364
* @notice A BN254 Certificate
364
-
* @param referenceTimestamp the timestamp at which the certificate was created,
365
-
* which MUST correspond to a reference timestamp of the operator table update
365
+
* @param referenceTimestamp a reference timestamp that corresponds to an operator table update
366
366
* @param messageHash the hash of the message that was signed by operators and used to verify the aggregated signature
367
367
* @param signature the G1 signature of the message
368
368
* @param apk the G2 aggregate public key
@@ -535,3 +535,109 @@ The operator table is updated every 10 days. The staleness period is 5 days. The
535
535
4. Day 7: A new certificate is generated. However, this will fail as the `referenceTimestamp` would still be Day 1 given that was the latest table update
536
536
537
537
Note that we cannot re-generate a certificate on Day 7. This is why we prevent the `stalenessPeriod` from being less than 10 days in the `CrossChainRegistry`.
538
+
539
+
## Consumption Patterns
540
+
541
+
### Introspection
542
+
543
+
Both the `BN254CertificateVerifier` and `ECDSACertificateVerifier` share the following view functions
544
+
545
+
```solidity
546
+
/**
547
+
* @notice The latest reference timestamp of the operator table for a given operatorSet. This value is
548
+
* updated each time an operator table is updated
549
+
* @param operatorSet The operatorSet to get the latest reference timestamp of
550
+
* @return The latest reference timestamp, 0 if the operatorSet has never been updated
551
+
*/
552
+
function latestReferenceTimestamp(
553
+
OperatorSet memory operatorSet
554
+
) external view returns (uint32);
555
+
556
+
/**
557
+
* @notice Whether the operator table has been updated for a given reference timestamp
558
+
* @param operatorSet The operatorSet to check
559
+
* @param referenceTimestamp The reference timestamp to check
560
+
* @return Whether the reference timestamp has been updated
561
+
* @dev The reference timestamp is set when the operator table is updated
562
+
*/
563
+
function isReferenceTimestampSet(
564
+
OperatorSet memory operatorSet,
565
+
uint32 referenceTimestamp
566
+
) external view returns (bool);
567
+
568
+
/**
569
+
* @notice Get the total stake weights for all operators at a given reference timestamp
570
+
* @param operatorSet The operator set to calculate stakes for
571
+
* @param referenceTimestamp The reference timestamp
572
+
* @return The sum of stake weights for each stake type, empty if the operatorSet has not been updated for the given reference timestamp
573
+
* @dev For ECDSA, this function *reverts* if the reference timestamp is not set or the number of operators is 0
574
+
* @dev For BN254, this function returns empty array if the reference timestamp is not set or the number of operators is 0
575
+
*/
576
+
function getTotalStakeWeights(
577
+
OperatorSet memory operatorSet,
578
+
uint32 referenceTimestamp
579
+
) external view returns (uint256[] memory);
580
+
581
+
/**
582
+
* @notice Get the number of operators at a given reference timestamp
583
+
* @param operatorSet The operator set to get the number of operators for
584
+
* @param referenceTimestamp The reference timestamp
585
+
* @return The number of operators
586
+
* @dev Returns 0 if the reference timestamp is not set or the number of operators is 0
587
+
*/
588
+
function getOperatorCount(
589
+
OperatorSet memory operatorSet,
590
+
uint32 referenceTimestamp
591
+
) external view returns (uint256);
592
+
```
593
+
594
+
The `getTotalStakeWeights` function should be read by consumers before passing in expected proportional or nominal amounts into the `verifyCertificateProportion` or `verifyCertificateNominal` respectively.
595
+
596
+
The `latestReferenceTimestamp` should be called by AVSs offchain aggregator to pass in a `referenceTimestasmp` into the `Certificate`
597
+
598
+
To retrieve the operators and their weights from an operatorSet, the AVS offchain aggregator can call the following function on the operatorSet's `OperatorTableCalculator`, which can be retrieved from the `CrossChainRegistry`.
599
+
600
+
```solidity
601
+
/**
602
+
* @notice Get the operator stake weights for a given operatorSet
603
+
* @param operatorSet The operatorSet to get the stake weights for
604
+
* @return operators The addresses of the operators in the operatorSet
605
+
* @return weights The stake weights for each operator in the operatorSet, this is a 2D array where the first index is the operator
The below diagram describes an end to end verification process for verifying a certificate with nominal thresholds. Solid lines are on-chain write interactions. Dashed lines are read operations, either on- or off- chain.
616
+
617
+
```mermaid
618
+
sequenceDiagram
619
+
participant Transporter as EigenLabs Transporter
620
+
participant OUT as OperatorTableUpdater
621
+
participant OTC as OperatorTableCalculator
622
+
participant CV as CertificateVerifier
623
+
participant Aggregator as AVS Aggregator
624
+
participant Registry as CrossChainRegistry
625
+
participant Consumer as AVS Consumer
626
+
627
+
Transporter->>OUT: 1. updateOperatorTable()
628
+
OUT->>CV: updateOperatorTable()
629
+
630
+
Aggregator-->>CV: 2. Get latestReferenceTimestamp()
0 commit comments