Skip to content

Commit

Permalink
lint: run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
QEDK committed Dec 19, 2023
1 parent ab7afa9 commit 70db33d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 28 deletions.
33 changes: 13 additions & 20 deletions test/AvailBridgeTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ contract AvailBridgeTest is Test {
assertEq(to.balance, balance + amount);
}

function test_receiveERC20(bytes32 rangeHash, bytes32 assetId, bytes32 from, address to, uint256 amount, uint64 messageId) external {
function test_receiveERC20(
bytes32 rangeHash,
bytes32 assetId,
bytes32 from,
address to,
uint256 amount,
uint64 messageId
) external {
vm.assume(amount != 0 && to != address(0) && to != address(bridge));
ERC20Mock token = new ERC20Mock();
token.mint(address(bridge), amount);
Expand All @@ -108,15 +115,8 @@ contract AvailBridgeTest is Test {
tokenArr[0] = address(token);
vm.prank(owner);
bridge.updateTokens(assetIdArr, tokenArr);
AvailBridge.Message memory message = AvailBridge.Message(
0x02,
from,
bytes32(bytes20(to)),
1,
2,
abi.encode(assetId, amount),
messageId
);
AvailBridge.Message memory message =
AvailBridge.Message(0x02, from, bytes32(bytes20(to)), 1, 2, abi.encode(assetId, amount), messageId);
bytes32 messageHash = keccak256(abi.encode(message));
bytes32 dataRoot = keccak256(abi.encode(bytes32(0), messageHash));

Expand All @@ -133,18 +133,11 @@ contract AvailBridgeTest is Test {
}

function test_sendAVL(address from, bytes32 to, uint256 amount) external {
vm.assume(from != address(0) && to != bytes32(0) && amount != 0 && from != address(admin));
vm.assume(from != address(0) && to != bytes32(0) && amount != 0 && from != address(admin));
vm.prank(address(bridge));
avail.mint(from, amount);
AvailBridge.Message memory message = AvailBridge.Message(
0x02,
bytes32(bytes20(from)),
to,
2,
1,
abi.encode(bytes32(0), amount),
0
);
AvailBridge.Message memory message =
AvailBridge.Message(0x02, bytes32(bytes20(from)), to, 2, 1, abi.encode(bytes32(0), amount), 0);
vm.expectCall(address(avail), abi.encodeCall(avail.burn, (from, amount)));
vm.prank(from);
bridge.sendAVL(to, amount);
Expand Down
19 changes: 11 additions & 8 deletions test/Merkle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ contract MerkleTest is Test, MurkyBase {
assertFalse(merkleUser.checkMembership(randomDataHash, index, leaf, proof));
}

function testCheckMembership(bytes32[] memory leaves, uint256 index, uint256 wrongIndex, bytes32 wrongRoot) external {
function testCheckMembership(bytes32[] memory leaves, uint256 index, uint256 wrongIndex, bytes32 wrongRoot)
external
{
vm.assume(leaves.length > 1 && index < leaves.length && wrongIndex != index);
bytes32 root = getRoot(leaves);
vm.assume(wrongRoot != root);
Expand All @@ -56,7 +58,9 @@ contract MerkleTest is Test, MurkyBase {
assertFalse(merkleUser.checkMembership(randomDataHash, wrongIndex, wrongRoot, proof));
}

function testCheckMembershipLargeTree(bytes32[] memory leaves, uint256 index, uint256 wrongIndex, bytes32 wrongRoot) external {
function testCheckMembershipLargeTree(bytes32[] memory leaves, uint256 index, uint256 wrongIndex, bytes32 wrongRoot)
external
{
vm.assume(leaves.length > 1 && index < leaves.length && wrongIndex != index);
bytes32 root = getRoot(leaves);
vm.assume(wrongRoot != root);
Expand Down Expand Up @@ -84,12 +88,11 @@ contract MerkleTest is Test, MurkyBase {
//////////////////////////////////////////////////////////////////////////*/

contract MerkleUser {
function checkMembership(
bytes32 leaf,
uint256 index,
bytes32 rootHash,
bytes32[] calldata proof
) external pure returns (bool) {
function checkMembership(bytes32 leaf, uint256 index, bytes32 rootHash, bytes32[] calldata proof)
external
pure
returns (bool)
{
bool r = Merkle.verify(proof, rootHash, index, leaf);
return r;
}
Expand Down

0 comments on commit 70db33d

Please sign in to comment.