Skip to content
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

Deployment update + repo cleanup #154

Merged
merged 16 commits into from
Jul 15, 2024
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
broadcast/
cache/
mtb/
node_modules/
out/
lib/

.deploy-config.json
.env
state.json
308 changes: 148 additions & 160 deletions .gas-snapshot

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build and Publish Docker Image

on:
push:
branches:
- main
tags:
- 'v*.*.*'
workflow_dispatch:

jobs:
build-and-publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
type=raw,value=latest

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
cache-from: type=gha
cache-to: type=gha,mode=max
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Create Release

on:
push:
tags:
- 'v*.*.*'

jobs:
create-release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref }}
body: |
Release notes for ${{ github.ref }}
draft: false
prerelease: false
9 changes: 4 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
branches:
- main
pull_request:
workflow_dispatch:

name: Unit Tests

Expand All @@ -19,11 +20,6 @@ jobs:
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1

- uses: actions/setup-node@v2
with:
node-version: '17'
cache: 'npm'

- name: Install Dependencies
run: make install

Expand All @@ -33,6 +29,9 @@ jobs:
- name: Run Tests
run: make test

- name: Check formatting
run: make format-check

- name: Run Benchmarks
run: |
make bench
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ mtb/
.deploy-config.json
yarn.lock
.DS_Store

# Forge script broadcast output directory
broadcast/

# State generated via anvil
# TODO: Use a temporary directory?
state.json
11 changes: 0 additions & 11 deletions .prettierignore

This file was deleted.

11 changes: 0 additions & 11 deletions .prettierrc.json

This file was deleted.

