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
Must be implemented by derived contracts to define the weight calculation strategy. See [stakeWeighting](#stake-weighting) for more information.
132
+
Must be implemented by derived contracts to define the weight calculation strategy. See [stakeWeighting](#stake-weighting) for more information. When implementing this function, AVSs must ensure that all operators have an identical weights structure and length types. Failure to do so can result in certificates being verified with silent failures.
122
133
123
134
An example integration is in [`ECDSATableCalculator`](../../src/middlewareV2/tableCalculator/ECDSATableCalculator.sol)
124
135
@@ -134,30 +145,35 @@ The `BN254TableCalculatorBase` provides base functionality for calculating BN254
134
145
135
146
```solidity
136
147
/**
137
-
* @notice A struct that contains information about a single operator
138
-
* @param pubkey The G1 public key of the operator.
139
-
* @param weights The weights of the operator for a single operatorSet.
140
-
* @dev The `weights` array can be defined as a list of arbitrary groupings. For example,
141
-
* it can be [slashable_stake, delegated_stake, strategy_i_stake, ...]
148
+
* @notice A struct that contains information about a single operator for a given BN254 operatorSet
149
+
* @param pubkey The G1 public key of the operator
150
+
* @param weights The weights of the operator for a single operatorSet
151
+
*
152
+
* @dev The `weights` array is as a list of arbitrary stake types. For example,
153
+
* it can be [slashable_stake, delegated_stake, strategy_i_stake, ...]. Each stake type is an index in the array
154
+
*
155
+
* @dev It is up to the AVS to define the `weights` array, which is used by the `IBN254CertificateVerifier` to verify Certificates
156
+
*
157
+
* @dev For each operator, the `weights` array should be the same length and composition, otherwise verification issues can arise
142
158
*/
143
159
struct BN254OperatorInfo {
144
160
BN254.G1Point pubkey;
145
161
uint256[] weights;
146
162
}
147
163
148
164
/**
149
-
* @notice A struct that contains information about all operators for a given operatorSet
150
-
* @param operatorInfoTreeRoot The root of the operatorInfo tree. Each leaf is a `BN254OperatorInfo` struct
151
-
* @param numOperators The number of operators in the operatorSet.
152
-
* @param aggregatePubkey The aggregate G1 public key of the operators in the operatorSet.
153
-
* @param totalWeights The total weights of the operators in the operatorSet.
165
+
* @notice A struct that contains information about all operators for a given BN254operatorSet
166
+
* @param operatorInfoTreeRoot The root of the operatorInfo tree
167
+
* @param numOperators The number of operators in the operatorSet
168
+
* @param aggregatePubkey The aggregate G1 public key of the operators in the operatorSet
169
+
* @param totalWeights The total stake weights of the operators in the operatorSet
154
170
*
155
171
* @dev The operatorInfoTreeRoot is the root of a merkle tree that contains the operatorInfos for each operator in the operatorSet.
156
-
* It is calculated in this function and used by the `IBN254CertificateVerifier` to verify stakes against the non-signing operators
172
+
* It is calculated on-chain by the `BN254TableCalculator` and used by the `IBN254CertificateVerifier` to verify stakes against the non-signing operators
157
173
*
158
-
* @dev Retrieval of the `aggregatePubKey` depends on maintaining a key registry contract, see `BN254TableCalculatorBase` for an example implementation.
174
+
* @dev Retrieval of the `aggregatePubKey` depends on maintaining a key registry contract, see `KeyRegistrar` for an example implementation
159
175
*
160
-
* @dev The `totalWeights` array should be the same length as each individual `weights` array in `operatorInfos`.
176
+
* @dev The `totalWeights` array should be the same length and composition as each individual `weights` array in `BN254OperatorInfo`
161
177
*/
162
178
struct BN254OperatorSetInfo {
163
179
bytes32 operatorInfoTreeRoot;
@@ -243,13 +259,20 @@ Returns an array of `BN254OperatorInfo` structs for all operators in the operato
243
259
* @notice Abstract function to get the operator weights for a given operatorSet
244
260
* @param operatorSet The operatorSet to get the weights for
245
261
* @return operators The addresses of the operators in the operatorSet
246
-
* @return weights The weights for each operator in the operatorSet
262
+
* @return weights The weights for each operator in the operatorSet, this is a 2D array where the first index is the operator
263
+
* and the second index is the type of weight
264
+
* @dev Each single `weights` array is as a list of arbitrary stake types. For example,
265
+
* it can be [slashable_stake, delegated_stake, strategy_i_stake, ...]. Each stake type is an index in the array
266
+
* @dev Must be implemented by derived contracts to define specific weight calculation logic
267
+
* @dev The certificate verification assumes the composition weights array for each operator is the same.
268
+
* If the length of the array is different or the stake types are different, then verification issues can arise, including
269
+
* verification failing silently for multiple operators with different weights structures
Must be implemented by derived contracts to define the weight calculation strategy. Similar to ECDSA, weights are a 2D array supporting multiple weight types per operator.
276
+
Must be implemented by derived contracts to define the weight calculation strategy. Similar to ECDSA, weights are a 2D array supporting multiple weight types per operator. When implementing this function, AVSs must ensure that all operators have an identical weights structure and length types. Failure to do so can result in certificates being verified with silent failures.
254
277
255
278
An example integration is defined in [`BN254TableCalculator`](../../src/middlewareV2/tableCalculator/BN254TableCalculator.sol).
0 commit comments