Skip to content

Commit 2ca7f3b

Browse files
authored
docs: contracts (#3)
* contracts readme * foundry project * docs: README
1 parent dd0a1bb commit 2ca7f3b

File tree

3 files changed

+52
-89
lines changed

3 files changed

+52
-89
lines changed

README.md

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,13 @@
11
# SP1 Contracts
22

3-
## Update with New SP1 Version
3+
This repository contains the smart contracts for verifying [SP1](https://github.com/succinctlabs/sp1) EVM proofs.
44

5-
This section outlines the steps required to update the SP1 contracts repository with a new SP1 version. Follow these instructions to ensure the SP1 contracts are correctly updated and aligned with the latest version.
5+
## For Developers: Integrate SP1 Contracts
66

7+
This repository contains the EVM contracts for verifying SP1 PLONK EVM proofs.
78

8-
1. Change the version tag in `Cargo.toml` to the target `sp1` version.
9+
You can find more details on the contracts and how to install them in the contracts [`README`](./contracts/README.md).
910

10-
```toml
11-
[dependencies]
12-
sp1-sdk = { git = "https://github.com/succinctlabs/sp1", tag = "<SP1_TAG>" }
13-
```
14-
15-
2. Update `contracts/src` with the new verifier contracts.
16-
17-
```bash
18-
cargo update
19-
20-
cargo run --bin artifacts
21-
```
22-
23-
3. Change `VERSION` in both `SP1MockVerifier.sol` and `SP1Verifier.sol` to match the target `sp1` version tag.
24-
25-
```solidity
26-
function VERSION() external pure returns (string memory) {
27-
return "<SP1_TAG>";
28-
}
29-
```
30-
31-
4. Open a PR to commit the changes to `main`.
32-
5. After merging to `main`, create a release tag with the same version as the `sp1` tag used.
33-
34-
## Miscellaneous
35-
The SP1 Solidity contract artifacts are included in each release of `sp1`. You can see how these are included in the `sp1` repository [here](https://github.com/succinctlabs/sp1/blob/21455d318ae383b317c92e10709bbfc313d8f1df/recursion/gnark-ffi/src/plonk_bn254.rs#L57-L96).
11+
## For Contributors
3612

13+
To update the SP1 contracts, please refer to the [`update`](./UPDATE_CONTRACTS.md) file.

UPDATE_CONTRACTS.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
# Update SP1 Contracts with New SP1 Version
3+
4+
This section outlines the steps required to update the SP1 contracts repository with a new SP1 version. Follow these instructions to ensure the SP1 contracts are correctly updated and aligned with the latest version.
5+
6+
7+
1. Change the version tag in `Cargo.toml` to the target `sp1` version.
8+
9+
```toml
10+
[dependencies]
11+
sp1-sdk = { git = "https://github.com/succinctlabs/sp1", tag = "<SP1_TAG>" }
12+
```
13+
14+
2. Update `contracts/src` with the new verifier contracts.
15+
16+
```bash
17+
cargo update
18+
19+
cargo run --bin artifacts
20+
```
21+
22+
3. Change `VERSION` in both `SP1MockVerifier.sol` and `SP1Verifier.sol` to match the target `sp1` version tag.
23+
24+
```solidity
25+
function VERSION() external pure returns (string memory) {
26+
return "<SP1_TAG>";
27+
}
28+
```
29+
30+
4. Open a PR to commit the changes to `main`.
31+
5. After merging to `main`, create a release tag with the same version as the `sp1` tag used.
32+
33+
## Miscellaneous
34+
The SP1 Solidity contract artifacts are included in each release of `sp1`. You can see how these are included in the `sp1` repository [here](https://github.com/succinctlabs/sp1/blob/21455d318ae383b317c92e10709bbfc313d8f1df/recursion/gnark-ffi/src/plonk_bn254.rs#L57-L96).
35+

contracts/README.md

Lines changed: 11 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,17 @@
1-
## Foundry
1+
# SP1 Contracts
22

3-
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
3+
This repository contains the smart contracts for verifying [SP1](https://github.com/succinctlabs/sp1) EVM proofs.
44

5-
Foundry consists of:
5+
## Overview
6+
- [`SP1Verifier`](./src/SP1Verifier.sol): The main contract for verifying SP1 EVM proofs.
7+
- [`SP1MockVerifier`](./src/SP1MockVerifier.sol): A mock contract for testing SP1 EVM proofs.
8+
- [`ISP1Verifier`](./src/ISP1Verifier.sol): Interface for SP1Verifier.
9+
- [`PlonkVerifier`](./src/PlonkVerifier.sol): Core logic for verifying Plonk EVM proofs.
610

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

12-
## Documentation
13+
Install these contracts for a Foundry project using `forge install`.
1314

14-
https://book.getfoundry.sh/
15-
16-
## Usage
17-
18-
### Build
19-
20-
```shell
21-
$ forge build
22-
```
23-
24-
### Test
25-
26-
```shell
27-
$ forge test
28-
```
29-
30-
### Format
31-
32-
```shell
33-
$ forge fmt
34-
```
35-
36-
### Gas Snapshots
37-
38-
```shell
39-
$ forge snapshot
40-
```
41-
42-
### Anvil
43-
44-
```shell
45-
$ anvil
46-
```
47-
48-
### Deploy
49-
50-
```shell
51-
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
52-
```
53-
54-
### Cast
55-
56-
```shell
57-
$ cast <subcommand>
58-
```
59-
60-
### Help
61-
62-
```shell
63-
$ forge --help
64-
$ anvil --help
65-
$ cast --help
15+
```bash
16+
forge install succinctlabs/sp1-contracts@<version>
6617
```

0 commit comments

Comments
 (0)