Skip to content

stop accumulating fees on parent after fork#46

Open
KillariDev wants to merge 2 commits intomainfrom
stop-accumulating-fees-after-fork
Open

stop accumulating fees on parent after fork#46
KillariDev wants to merge 2 commits intomainfrom
stop-accumulating-fees-after-fork

Conversation

@KillariDev
Copy link
Collaborator

No description provided.

@KillariDev KillariDev requested a review from MicahZoltu January 30, 2026 09:56
Copy link
Member

@MicahZoltu MicahZoltu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending response or change related to the feeEndDate comment.

uint256 clampedLastUpdatedFeeAccumulator = lastUpdatedFeeAccumulator > endTime ? endTime : lastUpdatedFeeAccumulator;
uint256 timeDelta = clampedCurrentTimestamp - clampedLastUpdatedFeeAccumulator;
uint256 feeEndDate = forkTime == 0 ? endTime : forkTime;
uint256 clampedCurrentTimestamp = block.timestamp > feeEndDate ? endTime : block.timestamp;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want feeEndDate here?

Suggested change
uint256 clampedCurrentTimestamp = block.timestamp > feeEndDate ? endTime : block.timestamp;
uint256 clampedCurrentTimestamp = block.timestamp > feeEndDate ? feeEndDate : block.timestamp;

Separately, I find it more clear when the first item in the comparison is the if and the second is the else:

Suggested change
uint256 clampedCurrentTimestamp = block.timestamp > feeEndDate ? endTime : block.timestamp;
uint256 clampedCurrentTimestamp = feeEndDate < block.timestamp ? feeEndDate : block.timestamp;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If solidity supports function inlining in its optimizer, then there may be value in creating a min function and using that instead for better code clarity.

feeIndex += delta * SecurityPoolUtils.PRICE_PRECISION / securityBondAllowance;
completeSetCollateralAmount = newCompleteSetCollateralAmount;
lastUpdatedFeeAccumulator = block.timestamp;
lastUpdatedFeeAccumulator = block.timestamp > feeEndDate ? feeEndDate : block.timestamp;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style preference (same reasoning as above):

Suggested change
lastUpdatedFeeAccumulator = block.timestamp > feeEndDate ? feeEndDate : block.timestamp;
lastUpdatedFeeAccumulator = feeEndDate < block.timestamp ? feeEndDate : block.timestamp;

Base automatically changed from can-fork-the-pool-even-if-there's-0-rep to main February 2, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants