-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
queue multiple fcs #52
base: main
Are you sure you want to change the base?
Conversation
mejango
commented
Aug 21, 2023
- multiple FC's per block (fc.configuration gets incremented if made during same block)
- can't override Approved reconfiguration if it has a ballot
…s with multiple reconfigurations
Reviewing this and debugging the failed test. |
For the failed test here, it looks like before that configurations would be overwritten during a rolled-over cycle. Now that isn't the case, so I've rewritten testMultipleReconfigurationOnRolledOver() to follow the new logic (also, please tell me if there is a better way to propose changes to a file outside the scope of a PR.. I feel like I would have to push changes over your branch, no?) juice-contracts-v3/forge_tests/TestReconfigure.sol Lines 122 to 198 in 5ae86db
Becomes function testMultipleReconfigurationOnRolledOver() public {
uint256 weightFirstReconfiguration = 1234 * 10 ** 18;
uint256 weightSecondReconfiguration = 6969 * 10 ** 18;
uint256 projectId = controller.launchProjectFor(
multisig(),
_projectMetadata,
_data,
_metadata,
0, // Start asap
_groupedSplits,
_fundAccessConstraints,
_terminals,
""
);
JBFundingCycle memory fundingCycle = jbFundingCycleStore().currentOf(projectId);
// Initial funding cycle data
assertEq(fundingCycle.number, 1);
assertEq(fundingCycle.weight, _data.weight);
uint256 currentConfiguration = fundingCycle.configuration;
// Jump to FC+1, rolled over
vm.warp(block.timestamp + fundingCycle.duration);
// First reconfiguration
vm.prank(multisig());
controller.reconfigureFundingCyclesOf(
projectId,
JBFundingCycleData({duration: 6 days, weight: weightFirstReconfiguration, discountRate: 0, ballot: _ballot}), // 3days ballot
_metadata,
0, // Start asap
_groupedSplits,
_fundAccessConstraints,
""
);
uint256 firstReconfiguration = block.timestamp;
vm.warp(block.timestamp + 1); // Avoid overwrite
// Second reconfiguration (different configuration)
vm.prank(multisig());
controller.reconfigureFundingCyclesOf(
projectId,
JBFundingCycleData({duration: 6 days, weight: weightSecondReconfiguration, discountRate: 0, ballot: _ballot}), // 3days ballot
_metadata,
0, // Start asap
_groupedSplits,
_fundAccessConstraints,
""
);
uint256 secondReconfiguration = block.timestamp;
// Shouldn't have changed, still in FC#2, rolled over from FC#1
fundingCycle = jbFundingCycleStore().currentOf(projectId);
assertEq(fundingCycle.number, 2);
assertEq(fundingCycle.configuration, currentConfiguration);
assertEq(fundingCycle.weight, _data.weight);
// Jump to after the ballot passed, but before the next FC
vm.warp(fundingCycle.start + fundingCycle.duration - 1);
// Queued should be the first reconfiguration
JBFundingCycle memory queuedFirstReconfigFundingCycle = jbFundingCycleStore().queuedOf(projectId);
assertEq(queuedFirstReconfigFundingCycle.number, 3);
assertEq(queuedFirstReconfigFundingCycle.configuration, firstReconfiguration);
assertEq(queuedFirstReconfigFundingCycle.weight, weightFirstReconfiguration);
vm.warp(fundingCycle.start + fundingCycle.duration);
// First reconfiguration should now be the current one
JBFundingCycle memory newlyActiveFirstReconfigFundingCycle = jbFundingCycleStore().currentOf(projectId);
assertEq(newlyActiveFirstReconfigFundingCycle.number, 3);
assertEq(newlyActiveFirstReconfigFundingCycle.configuration, firstReconfiguration);
assertEq(newlyActiveFirstReconfigFundingCycle.weight, weightFirstReconfiguration);
// Queued should now be the second reconfiguration
JBFundingCycle memory queuedSecondReconfigFundingCycle = jbFundingCycleStore().queuedOf(projectId);
assertEq(queuedSecondReconfigFundingCycle.configuration, secondReconfiguration);
assertEq(queuedSecondReconfigFundingCycle.weight, weightSecondReconfiguration);
// Warp to when second reconfig becomes active
vm.warp(queuedSecondReconfigFundingCycle.start + fundingCycle.duration);
// currentOf and queuedOf should match here as it will use the last configured base cycle
JBFundingCycle memory newlyActiveSecondReconfigFundingCycle = jbFundingCycleStore().currentOf(projectId);
assertEq(newlyActiveSecondReconfigFundingCycle.configuration, secondReconfiguration);
assertEq(newlyActiveSecondReconfigFundingCycle.weight, weightSecondReconfiguration);
// Queued should be the last base cycle carried over
JBFundingCycle memory queuedBaseFCFromSecondReconfig = jbFundingCycleStore().queuedOf(projectId);
assertEq(queuedBaseFCFromSecondReconfig.configuration, secondReconfiguration);
assertEq(queuedBaseFCFromSecondReconfig.weight, weightSecondReconfiguration);
} |
A PR against this PR would be ideal, unless you want write access directly to it. |
This reverts commit 1154b6d.
Queued FCs & JBController3_2 tests