-
Notifications
You must be signed in to change notification settings - Fork 0
Add transaction with precompiled test #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,3 +28,7 @@ target/ | |
| chain | ||
| .preimage | ||
| .finalized_l1 | ||
| node_modules | ||
| tx/hardhat.config.js | ||
| !package.json | ||
| !package-lock.json | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| test-deploy-tx: | ||
| cd tx && 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 | ||
yoshidan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 | ||||||||
yoshidan marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| * @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); | ||||||||
|
||||||||
| address recovered = ecrecover(hash, v, r, s); | |
| address recovered = ecrecover(hash, v, r, s); | |
| require(recovered != address(0), "Invalid signature"); |
| 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' | ||
yoshidan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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" | ||
| }, | ||
| } | ||
| } | ||
| } | ||
|
||
There was a problem hiding this comment.
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.).