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
fix: include timestamp with BN254CertificateVerifier certificate generation (#1610)
**Motivation:**
As is, BN254 signatures do not necessarily sign over a timestamp. To
enforce this, we include it within the onchain code to ensure that
signatures _must_ sign over a timestamp to prevent mutation issues.
**Modifications:**
* Add `calculateCertificateDigest` to the `BN254CertificateVerifier`
* Add `getGlobalTableUpdateSignableDigest` to `OperatorTableUpdater` for
offchain services
* Update tests accordingly
**Result:**
BN254 certificates now signing over a reference timestamp
---------
Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/multichain/destination/CertificateVerifier.md
+18-13Lines changed: 18 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,8 @@ Certificates can be created at any time, but must contain a `referenceTimestamp`
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
31
+
Both the `BN254CertificateVerifier` and `ECDSACertificateVerifier` contain a `msgHash` parameter. This value is the the hash of a task that was completed by operators. **NOTE: The msgHash is NOT signed by operators as part of completion of a task**. The value signed by operators is the signable digest, which is the hash of the `msgHash` and `referenceTimestamp`. This signable digest is given by `certificateVerifier.calculateCertificateDigest`.
32
+
31
33
---
32
34
33
35
## ECDSACertificateVerifier
@@ -117,12 +119,15 @@ For the `msgHash`, it is up to the off-chain AVS software to add relevant metada
117
119
118
120
```solidity
119
121
/**
120
-
* @notice A Certificate used to verify a set of ECDSA signatures
121
-
* @param referenceTimestamp a reference timestamp that corresponds to a timestamp at which an operator table was updated for the operatorSet.
122
-
* @param messageHash the hash of the message that was signed by the operators.
123
-
* The messageHash should be calculated using `calculateCertificateDigest`
124
-
* @param sig the concatenated signature of each signing operator, in ascending order of signer address
122
+
* @notice A Certificate used to verify a set of ECDSA signatures for an off-chain task
123
+
* @param referenceTimestamp a reference timestamp that corresponds to a timestamp at which an operator table was updated for the operatorSet
124
+
* @param messageHash the hash of a task that was completed by operators. The messageHash is defined by the AVS, see `TaskMailbox.sol` for an example implementation.
125
+
* NOTE: This value is NOT the message that is signed by operators - see `calculateCertificateDigest` for the signable digest.
126
+
* @param sig the concatenated signature of each signing operator, in ascending order of signer address. The signature should be over the signable digest,
127
+
* which is calculated by `calculateCertificateDigest`
128
+
* @dev The signers can be sorted via OZ sort library
125
129
* @dev ECDSA certificates DO NOT support smart contract signatures
130
+
* @dev The `referenceTimestamp` is used to key into the operatorSet's stake weights. It is NOT the timestamp at which the certificate was generated off-chain
126
131
*/
127
132
struct ECDSACertificate {
128
133
uint32 referenceTimestamp;
@@ -415,14 +420,14 @@ The contract supports 3 verification patterns:
415
420
416
421
```solidity
417
422
/**
418
-
* @notice A struct that contains information about a single operator for a given BN254 operatorSet
419
-
* @param pubkey The G1 public key of the operator
420
-
* @param weights The weights of the operator for a single operatorSet
421
-
*
422
-
* @dev The `weights` array is as a list of arbitrary stake types. For example,
423
-
* it can be [slashable_stake, delegated_stake, strategy_i_stake, ...]
424
-
*
425
-
* @dev It is up to the AVS to define the `weights` array, which is used by the `IBN254CertificateVerifier` to verify Certificates
423
+
* @notice A BN254 Certificate
424
+
* @param referenceTimestamp a reference timestamp that corresponds to a timestamp at which an operator table was updated for the operatorSet.
425
+
* @param messageHash the hash of a task that was completed by operators. The messageHash is defined by the AVS, see `TaskMailbox.sol` for an example implementation.
426
+
* NOTE: This value is NOT the message that is signed by operators - see `calculateCertificateDigest` for the signable digest.
427
+
* @param signature the G1 signature of the message. The signature is over the signable digest, which is calculated by `calculateCertificateDigest`
428
+
* @param apk the G2 aggregate public key
429
+
* @param nonSignerWitnesses an array of witnesses of non-signing operators
430
+
* @dev The `referenceTimestamp` is used to key into the operatorSet's stake weights. It is NOT the timestamp at which the certificate was generated off-chain
0 commit comments