Skip to content

Commit

Permalink
chore: fixing sol warnings (#10276)
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind authored Nov 28, 2024
1 parent c22be8b commit 3d113b2
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion l1-contracts/test/Outbox.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ contract OutboxTest is Test {
}
}

function testCheckOutOfBoundsStatus(uint256 _blockNumber, uint256 _leafIndex) public {
function testCheckOutOfBoundsStatus(uint256 _blockNumber, uint256 _leafIndex) public view {
bool outOfBounds = outbox.hasMessageBeenConsumedAtBlockAndIndex(_blockNumber, _leafIndex);
assertFalse(outOfBounds);
}
Expand Down
14 changes: 7 additions & 7 deletions l1-contracts/test/decoders/Decoders.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ contract DecodersTest is DecoderBase {
// The public inputs are computed based of these values, but not directly part of the decoding per say.
}

function testComputeKernelLogsIterationWithoutLogs() public {
function testComputeKernelLogsIterationWithoutLogs() public view {
bytes memory kernelLogsLength = hex"00000004"; // 4 bytes containing value 4
bytes memory iterationLogsLength = hex"00000000"; // 4 empty bytes indicating that length of this iteration's logs is 0
bytes memory encodedLogs = abi.encodePacked(kernelLogsLength, iterationLogsLength);
Expand All @@ -181,7 +181,7 @@ contract DecodersTest is DecoderBase {
assertEq(logsHash, bytes32(0), "Incorrect logs hash");
}

function testComputeKernelLogs1Iteration() public {
function testComputeKernelLogs1Iteration() public view {
// || K_LOGS_LEN | I1_LOGS_LEN | I1_LOGS ||
// K_LOGS_LEN = 4 + 8 = 12 (hex"0000000c")
// I1_LOGS_LEN = 8 (hex"00000008")
Expand Down Expand Up @@ -214,7 +214,7 @@ contract DecodersTest is DecoderBase {
assertEq(logsHash, referenceLogsHash, "Incorrect logs hash");
}

function testComputeKernelLogs2Iterations() public {
function testComputeKernelLogs2Iterations() public view {
// || K_LOGS_LEN | I1_LOGS_LEN | I1_LOGS | I2_LOGS_LEN | I2_LOGS ||
// K_LOGS_LEN = 4 + 8 + 4 + 20 = 36 (hex"00000024")
// I1_LOGS_LEN = 8 (hex"00000008")
Expand Down Expand Up @@ -263,7 +263,7 @@ contract DecodersTest is DecoderBase {
assertEq(logsHash, referenceLogsHashFromIteration2, "Incorrect logs hash");
}

function testComputeKernelLogsMiddleIterationWithoutLogs() public {
function testComputeKernelLogsMiddleIterationWithoutLogs() public view {
// || K_LOGS_LEN | I1_LOGS_LEN | I1_LOGS | I2_LOGS_LEN | I2_LOGS | I3_LOGS_LEN | I3_LOGS ||
// K_LOGS_LEN = 4 + 8 + 4 + 0 + 4 + 20 = 40 (hex"00000028")
// I1_LOGS_LEN = 8 (hex"00000008")
Expand Down Expand Up @@ -319,7 +319,7 @@ contract DecodersTest is DecoderBase {
assertEq(logsHash, referenceLogsHashFromIteration3, "Incorrect logs hash");
}

function testComputeTxOutHash() public {
function testComputeTxOutHash() public view {
// A tx with no msgs should give an out hash of 0
bytes memory encodedMsgs = abi.encodePacked(hex"00");
bytes32 outHash = txsHelper.computeTxOutHash(encodedMsgs);
Expand All @@ -334,7 +334,7 @@ contract DecodersTest is DecoderBase {
assertEq(outHash, expectedOutHash, "Incorrect tx out hash");
}

function testTxsDecoderCorrectlyComputesNumTxEffectsToPad() public {
function testTxsDecoderCorrectlyComputesNumTxEffectsToPad() public view {
// Minimum num txs is 2 so when there are no real txs we need to pad to 2
uint32 numTxEffects = 0;
uint32 paddedNumTxEffects = txsHelper.computeNumTxEffectsToPad(numTxEffects);
Expand All @@ -353,7 +353,7 @@ contract DecodersTest is DecoderBase {
assertEq(paddedNumTxEffects, 0, "Incorrect number of tx effects to pad");
}

function testTxsDecoderCorrectlyComputesNumMsgsToPad() public {
function testTxsDecoderCorrectlyComputesNumMsgsToPad() public view {
uint32 numMsgs = 0;
uint32 numMsgsToPad = txsHelper.computeNumMsgsToPad(numMsgs);
assertEq(numMsgsToPad, 1, "Incorrect number of msgs to pad");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {RegistryBase} from "./Base.t.sol";
import {DataStructures} from "@aztec/governance/libraries/DataStructures.sol";

contract GetCurrentSnapshotTest is RegistryBase {
function test_GivenOneListedRollup() external {
function test_GivenOneListedRollup() external view {
// it should return the newest
DataStructures.RegistrySnapshot memory snapshot = registry.getCurrentSnapshot();
assertEq(snapshot.blockNumber, block.number);
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/test/governance/registry/getRollup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity >=0.8.27;
import {RegistryBase} from "./Base.t.sol";

contract GetRollupTest is RegistryBase {
function test_GivenOneListedRollup() external {
function test_GivenOneListedRollup() external view {
// it should return the newest
assertEq(registry.getRollup(), address(0xdead));
}
Expand Down
8 changes: 6 additions & 2 deletions l1-contracts/test/governance/registry/getSnapshot.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ contract GetSnapshotTest is RegistryBase {
_;
}

function test_When_versionExists() external givenMultipleListedRollups {
function test_When_versionExists() external view givenMultipleListedRollups {
// it should return the snapshot

DataStructures.RegistrySnapshot memory snapshot = registry.getSnapshot(0);
Expand All @@ -19,7 +19,11 @@ contract GetSnapshotTest is RegistryBase {
assertEq(registry.numberOfVersions(), 1);
}

function test_When_versionDoesNotExists(uint256 _version) external givenMultipleListedRollups {
function test_When_versionDoesNotExists(uint256 _version)
external
view
givenMultipleListedRollups
{
// it should return empty snapshot

uint256 version = bound(_version, 1, type(uint256).max);
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/test/governance/registry/getVersionFor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ contract GetVersionForTest is RegistryBase {
_;
}

function test_When_rollupIs0xdead() external givenNoAdditionalListedRollups {
function test_When_rollupIs0xdead() external view givenNoAdditionalListedRollups {
// it should return 0
assertEq(registry.getVersionFor(address(0xdead)), 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ contract IsRollupRegisteredTest is RegistryBase {
_;
}

function test_When_rollupIs0xdead() external givenNoAdditionalListedRollups {
function test_When_rollupIs0xdead() external view givenNoAdditionalListedRollups {
// it should return true
assertTrue(registry.isRollupRegistered(address(0xdead)));
}

function test_When_rollupNot0xdead(address _rollup) external givenNoAdditionalListedRollups {
function test_When_rollupNot0xdead(address _rollup) external view givenNoAdditionalListedRollups {
// it should return false
vm.assume(_rollup != address(0xdead));
assertFalse(registry.isRollupRegistered(_rollup));
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/test/merkle/TestUtil.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ contract MerkleTestUtil is Test {
return (2 ** height) != originalNumber ? ++height : height;
}

function testCalculateTreeHeightFromSize() external {
function testCalculateTreeHeightFromSize() external pure {
assertEq(calculateTreeHeightFromSize(0), 1);
assertEq(calculateTreeHeightFromSize(1), 1);
assertEq(calculateTreeHeightFromSize(2), 1);
Expand Down
12 changes: 6 additions & 6 deletions l1-contracts/test/merkle/UnbalancedMerkle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract UnbalancedMerkleTest is Test {
txsHelper = new TxsDecoderHelper();
}

function testDecomp() public {
function testDecomp() public view {
// Worst case - max num txs
uint32 numTxs = 65535;
(uint256 min, uint256 max) = txsHelper.computeMinMaxPathLength(numTxs);
Expand Down Expand Up @@ -62,7 +62,7 @@ contract UnbalancedMerkleTest is Test {
// root
// / \
// base base
function testComputeTxsEffectsHash2() public {
function testComputeTxsEffectsHash2() public view {
// Generate some base leaves
bytes32[] memory baseLeaves = new bytes32[](2);
for (uint256 i = 0; i < 2; i++) {
Expand All @@ -84,7 +84,7 @@ contract UnbalancedMerkleTest is Test {
// / \
// base base

function testComputeTxsEffectsHash3() public {
function testComputeTxsEffectsHash3() public view {
// Generate some base leaves
bytes32[] memory baseLeaves = new bytes32[](3);
for (uint256 i = 0; i < 3; i++) {
Expand All @@ -109,7 +109,7 @@ contract UnbalancedMerkleTest is Test {
// merge merge
// / \ / \
// base base base base
function testComputeTxsEffectsHash5() public {
function testComputeTxsEffectsHash5() public view {
// Generate some base leaves
bytes32[] memory baseLeaves = new bytes32[](5);
for (uint256 i = 0; i < 5; i++) {
Expand Down Expand Up @@ -139,7 +139,7 @@ contract UnbalancedMerkleTest is Test {
// merge1 merge2 base base
// / \ / \
// base base base base
function testComputeTxsEffectsHash6() public {
function testComputeTxsEffectsHash6() public view {
// Generate some base leaves
bytes32[] memory baseLeaves = new bytes32[](6);
for (uint256 i = 0; i < 6; i++) {
Expand Down Expand Up @@ -171,7 +171,7 @@ contract UnbalancedMerkleTest is Test {
// merge1 merge2 merge4 base
// / \ / \ / \
// base base base base base base
function testComputeTxsEffectsHash7() public {
function testComputeTxsEffectsHash7() public view {
// Generate some base leaves
bytes32[] memory baseLeaves = new bytes32[](7);
for (uint256 i = 0; i < 6; i++) {
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/test/sparta/Sampling.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ contract Sampler {
contract SamplingTest is Test {
Sampler sampler = new Sampler();

function testShuffle() public {
function testShuffle() public view {
// Sizes pulled out of thin air
uint256 setSize = 1024;
uint256 commiteeSize = 32;
Expand Down

0 comments on commit 3d113b2

Please sign in to comment.