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
Copy file name to clipboardExpand all lines: docs/multichain/destination/CertificateVerifier.md
+24-7Lines changed: 24 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,11 @@ struct ECDSAOperatorInfo {
73
73
* @dev This function can only be called by the `OperatorTableUpdater` contract, which is itself permissionless to call
74
74
* @dev The `referenceTimestamp` must correspond to a reference timestamp for a globalTableRoot stored in the `OperatorTableUpdater`
75
75
* In addition, it must be greater than the latest reference timestamp for the given operatorSet
76
+
* @dev Reverts for:
77
+
* - OnlyTableUpdater: Caller is not the operatorTableUpdater
78
+
* - TableUpdateStale: The referenceTimestamp is not greater than the latest reference timestamp
79
+
* @dev Emits the following events:
80
+
* - TableUpdated: When the operator table is successfully updated
76
81
*/
77
82
function updateOperatorTable(
78
83
OperatorSet calldata operatorSet,
@@ -138,7 +143,16 @@ struct ECDSACertificate {
138
143
* a. An in-flight certificate for a past reference timestamp and an operator table update for a newer reference timestamp. The AVS should decide whether it
139
144
* wants to only confirm tasks against the *latest* certificate
140
145
* b. An in-flight certificate against a stake table with a majority-stake operator that has been slashed or removed from the operatorSet
141
-
* @dev Reverts if the certificate's `referenceTimestamp` is too stale with respect to the `maxStalenessPeriod` of the operatorSet
146
+
* @dev Reverts for:
147
+
* - CertificateStale: The certificate's referenceTimestamp is too stale with respect to the maxStalenessPeriod of the operatorSet
148
+
* - ReferenceTimestampDoesNotExist: The root at referenceTimestamp does not exist
149
+
* - RootDisabled: The root at referenceTimestamp is not valid
150
+
* - InvalidSignatureLength: Signatures are not proper length
151
+
* - InvalidSignature: Each signature is not valid
152
+
* - SignersNotOrdered: Signatures are not ordered by signer address ascending
153
+
* - ReferenceTimestampDoesNotExist: The operatorSet has not been updated for the referenceTimestamp
154
+
* - OperatorCountZero: There are zero operators for the referenceTimestamp
155
+
* - VerificationFailed: Any signer is not a registered operator
142
156
*/
143
157
function verifyCertificate(
144
158
OperatorSet calldata operatorSet,
@@ -187,7 +201,9 @@ Verifies an ECDSA certificate by checking individual signatures from operators.
187
201
* a. An in-flight certificate for a past reference timestamp and an operator table update for a newer reference timestamp. The AVS should decide whether it
188
202
* wants to only confirm tasks against the *latest* certificate
189
203
* b. An in-flight certificate against a stake table with a majority-stake operator that has been slashed or removed from the operatorSet
190
-
* @dev Reverts if the certificate's `referenceTimestamp` is too stale with respect to the `maxStalenessPeriod` of the operatorSet
204
+
* @dev Reverts for:
205
+
* - All requirements from verifyCertificate
206
+
* - ArrayLengthMismatch: signedStakes.length does not equal totalStakeProportionThresholds.length
191
207
*/
192
208
function verifyCertificateProportion(
193
209
OperatorSet calldata operatorSet,
@@ -207,7 +223,6 @@ Verifies that a certificate meets specified proportion thresholds as a percentag
207
223
*Requirements*:
208
224
* All requirements from `verifyCertificate`
209
225
*`signedStakes.length` MUST equal `totalStakeProportionThresholds.length`
210
-
* For each stake type: `signedStakes[i] >= (totalStakes[i] * totalStakeProportionThresholds[i]) / 10_000`
211
226
212
227
#### `verifyCertificateNominal`
213
228
@@ -228,7 +243,9 @@ Verifies that a certificate meets specified proportion thresholds as a percentag
228
243
* a. An in-flight certificate for a past reference timestamp and an operator table update for a newer reference timestamp. The AVS should decide whether it
229
244
* wants to only confirm tasks against the *latest* certificate
230
245
* b. An in-flight certificate against a stake table with a majority-stake operator that has been slashed or removed from the operatorSet
231
-
* @dev Reverts if the certificate's `referenceTimestamp` is too stale with respect to the `maxStalenessPeriod` of the operatorSet
246
+
* @dev Reverts for:
247
+
* - All requirements from verifyCertificate
248
+
* - ArrayLengthMismatch: signedStakes.length does not equal totalStakeNominalThresholds.length
232
249
*/
233
250
function verifyCertificateNominal(
234
251
OperatorSet calldata operatorSet,
@@ -247,7 +264,6 @@ Verifies that a certificate meets specified nominal (absolute) stake thresholds
247
264
*Requirements*:
248
265
* All requirements from `verifyCertificate`
249
266
*`signedStakes.length` MUST equal `totalStakeNominalThresholds.length`
250
-
* For each stake type: `signedStakes[i] >= totalStakeNominalThresholds[i]`
251
267
252
268
### Utility Functions
253
269
@@ -270,10 +286,11 @@ The ECDSA Certificate Verifier uses a modified domain separator that intentional
270
286
271
287
```solidity
272
288
/**
273
-
* @notice Calculate the EIP-712 digest for a certificate
289
+
* @notice Calculate the EIP-712 digest for a certificate, returning the hash of the digest
274
290
* @param referenceTimestamp The reference timestamp
275
-
* @param messageHash The message hash
291
+
* @param messageHash The message hash of the task
276
292
* @return The EIP-712 digest
293
+
* @dev EIP-712 is a standard ECDSA signature verification framework. See https://eips.ethereum.org/EIPS/eip-712 for more details
277
294
* @dev This function is public to allow offchain tools to calculate the same digest
278
295
* @dev Note: This does not support smart contract based signatures for multichain
279
296
* @dev This is a chain-agnostic digest, so it can be used to verify certificates across
* - InvalidCurveType: unsupported curve type in operatorTableBytes
99
115
*/
100
116
function updateOperatorTable(
101
117
uint32 referenceTimestamp,
@@ -135,14 +151,19 @@ The `owner` can configure the `generator` and confirmation parameters.
135
151
/**
136
152
* @notice Updates the `Generator` to a new operatorSet
137
153
* @param generator The operatorSet which certifies against global roots
138
-
* @param GeneratorInfo The operatorSetInfo for the generator
139
-
* @param GeneratorConfig The operatorSetConfig for the generator
154
+
* @param generatorInfo The operatorSetInfo for the generator
140
155
* @dev We have a separate function for updating this operatorSet since it's not transported and updated
141
156
* in the same way as the other operatorSets
142
157
* @dev Only callable by the owner of the contract
143
158
* @dev Uses GENERATOR_GLOBAL_TABLE_ROOT constant to break circular dependency for certificate verification
144
159
* @dev We ensure that there are no collisions with other reference timestamps because we expect the generator to have an initial reference timestamp of 0
145
160
* @dev The `_latestReferenceTimestamp` is not updated since this root is ONLY used for the `Generator`
161
+
* @dev The `_referenceBlockNumber` and `_referenceTimestamps` mappings are not updated since they are only used for introspection for official operatorSets
162
+
* @dev Reverts for:
163
+
* - "Ownable: caller is not the owner": caller is not the owner
164
+
* - InvalidGenerator: generator has a non-zero reference timestamp
165
+
* @dev Emits the following events:
166
+
* - GeneratorUpdated: When generator is successfully updated
146
167
*/
147
168
function updateGenerator(
148
169
OperatorSet calldata generator,
@@ -169,8 +190,12 @@ Updates the operator set responsible for confirming global table roots. This fun
169
190
```solidity
170
191
/**
171
192
* @notice The threshold, in bps, for a global root to be signed off on and updated
172
-
* @param bps The threshold in basis points
173
193
* @dev Only callable by the owner of the contract
194
+
* @dev Reverts for:
195
+
* - "Ownable: caller is not the owner": caller is not the owner
196
+
* - InvalidConfirmationThreshold: bps is greater than MAX_BPS (10000)
197
+
* @dev Emits the following events:
198
+
* - GlobalRootConfirmationThresholdUpdated: When threshold is successfully updated
174
199
*/
175
200
function setGlobalRootConfirmationThreshold(
176
201
uint16 bps
@@ -194,6 +219,13 @@ Sets the stake proportion threshold required for confirming global table roots.
194
219
* @notice Disables a global table root
195
220
* @param globalTableRoot the global table root to disable
196
221
* @dev Only callable by the pauser
222
+
* @dev Cannot disable the GENERATOR_GLOBAL_TABLE_ROOT
223
+
* @dev Reverts for:
224
+
* - OnlyPauser: caller is not the pauser
225
+
* - InvalidRoot: globalTableRoot is already disabled or does not exist
226
+
* - CannotDisableGeneratorRoot: attempting to disable the generator's global table root
227
+
* @dev Emits the following events:
228
+
* - GlobalRootDisabled: When global table root is successfully disabled
0 commit comments