Skip to content

Commit

Permalink
init bls verify
Browse files Browse the repository at this point in the history
  • Loading branch information
guoshijiang committed Dec 19, 2024
1 parent 2e0a1ad commit c02944f
Show file tree
Hide file tree
Showing 20 changed files with 1,093 additions and 44 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Show Forge version
run: |
forge --version
- name: Run Forge fmt
run: |
forge fmt --check
id: fmt

- name: Run Forge build
run: |
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test
33 changes: 12 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Compiler files
cache/
out/

# Test binary, built with `go test -c`
*.test
# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Docs
docs/

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
go.work.sum

# env file
# Dotenv file
.env
./lib
.idea
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

68 changes: 66 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,66 @@
# opl2-fp-contracts
Fast Finality Contracts for OpStack
## Foundry

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**

Foundry consists of:

- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.

## Documentation

https://book.getfoundry.sh/

## Usage

### Build

```shell
$ forge build
```

### Test

```shell
$ forge test
```

### Format

```shell
$ forge fmt
```

### Gas Snapshots

```shell
$ forge snapshot
```

### Anvil

```shell
$ anvil
```

### Deploy

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```

### Cast

```shell
$ cast <subcommand>
```

### Help

```shell
$ forge --help
$ anvil --help
$ cast --help
```
6 changes: 6 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[profile.default]
src = "src"
out = "out"
libs = ["lib"]

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at 1eea5b
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at 855c39
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts-upgradeable
3 changes: 3 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@openzeppelin-upgrades/=lib/openzeppelin-contracts-upgradeable/
@openzeppelin/=lib/openzeppelin-contracts/
forge-std/=lib/forge-std/src/
39 changes: 39 additions & 0 deletions script/deployFinalityRelayer.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import {Script,console} from "forge-std/Script.sol";
import {BLSApkRegistry} from "../src/bls/BLSApkRegistry.sol";
import {BLSSignatureChecker} from "../src/bls/BLSSignatureChecker.sol";


contract deployFinalityRelayerScript is Script {
function setUp() public {}

function run() public {
address relayerManager = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266;
uint256 deployerPrivateKey = 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80;

// Start broadcasting with the deployer's private key
vm.startBroadcast(deployerPrivateKey);

// Deploy BLSApkRegistry
BLSApkRegistry registry = new BLSApkRegistry(relayerManager);

// Deploy BLSSignatureChecker
BLSSignatureChecker checker = new BLSSignatureChecker(address(registry));

vm.stopBroadcast();

// Log the deployed contract addresses
console.log("Relayer Manager address:", relayerManager);
console.log("BLSApkRegistry deployed at:", address(registry));
console.log("BLSSignatureChecker deployed at:", address(checker));

// Optional: Save the deployed addresses to a file
string memory deploymentData = string(abi.encodePacked(
"REGISTRY_ADDRESS=", vm.toString(address(registry)), "\n",
"CHECKER_ADDRESS=", vm.toString(address(checker))
));
vm.writeFile("./deployments/addresses.txt", deploymentData);
}
}
Loading

0 comments on commit c02944f

Please sign in to comment.