Skip to content

Commit

Permalink
Merge pull request #6152 from ethereum-optimism/fix/lib-position-lint
Browse files Browse the repository at this point in the history
contracts-bedrock: lint lib position tests
  • Loading branch information
tynes authored Jun 26, 2023
2 parents 33528ef + cbdbd8e commit 9087460
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ LegacyERC20ETH_Test:test_mint_doesNotExist_reverts() (gas: 10627)
LegacyERC20ETH_Test:test_transferFrom_doesNotExist_reverts() (gas: 12957)
LegacyERC20ETH_Test:test_transfer_doesNotExist_reverts() (gas: 10755)
LegacyMessagePasser_Test:test_passMessageToL1_succeeds() (gas: 34524)
LibPosition_Test:test_pos_correctness_succeeds() (gas: 38711)
LibPosition_Test:test_pos_correctness_succeeds() (gas: 38689)
MerkleTrie_get_Test:test_get_corruptedProof_reverts() (gas: 5736)
MerkleTrie_get_Test:test_get_extraProofElements_reverts() (gas: 58975)
MerkleTrie_get_Test:test_get_invalidDataRemainder_reverts() (gas: 35852)
Expand Down
16 changes: 8 additions & 8 deletions packages/contracts-bedrock/contracts/test/LibPosition.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ contract LibPosition_Test is Test {
}

/// @notice Tests that the `depth` function correctly shifts out the `depth` from a packed `Position` type.
function testFuzz_depth_correctness_suceeds(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_depth_correctness_succeeds(uint8 _depth, uint64 _indexAtDepth) public {
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
Position position = LibPosition.wrap(_depth, _indexAtDepth);
assertEq(position.depth(), _depth);
}

/// @notice Tests that the `indexAtDepth` function correctly shifts out the `indexAtDepth` from a packed `Position` type.
function testFuzz_indexAtDepth_correctness_suceeds(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_indexAtDepth_correctness_succeeds(uint8 _depth, uint64 _indexAtDepth) public {
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
Position position = LibPosition.wrap(_depth, _indexAtDepth);
assertEq(position.indexAtDepth(), _indexAtDepth);
}

/// @notice Tests that the `left` function correctly computes the position of the left child.
function testFuzz_left_correctness_suceeds(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_left_correctness_succeeds(uint8 _depth, uint64 _indexAtDepth) public {
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);

Expand All @@ -50,7 +50,7 @@ contract LibPosition_Test is Test {
}

/// @notice Tests that the `right` function correctly computes the position of the right child.
function testFuzz_right_correctness_suceeds(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_right_correctness_succeeds(uint8 _depth, uint64 _indexAtDepth) public {
// Depth bound: [0, 63]
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
Expand All @@ -63,7 +63,7 @@ contract LibPosition_Test is Test {
}

/// @notice Tests that the `parent` function correctly computes the position of the parent.
function testFuzz_parent_correctness_suceeds(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_parent_correctness_succeeds(uint8 _depth, uint64 _indexAtDepth) public {
_depth = uint8(bound(_depth, 1, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);

Expand All @@ -76,7 +76,7 @@ contract LibPosition_Test is Test {

/// @notice Tests that the `rightIndex` function correctly computes the deepest, right most index relative
/// to a given position.
function testFuzz_rightIndex_correctness_suceeds(
function testFuzz_rightIndex_correctness_succeeds(
uint64 _maxDepth,
uint8 _depth,
uint64 _indexAtDepth
Expand All @@ -102,7 +102,7 @@ contract LibPosition_Test is Test {
/// @notice Tests that the `attack` function correctly computes the position of the attack relative to
/// a given position.
/// @dev `attack` is an alias for `left`, but we test it separately for completeness.
function testFuzz_attack_correctness_suceeds(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_attack_correctness_succeeds(uint8 _depth, uint64 _indexAtDepth) public {
// Depth bound: [0, 63]
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
Expand All @@ -118,7 +118,7 @@ contract LibPosition_Test is Test {
/// a given position.
/// @dev A defense can only be given if the position does not belong to the root claim, hence the bound of [1, 127]
/// on the depth.
function testFuzz_defend_correctness_suceeds(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_defend_correctness_succeeds(uint8 _depth, uint64 _indexAtDepth) public {
// Depth bound: [1, 63]
_depth = uint8(bound(_depth, 1, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
Expand Down

0 comments on commit 9087460

Please sign in to comment.