Skip to content

Commit

Permalink
(test): Add unit test for size of ToS constructor address lists
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkaseman committed Jan 19, 2024
1 parent 48413a2 commit 19e29d9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController,
// | Initialization |
// ================================================================

/// @dev Initial allowed senders & blocked senders have a combined limit of around 500k addresses
/// Beyond that, migrations will need to handled in batches
constructor(
TermsOfServiceAllowListConfig memory config,
address[] memory initialAllowedSenders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,33 @@ import "forge-std/Vm.sol";

/// @notice #constructor
contract FunctionsTermsOfServiceAllowList_Constructor is FunctionsRoutesSetup {
uint256 internal constant initalSendersEntries = 100000; // ~500k limit, keeping lower for test speed
address[] internal s_initialAllowedSenders;
address[] internal s_initialBlockedSenders;

function setUp() public virtual override {
FunctionsRoutesSetup.setUp();

for (uint256 i = 1; i <= initalSendersEntries; ++i) {
s_initialAllowedSenders.push(vm.addr(i));
}
}

function test_Constructor_Success() public {
assertEq(s_termsOfServiceAllowList.typeAndVersion(), "Functions Terms of Service Allow List v1.1.0");
assertEq(s_termsOfServiceAllowList.owner(), OWNER_ADDRESS);
}

function test_Constructor_InitializationSuccess() public {

TermsOfServiceAllowList _termsOfServiceAllowList = new TermsOfServiceAllowList(
getTermsOfServiceConfig(),
s_initialAllowedSenders,
s_initialBlockedSenders
);

assertEq(_termsOfServiceAllowList.getAllowedSendersCount(), initalSendersEntries);
}
}

/// @notice #getConfig
Expand Down

0 comments on commit 19e29d9

Please sign in to comment.