Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ jobs:
run: |
make devnet-up
make set-port
make test-deploy-tx
sleep 30
make test-tx
- name: Start preimage server
run: make server-up &
- name: Wait for chain to get ready
Expand Down
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
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ server-up:
--l1=http://localhost:$$L1_GETH_PORT \
--beacon=http://localhost:$$L1_BEACON_PORT \
--l1-chain-config=$$L1_CHAIN_CONFIG \
--initial-claimed-l2=103 \
--initial-claimed-l2=53 \
--ttl=1800 \
--max-preimage-distance=100 \
--purger-interval-seconds=100
Expand All @@ -70,12 +70,18 @@ devnet-down:
@ENCLAVE=$$(kurtosis enclave ls | awk 'NR==2 {print $$1}'); kurtosis enclave rm -f $$ENCLAVE
kurtosis engine stop

PHONY: sync-lock
.PHONY: sync-lock
sync-lock:
cargo update -p kona-client
cd scripts && python sync_lock.py
# Check build
# Downgrade the crate that does not exist in op-rs, which was unnecessarily upgraded by cargo update.
cargo build

.PHONY: test-deploy-tx
test-deploy-tx:
cd tx && npm install && npx hardhat run ./scripts/deploy.js --network eth_local

.PHONY: test-tx
test-tx:
cd tx && npx hardhat run ./scripts/exec.js --network eth_local
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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);
}
}
33 changes: 33 additions & 0 deletions tx/hardhat.config.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require("@nomicfoundation/hardhat-toolbox");
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