181 changes: 146 additions & 35 deletions .size-snapshot
Original file line number Diff line number Diff line change
@@ -1,36 +1,147 @@
No files changed, compilation skipped
| Contract | Size (kB) | Margin (kB) |
|--------------------------------|-----------|-------------|
| Address | 0.086 | 24.49 |
| AddressUpgradeable | 0.086 | 24.49 |
| ByteHasher | 0.086 | 24.49 |
| CheckInitialized | 0.063 | 24.513 |
| ERC1967Proxy | 0.177 | 24.399 |
| ErrorUtils | 0.086 | 24.49 |
| Pairing | 0.086 | 24.49 |
| SemaphoreTreeDepthValidator | 0.086 | 24.49 |
| SemaphoreVerifier | 4.211 | 20.365 |
| SequencerVerifier | 0.756 | 23.82 |
| SimpleSemaphoreVerifier | 0.301 | 24.275 |
| SimpleStateBridge | 0.186 | 24.39 |
| SimpleVerifier | 0.804 | 23.772 |
| SimpleVerify | 0.581 | 23.995 |
| StorageSlot | 0.086 | 24.49 |
| StorageSlotUpgradeable | 0.086 | 24.49 |
| TestERC20 | 2.874 | 21.702 |
| TypeConverter | 11.403 | 13.173 |
| UnimplementedTreeVerifier | 0.713 | 23.863 |
| Verifier | 4.38 | 20.196 |
| VerifierLookupTable | 1.127 | 23.449 |
| WorldIDIdentityManager | 0.177 | 24.399 |
| WorldIDIdentityManagerImplMock | 15.449 | 9.127 |
| WorldIDIdentityManagerImplV1 | 15.133 | 9.443 |
| WorldIDRouter | 0.177 | 24.399 |
| WorldIDRouterImplMock | 7.343 | 17.233 |
| WorldIDRouterImplV1 | 7.03 | 17.546 |
| console | 0.086 | 24.49 |
| console2 | 0.086 | 24.49 |
| stdError | 0.624 | 23.952 |
| stdMath | 0.086 | 24.49 |
| stdStorage | 0.59 | 23.986 |
Compiling 1 files with Solc 0.8.21
Solc 0.8.21 finished in 1.61s
Compiler run successful with warnings:
Warning (2519): This declaration shadows an existing declaration.
--> script/Deploy.s.sol:33:9:
|
33 | WorldIDIdentityManager worldIDOrb = deployWorldID(INITIAL_ROOT);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: The shadowed declaration is here:
--> script/Deploy.s.sol:30:54:
|
30 | function run() external returns (address router, address worldIDOrb, address worldIDPhone) {
| ^^^^^^^^^^^^^^^^^^

Warning (2519): This declaration shadows an existing declaration.
--> script/Deploy.s.sol:35:9:
|
35 | WorldIDIdentityManager worldIDPhone = deployWorldID(INITIAL_ROOT);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: The shadowed declaration is here:
--> script/Deploy.s.sol:30:74:
|
30 | function run() external returns (address router, address worldIDOrb, address worldIDPhone) {
| ^^^^^^^^^^^^^^^^^^^^

Warning (2519): This declaration shadows an existing declaration.
--> script/Deploy.s.sol:38:9:
|
38 | WorldIDRouter router = deployWorldIDRouter(IWorldID(address(worldIDPhone)));
| ^^^^^^^^^^^^^^^^^^^^
Note: The shadowed declaration is here:
--> script/Deploy.s.sol:30:38:
|
30 | function run() external returns (address router, address worldIDOrb, address worldIDPhone) {
| ^^^^^^^^^^^^^^

Warning (2519): This declaration shadows an existing declaration.
--> script/Deploy.s.sol:45:9:
|
45 | VerifierLookupTable batchInsertionVerifiers = deployInsertionVerifiers();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: The shadowed declaration is here:
--> script/Deploy.s.sol:27:5:
|
27 | address batchInsertionVerifiers = address(0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Warning (2519): This declaration shadows an existing declaration.
--> script/Deploy.s.sol:47:9:
|
47 | VerifierLookupTable batchDeletionVerifiers = deployDeletionVerifiers();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: The shadowed declaration is here:
--> script/Deploy.s.sol:28:5:
|
28 | address batchDeletionVerifiers = address(0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Warning (2519): This declaration shadows an existing declaration.
--> script/Deploy.s.sol:77:9:
|
77 | WorldIDIdentityManager worldID = new WorldIDIdentityManager(address(impl1), initializeCall);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: The shadowed declaration is here:
--> script/Deploy.s.sol:44:65:
|
44 | function deployWorldID(uint256 _initalRoot) public returns (WorldIDIdentityManager worldID) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Warning (2519): This declaration shadows an existing declaration.
--> script/Deploy.s.sol:100:9:
|
100 | WorldIDRouter router = new WorldIDRouter(address(impl), initializeCall);
| ^^^^^^^^^^^^^^^^^^^^
Note: The shadowed declaration is here:
--> script/Deploy.s.sol:90:18:
|
90 | returns (WorldIDRouter router)
| ^^^^^^^^^^^^^^^^^^^^

Warning (2519): This declaration shadows an existing declaration.
--> script/Deploy.s.sol:110:9:
|
110 | VerifierLookupTable lut = new VerifierLookupTable();
| ^^^^^^^^^^^^^^^^^^^^^^^
Note: The shadowed declaration is here:
--> script/Deploy.s.sol:107:58:
|
107 | function deployVerifierLookupTable() public returns (VerifierLookupTable lut) {
| ^^^^^^^^^^^^^^^^^^^^^^^

Warning (2519): This declaration shadows an existing declaration.
--> script/Deploy.s.sol:132:13:
|
132 | VerifierLookupTable lut = deployVerifierLookupTable();
| ^^^^^^^^^^^^^^^^^^^^^^^
Note: The shadowed declaration is here:
--> script/Deploy.s.sol:130:57:
|
130 | function deployInsertionVerifiers() public returns (VerifierLookupTable lut) {
| ^^^^^^^^^^^^^^^^^^^^^^^

Warning (2519): This declaration shadows an existing declaration.
--> script/Deploy.s.sol:150:13:
|
150 | VerifierLookupTable lut = deployVerifierLookupTable();
| ^^^^^^^^^^^^^^^^^^^^^^^
Note: The shadowed declaration is here:
--> script/Deploy.s.sol:148:56:
|
148 | function deployDeletionVerifiers() public returns (VerifierLookupTable lut) {
| ^^^^^^^^^^^^^^^^^^^^^^^

Warning (2072): Unused local variable.
--> script/Deploy.s.sol:49:9:
|
49 | SemaphoreVerifier _semaphoreVerifier = deploySemaphoreVerifier();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

| Contract | Size (B) | Margin (B) |
|--------------------------------|----------|------------|
| Address | 86 | 24,490 |
| AddressUpgradeable | 86 | 24,490 |
| CheckInitialized | 63 | 24,513 |
| ERC1967Proxy | 177 | 24,399 |
| Pairing | 2,984 | 21,592 |
| SemaphoreTreeDepthValidator | 86 | 24,490 |
| SemaphoreVerifier | 5,219 | 19,357 |
| SequencerVerifier | 364 | 24,212 |
| SimpleSemaphoreVerifier | 420 | 24,156 |
| SimpleStateBridge | 524 | 24,052 |
| SimpleVerifier | 530 | 24,046 |
| SimpleVerify | 581 | 23,995 |
| StorageSlot | 86 | 24,490 |
| StorageSlotUpgradeable | 86 | 24,490 |
| TypeConverter | 11,403 | 13,173 |
| UnimplementedTreeVerifier | 207 | 24,369 |
| Verifier | 4,813 | 19,763 |
| VerifierLookupTable | 1,382 | 23,194 |
| WorldIDIdentityManager | 177 | 24,399 |
| WorldIDIdentityManagerImplMock | 11,003 | 13,573 |
| WorldIDIdentityManagerImplV1 | 10,655 | 13,921 |
| WorldIDIdentityManagerImplV2 | 12,942 | 11,634 |
| WorldIDRouter | 177 | 24,399 |
| WorldIDRouterImplMock | 7,216 | 17,360 |
| WorldIDRouterImplV1 | 6,917 | 17,659 |

17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ghcr.io/foundry-rs/foundry:latest

WORKDIR /world-id

COPY . .

# Fetch libs
RUN forge install

# Build the project
RUN forge build

# RUN ls script; exit 1
RUN ./script/generate_anvil_state.sh

ENTRYPOINT ["anvil", "--host", "0.0.0.0", "--load-state", "state.json"]
CMD []
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ all: install build
# ===== Basic Development Rules =======================================================================================

# Install forge dependencies (not needed if submodules are already initialized).
install:; forge install && npm install
install:; forge install

# Build contracts.
build:; forge build
Expand All @@ -29,7 +29,8 @@ snapshot:; forge snapshot --no-match-test testCannotRegisterIfProofIncorrect
# ===== Utility Rules =================================================================================================

# Format the solidity code.
format:; forge fmt; npx prettier --write .
format:; forge fmt
format-check:; forge fmt --check

# Update forge dependencies.
update:; forge update
Loading
Loading