Skip to content
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

SIP-369 #2138

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

SIP-369 #2138

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ contract RewardsManagerModule is IRewardsManagerModule {
using Distribution for Distribution.Data;
using RewardDistribution for RewardDistribution.Data;

uint256 private constant _MAX_REWARD_DISTRIBUTIONS = 10;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make sure when we remove const here won't this change data structure and potentially lead to storage slot collisions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is in the module (not an object in a storage library), so I don't think it could have any impact.

Copy link
Member

@mjlescano mjlescano May 21, 2024

Choose a reason for hiding this comment

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

Confirming:

The compiler does not reserve a storage slot for these variables, and every occurrence is replaced by the respective value.

More info: https://docs.soliditylang.org/en/latest/contracts.html#constants


bytes32 private constant _CLAIM_FEATURE_FLAG = "claimRewards";

/**
Expand All @@ -53,11 +51,6 @@ contract RewardsManagerModule is IRewardsManagerModule {
revert AccessError.Unauthorized(ERC2771Context._msgSender());
}

// Limit the maximum amount of rewards distributors can be connected to each vault to prevent excessive gas usage on other calls
if (rewardIds.length() > _MAX_REWARD_DISTRIBUTIONS) {
revert ParameterError.InvalidParameter("index", "too large");
}

if (
!ERC165Helper.safeSupportsInterface(distributor, type(IRewardDistributor).interfaceId)
) {
Expand Down