@@ -205,6 +205,109 @@ contract TestRulesetQueuing_Local is TestBaseWorkflow {
205
205
assertEq (_newRuleset.basedOnId, _currentRulesetId);
206
206
}
207
207
208
+ function testReconfigureProjectWithWeightOfZero () public {
209
+ // Package a ruleset configuration.
210
+ JBRulesetConfig[] memory _rulesetConfig = new JBRulesetConfig [](1 );
211
+ _rulesetConfig[0 ].mustStartAtOrAfter = 0 ;
212
+ _rulesetConfig[0 ].duration = _RULESET_DURATION;
213
+ _rulesetConfig[0 ].weightCutPercent = 0 ;
214
+ _rulesetConfig[0 ].approvalHook = _deadline;
215
+ _rulesetConfig[0 ].metadata = _metadata;
216
+ _rulesetConfig[0 ].splitGroups = _splitGroup;
217
+ _rulesetConfig[0 ].fundAccessLimitGroups = _fundAccessLimitGroup;
218
+
219
+ // Deploy a project.
220
+ uint256 projectId = launchProjectForTest ();
221
+
222
+ // Keep a reference to the current ruleset.
223
+ JBRuleset memory _ruleset = jbRulesets ().currentOf (projectId);
224
+
225
+ // Make sure the ruleset has a cycle number of 1.
226
+ assertEq (_ruleset.cycleNumber, 1 );
227
+ // Make sure the ruleset's weight matches.
228
+ assertEq (_ruleset.weight, _weight);
229
+
230
+ // Keep a reference to the ruleset's ID.
231
+ uint256 _currentRulesetId = _ruleset.id;
232
+
233
+ // Increment the weight to create a difference.
234
+ _rulesetConfig[0 ].weight = 0 ;
235
+
236
+ // Add a ruleset.
237
+ vm.prank (multisig ());
238
+ _controller.queueRulesetsOf (projectId, _rulesetConfig, "" );
239
+
240
+ // Make sure the current ruleset hasn't changed.
241
+ _ruleset = jbRulesets ().currentOf (projectId);
242
+ assertEq (_ruleset.cycleNumber, 1 );
243
+ assertEq (_ruleset.id, _currentRulesetId);
244
+ assertEq (_ruleset.weight, _weight);
245
+
246
+ // Go to the start of the next ruleset.
247
+ vm.warp (_ruleset.start + _ruleset.duration);
248
+
249
+ // Get the current ruleset.
250
+ JBRuleset memory _newRuleset = jbRulesets ().currentOf (projectId);
251
+
252
+ // It should be the second cycle.
253
+ assertEq (_newRuleset.cycleNumber, 2 );
254
+ assertEq (_newRuleset.weight, 0 );
255
+ assertEq (_newRuleset.basedOnId, _currentRulesetId);
256
+ }
257
+
258
+ function testReconfigureProjectWithWeightOfOne () public {
259
+ // Package a ruleset configuration.
260
+ JBRulesetConfig[] memory _rulesetConfig = new JBRulesetConfig [](1 );
261
+ _rulesetConfig[0 ].mustStartAtOrAfter = 0 ;
262
+ _rulesetConfig[0 ].duration = _RULESET_DURATION;
263
+ _rulesetConfig[0 ].weightCutPercent = 0 ;
264
+ _rulesetConfig[0 ].approvalHook = _deadline;
265
+ _rulesetConfig[0 ].metadata = _metadata;
266
+ _rulesetConfig[0 ].splitGroups = _splitGroup;
267
+ _rulesetConfig[0 ].fundAccessLimitGroups = _fundAccessLimitGroup;
268
+
269
+ // Deploy a project.
270
+ uint256 projectId = launchProjectForTest ();
271
+
272
+ // Keep a reference to the current ruleset.
273
+ JBRuleset memory _ruleset = jbRulesets ().currentOf (projectId);
274
+
275
+ // Make sure the ruleset has a cycle number of 1.
276
+ assertEq (_ruleset.cycleNumber, 1 );
277
+ // Make sure the ruleset's weight matches.
278
+ assertEq (_ruleset.weight, _weight);
279
+
280
+ // Keep a reference to the ruleset's ID.
281
+ uint256 _currentRulesetId = _ruleset.id;
282
+
283
+ // Increment the weight to create a difference.
284
+ _rulesetConfig[0 ].weight = 1 ;
285
+ _rulesetConfig[0 ].weightCutPercent = 1_000_000_000 / 2 ;
286
+ _rulesetConfig[0 ].duration = 1 days ;
287
+
288
+ // Add a ruleset.
289
+ vm.prank (multisig ());
290
+ _controller.queueRulesetsOf (projectId, _rulesetConfig, "" );
291
+
292
+ // Make sure the current ruleset hasn't changed.
293
+ _ruleset = jbRulesets ().currentOf (projectId);
294
+ assertEq (_ruleset.cycleNumber, 1 );
295
+ assertEq (_ruleset.id, _currentRulesetId);
296
+ assertEq (_ruleset.weight, _weight);
297
+ assertEq (_ruleset.weightCutPercent, 0 );
298
+
299
+ // Go to the start of the next ruleset.
300
+ vm.warp (_ruleset.start + _ruleset.duration + 1 days);
301
+
302
+ // Get the current ruleset.
303
+ JBRuleset memory _newRuleset = jbRulesets ().currentOf (projectId);
304
+
305
+ // It should be the second cycle.
306
+ assertEq (_newRuleset.cycleNumber, 3 );
307
+ assertEq (_newRuleset.weight, _weight / 2 );
308
+ assertEq (_newRuleset.basedOnId, _currentRulesetId);
309
+ }
310
+
208
311
function testMultipleQueuedOnCycledOver () public {
209
312
// Keep references to two different weights.
210
313
uint112 _weightFirstQueued = uint112 (1234 * 10 ** 18 );
0 commit comments