diff --git a/.dockerignore b/.dockerignore index 2fa9d3c..3866415 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,3 +7,4 @@ lib/ .deploy-config.json .env +state.json diff --git a/.gitignore b/.gitignore index 3c90dcd..f3cadeb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ yarn.lock .DS_Store broadcast/ +state.json diff --git a/README.md b/README.md index 88e5ab7..13f0402 100644 --- a/README.md +++ b/README.md @@ -80,38 +80,37 @@ This repository uses the [Foundry](https://github.com/gakonst/foundry) smart con can download the Foundry installer by running `curl -L https://foundry.paradigm.xyz | bash`, and then install the latest version by running `foundryup` on a new terminal window (additional instructions are available [on the Foundry repo](https://github.com/gakonst/foundry#installation)). -You'll also need [Node.js](https://nodejs.org) if you're planning to run the automated tests. -Once you have everything installed, you can run `make` from the base directory to install all -dependencies and build the smart contracts. +We provide a docker image running anvil internally which has all the contracts predeployed. +This approach is the easiest way to get started interacting with the smart contracts. -### Testing - -In order to generate valid proofs you need to first download [`semaphore-mtb`](https://github.com/worldcoin/semaphore-mtb) and build it. Then you can run the tests with: - - -```bash -./gnark-mbu gen-test-param --mode insertion/deletion --tree-depth=... --batch-size=... +Simply run +``` +> docker run -p 8545:8545 ghcr.io/worldcoin/world-id-contracts ``` -where the parameters MUST match the parameters passed for contract deployment. To transform these -into a proof, run the `prove` command, passing the params on stdin: +This docker image starts an anvil instance with contracts deployed at: +``` +WorldIDRouter: 0x6e37bAB9d23bd8Bdb42b773C58ae43C6De43A590 +WorldIDIdentityManager (Orb): 0xB3E7771a6e2d7DD8C0666042B7a07C39b938eb7d +WorldIDIdentityManager (Phone): 0xCDfDF72065493bDDb2131478c89C1D5482BD1dF6 +``` -> [!NOTE] -> In order to generate a valid keys file, you need to run `gnark-mbu setup` with the correct parameters. > The `gnark-mbu setup` command will output a `keys` file that you can use for the `prove` command. +All the contracts are deployed using the default anvil wallet `0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266`, with the private key `0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80`. This is also the default owner account for all contracts. -```bash -./gnark-mbu prove --mode insertion/deletion --keys-file= ${keys_file} < GENERATED_PARAMS +### Setup +Before testing/building/deploying you'll need to initialize submodules. +``` +> git submodules update --init --recursive ``` -The output of this, together with the relevant parts of the generated test params, should constitute -a correct input to the `registerIdentities` or `deleteIdentities` methods respectively of the `WorldIDIdentityManagerImplV1/V2` contracts, as long as it was -deployed using the same keys file. - -Alternatively, you can take a look at pre-made tests with pre-generated valid proofs in [`WorldIDIdentityManagerTest.sol`](./src/test/identity-manager/WorldIDIdentityManagerTest.sol), [`WorldIDIdentityManagerIdentityRegistration.sol`](./src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration.t.sol) and [`WorldIDIdentityManagerIdentityDeletion.sol`](./src/test/identity-manager/WorldIDIdentityManagerIdentityDeletion.t.sol). +### Testing +Tests can be run with `forge test`. ### Deployment +#### contract-deployer + In order to deploy `world-id-contracts` you need to download [`contract-deployer`](https://github.com/worldcoin/contract-deployer), build it and do the following: 1. Download the repo @@ -134,8 +133,15 @@ git submodule update --init --recursive Run: ```bash -cargo run --release +cargo run --release ``` +#### forge script (new) +A `Deploy.s.sol` deployment script is provided for easy deployment. - +To deploy the entire stack (router, orb WorldID, phone WorldID, all the verifiers, etc.) run +``` +> export PRIVATE_KEY= +> export ETHERSCAN_API_KEY= +> forge script script/Deploy.s.sol --broadcast --rpc-url --verify +```