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
**Motivation:**
We need E2E tests to assert the new `EmissionsController` and
`RewardsCoordinator` changes work together as expected.
**Modifications:**
- Improved existing EC integration state checks (which improves every
existing test).
**Result:**
Full E2E coverage of our new changes.
assert_TotalWeight_LTE_MaxWeight("check_addDists_State: total weight exceeds MAX_TOTAL_WEIGHT");
1202
+
// 1. Check that total weight was updated correctly.
1203
+
assert_Snap_Updated_TotalWeight(expectedTotalWeight, "total weight != expected total weight");
1204
+
1205
+
// 2. Check that all checks (found in `EmissionsController._checkDistribution`) were passed before adding.
1206
+
// 2a) If the distribution type requires an operator set, check that the operator set was registered before adding.
1207
+
// 2b) If emissions have started, check that the start epoch is in the future (we allow adding before emissions start).
1208
+
// 2c) Check that the total weight after adding and ensuring it does not exceed the maximum total weight (100%).
1209
+
// 2d) Check that the rewards submissions array is not empty for non-Manual distributions.
1210
+
// 3. Check that the distributions were stored correctly.
1211
+
// 4. Check that N distributions were added.
1212
+
// 5. Check that the total processable, emissions controller balance, incentive council balance, current epoch, and button pressability were unchanged.
1213
+
uint totalWeightBefore =_getTotalWeight();
1214
+
uint totalWeightAdded =0;
1215
+
for (uint i =0; i < distributionIds.length; ++i) {
1216
+
IEmissionsControllerTypes.Distribution memory distribution = distributions[i];
1205
1217
1206
-
// 3. Total distributions increased by number of additions
1207
-
assert_Snap_Added_TotalDistributions(distributionIds.length, "check_addDists_State: total distributions should increase");
1218
+
// 2a) If the distribution type requires an operator set, check that the operator set was registered before adding.
emissionsController.incentiveCouncil(), "check_addDists_State: incentive council balance should be unchanged"
1215
-
);
1227
+
// 2c) Check that the total weight after adding and ensuring it does not exceed the maximum total weight (100%).
1228
+
totalWeightAdded += distribution.weight; // Check after the loop.
1216
1229
1217
-
// 6. Current epoch unchanged (adding distributions doesn't advance time)
1218
-
assert_Snap_Unchanged_CurrentEpoch("check_addDists_State: current epoch should be unchanged");
1230
+
// 2d) Check that the rewards submissions array is not empty for non-Manual distributions.
1231
+
if (distribution.distributionType != IEmissionsControllerTypes.DistributionType.Manual) {
1232
+
assertGt(distribution.strategiesAndMultipliers.length, 0, "rewards submissions array is empty for non-Manual distributions");
1233
+
}
1234
+
1235
+
// 3. Check that the distributions were stored correctly.
1236
+
assert_Distribution_StoredCorrectly(distributionIds[i], distribution, "state should be updated");
1237
+
}
1238
+
// 2c) Check that the total weight was updated correctly.
1239
+
assert_Snap_Added_TotalWeight(totalWeightAdded, "total weight must be added correctly");
1240
+
assert_TotalWeight_LTE_MaxWeight("total weight must not exceed the maximum total weight");
1219
1241
1220
-
// 7. Button pressability unchanged (can only add when all processed, so stays not pressable or stays pressable)
1221
-
assert_Snap_Unchanged_ButtonPressability("check_addDists_State: button pressability should be unchanged");
1242
+
// 4. Check that the total distributions were increased by the number of additions.
1243
+
assert_Snap_Added_TotalDistributions(distributionIds.length, "total distributions must be added correctly");
1222
1244
1223
-
// 8. Total processable behavior depends on whether emissions have started
1224
-
// Before emissions start, total processable increases with each added distribution
1225
-
// After emissions start, total processable stays the same (because both _distributions.length
1226
-
// and _epochs[currentEpoch].totalAdded increase by the same amount)
1227
-
if (emissionsController.getCurrentEpoch() ==type(uint).max) {
1245
+
// 5. Check that the total processable, emissions controller balance, incentive council balance, current epoch, and button pressability were unchanged.
1246
+
if (currentEpoch ==type(uint).max) {
1228
1247
assert_Snap_Added_TotalProcessableDistributions(
1229
-
distributionIds.length, "check_addDists_State: total processable should increase before emissions start"
1248
+
distributionIds.length, "total processable should increase before emissions start"
assert_Snap_Updated_TotalWeight(expectedTotalWeight, "total weight != expected total weight");
1282
+
1283
+
// 2. Check that all checks (found in `EmissionsController._checkDistribution`) were passed before updating.
1284
+
// 2a) If the distribution type requires an operator set, check that the operator set was registered before updating.
1285
+
// 2b) If emissions have started, check that the start epoch is in the future (we allow updating before emissions start).
1286
+
// 2c) Check that the total weight after updating and ensuring it does not exceed the maximum total weight (100%).
1287
+
// 2d) Check that the rewards submissions array is not empty for non-Manual distributions.
1288
+
// 3. Check that the distributions were updated correctly in storage.
1289
+
// 4. Check that distribution IDs remain valid.
1290
+
// 5. Check that N distributions remain (no addition or removal).
1291
+
// 6. Check that the total processable, emissions controller balance, incentive council balance, current epoch, and button pressability were unchanged.
1292
+
for (uint i =0; i < distributionIds.length; ++i) {
1293
+
IEmissionsControllerTypes.Distribution memory distribution = newDists[i];
1266
1294
1267
-
// === State Invariants ===
1268
-
1269
-
// 1. Total weight updated correctly (old weights removed, new weights added)
1270
-
assert_Snap_Updated_TotalWeight(expectedTotalWeight, "check_updateDists_State: total weight != expected");
1271
-
1272
-
// 2. Total weight never exceeds maximum
1273
-
assert_TotalWeight_LTE_MaxWeight("check_updateDists_State: total weight exceeds MAX_TOTAL_WEIGHT");
1274
-
1275
-
// 3. Total distributions unchanged (update doesn't add/remove, just modifies)
1276
-
assert_Snap_Unchanged_TotalDistributions("check_updateDists_State: total distributions should be unchanged");
1295
+
// 2a) If the distribution type requires an operator set, check that the operator set was registered before updating.
// 5. Check that the total distributions were unchanged (update doesn't add/remove, just modifies).
1321
+
assert_Snap_Unchanged_TotalDistributions("total distributions must be unchanged");
1299
1322
1300
-
// 10. Distribution IDs remain valid
1301
-
for (uint i =0; i < distributionIds.length; ++i) {
1302
-
assertTrue(distributionIds[i] <_getTotalDistributions(), "check_updateDists_State: distribution ID should be valid");
1303
-
}
1323
+
// 6. Check that the total processable, emissions controller balance, incentive council balance, current epoch, and button pressability were unchanged.
1324
+
assert_Snap_Unchanged_TotalProcessableDistributions("total processable should be unchanged");
1325
+
assert_Snap_Unchanged_EmissionsController_EigenBalance("EC balance should be unchanged");
1326
+
assert_Snap_Unchanged_IncentiveCouncil_EigenBalance(emissionsController.incentiveCouncil(), "IC balance should be unchanged");
1327
+
assert_Snap_Unchanged_CurrentEpoch("current epoch should be unchanged");
1328
+
assert_Snap_Unchanged_ButtonPressability("button pressability should be unchanged");
1304
1329
}
1305
1330
1306
1331
function check_sweep_State(
@@ -1433,11 +1458,12 @@ contract IntegrationCheckUtils is IntegrationBase {
1433
1458
// 1. Current epoch matches target epoch
1434
1459
assertEq(epoch, emissionsController.getCurrentEpoch(), "check_warpToEpoch_State: epoch != current epoch");
1435
1460
1436
-
// 2. Block timestamp is at the start of the target epoch
0 commit comments