Skip to content

Commit

Permalink
Enable explicit type checking in solhint (matter-labs#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnkolegov authored and matzayonc committed Mar 27, 2024
1 parent 0601c94 commit 30575a2
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"max-states-count": "off",
"no-global-import": "error",
"no-unused-import": "error",
"explicit-types": "error",
"compiler-version": ["warn", "^0.8.0"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ contract DummySharedBridge {
amount = amountReturnInFinalizeWithdrawal;
}

event Debugger(uint);
event Debugger(uint256);

function bridgehubDepositBaseToken(
uint256 _chainId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract applyL1ToL2AliasTest is AddressAliasHelperSharedTest {
0x1111000000000000000000000000081759a885c4
];

for (uint i; i < l1Addresses.length; i++) {
for (uint256 i; i < l1Addresses.length; i++) {
address l2Address = addressAliasHelper.applyL1ToL2Alias(l1Addresses[i]);

assertEq(l2Address, l2ExpectedAddresses[i], "L1 to L2 address conversion is not correct");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract undoL1ToL2AliasTest is AddressAliasHelperSharedTest {
0x0000000000000000000000000000081759a874B3
];

for (uint i; i < l2Addresses.length; i++) {
for (uint256 i; i < l2Addresses.length; i++) {
address l1Address = addressAliasHelper.undoL1ToL2Alias(l2Addresses[i]);

assertEq(l1Address, l1ExpectedAddresses[i], "L2 to L1 address conversion is not correct");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ contract ExperimentalBridgeTest is Test {
function _restrictArraySize(bytes[] memory longArray, uint256 newSize) internal pure returns (bytes[] memory) {
bytes[] memory shortArray = new bytes[](newSize);

for (uint i; i < newSize; i++) {
for (uint256 i; i < newSize; i++) {
shortArray[i] = longArray[i];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {PriorityQueueSharedTest} from "./_PriorityQueue_Shared.t.sol";
import {PriorityOperation} from "solpp/dev-contracts/test/PriorityQueueTest.sol";

contract PopOperationsTest is PriorityQueueSharedTest {
uint public constant NUMBER_OPERATIONS = 10;
uint256 public constant NUMBER_OPERATIONS = 10;

function setUp() public {
push_mock_entries(NUMBER_OPERATIONS);
Expand Down Expand Up @@ -38,7 +38,7 @@ contract PopOperationsTest is PriorityQueueSharedTest {
}

function test_pop_until_limit() public {
for (uint i = 0; i < NUMBER_OPERATIONS; ++i) {
for (uint256 i = 0; i < NUMBER_OPERATIONS; ++i) {
PriorityOperation memory front = priorityQueue.popFront();
assertEq(keccak256(abi.encode(i)), front.canonicalTxHash);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {PriorityQueueSharedTest} from "./_PriorityQueue_Shared.t.sol";
import {PriorityOperation} from "solpp/dev-contracts/test/PriorityQueueTest.sol";

contract PushOperationsTest is PriorityQueueSharedTest {
uint public constant NUMBER_OPERATIONS = 10;
uint256 public constant NUMBER_OPERATIONS = 10;

function setUp() public {
push_mock_entries(NUMBER_OPERATIONS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ contract PriorityQueueSharedTest is Test {
}

// Pushes 'count' entries into the priority queue.
function push_mock_entries(uint count) public {
for (uint i = 0; i < count; ++i) {
function push_mock_entries(uint256 count) public {
for (uint256 i = 0; i < count; ++i) {
PriorityOperation memory dummyOp = PriorityOperation({
canonicalTxHash: keccak256(abi.encode(i)),
expirationTimestamp: uint64(i),
Expand Down
2 changes: 1 addition & 1 deletion system-contracts/contracts/test-contracts/KeccakTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract KeccakTest {

// Just some computation-heavy function, it will be used to test out of gas
function infiniteFuction(uint256 n) public pure returns (uint256 sumOfSquares) {
for (uint i = 0; i < n; i++) {
for (uint256 i = 0; i < n; i++) {
sumOfSquares += i * i;
}
}
Expand Down

0 comments on commit 30575a2

Please sign in to comment.