Skip to content

Commit

Permalink
bump hardhat and reduce lint warnings (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
thedarkjester authored Dec 16, 2024
1 parent 89c048b commit eafe687
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 178 deletions.
3 changes: 2 additions & 1 deletion contracts/.solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"reason-string": "off",
"check-send-result": "off",
"no-unused-import": ["error"],
"gas-custom-errors": "off"
"gas-custom-errors": "off",
"no-complex-fallback": "off"
}
}
4 changes: 3 additions & 1 deletion contracts/.solhintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
lib/forge-std
contracts/test-contracts
test/foundry
test/foundry
/contracts/proxies
/contracts/tokenBridge/mocks
10 changes: 7 additions & 3 deletions contracts/contracts/lib/CallForwardingProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@ pragma solidity 0.8.26;
*/
contract CallForwardingProxy {
/// @notice The underlying target address that is called.
address public immutable target;
address public immutable TARGET;

constructor(address _target) {
target = _target;
TARGET = _target;
}

/**
* @notice Defaults to, and forwards all calls to the target address.
*/
fallback() external payable {
(bool success, bytes memory data) = target.call{ value: msg.value }(msg.data);
(bool success, bytes memory data) = TARGET.call{ value: msg.value }(msg.data);
require(success, "Call failed");

assembly {
return(add(data, 0x20), mload(data))
}
}

receive() external payable {
revert("ETH not accepted");
}
}
3 changes: 3 additions & 0 deletions contracts/contracts/test-contracts/RevertingVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ contract RevertingVerifier is IPlonkVerifier {
while (usingGas) {
usingGas = true;
}

// silencing the warning - this needs to be external to consume gas.
scenario = Scenario.GAS_GUZZLE;
}

// defaults to EMPTY_REVERT scenario
Expand Down
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"dotenv": "16.4.5",
"edit-json-file": "1.8.0",
"ethers": "6.12.0",
"hardhat": "2.22.11",
"hardhat": "2.22.17",
"hardhat-deploy": "0.12.4",
"hardhat-storage-layout": "0.1.7",
"hardhat-tracer": "2.8.2",
Expand Down
12 changes: 12 additions & 0 deletions contracts/test/LineaRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2454,6 +2454,18 @@ describe("Linea Rollup contract", () => {
);
});

it("Should fail to accept ETH on the CallForwardingProxy receive function", async () => {
await deployCallForwardingProxy(await lineaRollupV5.getAddress());
const forwardingProxyAddress = await callForwardingProxy.getAddress();

const tx = {
to: forwardingProxyAddress,
value: ethers.parseEther("0.1"),
};

await expectRevertWithReason(admin.sendTransaction(tx), "ETH not accepted");
});

it("Should be able to submit blobs and finalize via callforwarding proxy", async () => {
// Deploy callforwarding proxy
await deployCallForwardingProxy(await lineaRollupV5.getAddress());
Expand Down
320 changes: 148 additions & 172 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

0 comments on commit eafe687

Please sign in to comment.