Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ target/
chain
.preimage
.finalized_l1
node_modules
tx/hardhat.config.js
!package.json
!package-lock.json
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,10 @@ sync-lock:
# Downgrade the crate that does not exist in op-rs, which was unnecessarily upgraded by cargo update.
cargo build

PHONY: test-deploy-tx
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing dot before PHONY declaration. Should be ".PHONY:" instead of "PHONY:". This is consistent with other target declarations in the file (e.g., lines 3, 16, 20, 29, etc.).

Copilot uses AI. Check for mistakes.
test-deploy-tx:
cd tx && npx hardhat run ./scripts/deploy.js --network eth_local

PHONY: test-tx
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing dot before PHONY declaration. Should be ".PHONY:" instead of "PHONY:". This is consistent with other target declarations in the file (e.g., lines 3, 16, 20, 29, etc.).

Copilot uses AI. Check for mistakes.
test-tx:
cd tx && npx hardhat run ./scripts/exec.js --network eth_local
2 changes: 2 additions & 0 deletions scripts/port.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ hostPort "op-cl-" 8547 l2RollupPort
hostPort "op-el-" 8545 l2GethPort

echo "{\"l1BeaconPort\": ${l1BeaconPort}, \"l1GethPort\": ${l1GethPort}, \"l2RollupPort\": ${l2RollupPort}, \"l2GethPort\": ${l2GethPort}}" | jq > hostPort.json
sed "s/L2_GETH_PORT/${l2GethPort}/g" "$(dirname "$0")/../tx/hardhat.config.template" > "$(dirname "$0")/../tx/hardhat.config.js"

cat hostPort.json
23 changes: 23 additions & 0 deletions tx/contracts/App.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.28;

contract App {
event Recovered(address indexed recovered);

/**
* @notice Recover the signer address from the signature
* @dev Example values for "Hello World" signed by Hardhat default account #0 (0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266):
* hash: 0x592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba (ethers.hashMessage("Hello World"))
* v: 28
* r: 0x79401886bc9cd29ba8771488c9f5d140e5318858e7ce63346b9a244498308479
* s: 0x2289c09c1221545645ba36e4f32997843076bd314731b7454f73315a0c309869
* @param hash The hash of the signed message (e.g. keccak256("\x19Ethereum Signed Message:\n" + len(msg) + msg))
* @param v The recovery id
* @param r The first 32 bytes of the signature
* @param s The second 32 bytes of the signature
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) external {
address recovered = ecrecover(hash, v, r, s);
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handling does not account for potential failures when retrieving the recovered address. The ecrecover precompile returns the zero address (0x0000000000000000000000000000000000000000) when signature verification fails. Consider checking if the recovered address is the zero address and either reverting or emitting a different event to indicate failure.

Suggested change
address recovered = ecrecover(hash, v, r, s);
address recovered = ecrecover(hash, v, r, s);
require(recovered != address(0), "Invalid signature");

Copilot uses AI. Check for mistakes.
emit Recovered(recovered);
}
}
6 changes: 6 additions & 0 deletions tx/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[profile.default]
src = 'contracts'
out = 'out'
libs = ['node_modules', 'lib']
test = 'test'
cache_path = 'cache_forge'
34 changes: 34 additions & 0 deletions tx/hardhat.config.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require("@nomicfoundation/hardhat-toolbox");
require("@nomicfoundation/hardhat-foundry");
require("@openzeppelin/hardhat-upgrades");
require("hardhat-contract-sizer");

/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: {
compilers: [
{
version: "0.8.28",
settings: {
evmVersion: "cancun",
viaIR: true,
optimizer: {
enabled: true,
runs: 9_999_999
}
}
}
],
},
networks: {
eth_local: {
url: 'http://localhost:L2_GETH_PORT',
accounts: {
mnemonic: "test test test test test test test test test test test junk",
path: "m/44'/60'/0'/0"
},
}
}
}
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing blank line at the end of the file. Consider adding a trailing newline for consistency with standard file formatting conventions.

Copilot uses AI. Check for mistakes.
Loading
Loading