-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add mainnet deployment #119
Conversation
deployment-guide.md
Outdated
@@ -114,15 +116,16 @@ You can deploy your contracts on a testnet such as `Sepolia` and run an end-to-e | |||
3. Deploy your contract by running: | |||
|
|||
```bash | |||
forge script script/Deploy.s.sol --rpc-url https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY:?} --broadcast | |||
forge script script/Deploy.s.sol --rpc-url https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY:?} --broadcast --sig "run(string memory configFile)" -- "script/configs/sepolia/deploy_sepolia_config.json" |
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.
Hmmm, this syntax with --sig
is kind of hard to understand. Using an environment variable seems like it would be easier to understand.
deployment-guide.md
Outdated
forge script script/MainnetDeploy.s.sol --rpc-url https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY:?} --broadcast --sig "run(string memory configFile)" -- "script/configs/mainnet/deploy_mainnet_config.json" | ||
``` | ||
|
||
This command uses the RISC Zero managed RiscZeroVerifierRouter contract (see https://etherscan.io/address/0x8EaB2D97Dfce405A1692a21b3ff3A172d593D319#code.output) and should output something similar to: |
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.
Let's link to our docs where the router is explained, rather than linking to Etherscan. If they don't already know what the router is, then this won't help them much. Same comment applied to Sepolia above.
https://dev.risczero.com/api/blockchain-integration/contracts/verifier#verifier-router
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.
Added that reference directly to the config.toml
; lemme know if you think adding it also to the guide makes more sense
deployment-guide.md
Outdated
export BONSAI_API_KEY="YOUR_API_KEY" # see form linked in the previous section | ||
export BONSAI_API_URL="BONSAI_API_URL" # provided with your api key | ||
export ALCHEMY_API_KEY="YOUR_ALCHEMY_API_KEY" # the API_KEY provided with an alchemy account | ||
export ETH_WALLET_PRIVATE_KEY="YOUR_WALLET_PRIVATE_KEY" # the private hex-encoded key of your Sepolia testnet wallet |
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.
There is a typo here in that this should refer to their Mainnet wallet.
export ETH_WALLET_PRIVATE_KEY="YOUR_WALLET_PRIVATE_KEY" # the private hex-encoded key of your Sepolia testnet wallet | |
export ETH_WALLET_PRIVATE_KEY="YOUR_WALLET_PRIVATE_KEY" # the private hex-encoded key of your Mainnet wallet |
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.
This also raises a bigger issue, in that we don't out-of-the-box support any kind of secure wallet as we would expect them to use on mainnet. To an extent, this is alright since we can't support ever wallet type and we expect our developers to have some idea of how to integrate Forge with their chosen platform. But we should certainly do a bit more work to support this.
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.
Totally agree. Do you think we should address that on this PR as well?
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.
I added some implementation for this in #122
script/Deploy.s.sol
Outdated
@@ -44,4 +48,26 @@ contract EvenNumberDeploy is Script { | |||
|
|||
vm.stopBroadcast(); | |||
} | |||
|
|||
function run(string memory deployConfigPath) external { |
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.
It's confusing that these two function have the same name. Additionally, taking an argument here causes use to use the weird syntax with --sig
for the CLI. It would make more sense to me to have these be one function with an if
in the middle that decides whether to deploy a new verifier or use an existing one.
script/Deploy.s.sol
Outdated
address verifier_address = stdJson.readAddress(config_data, ".risc_zero_verifier_address"); | ||
|
||
IRiscZeroVerifier verifier = IRiscZeroVerifier(verifier_address); | ||
console2.log("Using RiscZeroVerifierRouter contract deployed at", address(verifier)); |
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.
This log should reference IRiscZeroVerifier
since this could actually be implemented by a number of different contracts, depending on the address they use. (Make sure to update the logs copied into the deployment guide)
console2.log("Using RiscZeroVerifierRouter contract deployed at", address(verifier)); | |
console2.log("Using IRiscZeroVerifier contract deployed at", address(verifier)); |
@@ -0,0 +1,3 @@ | |||
{ | |||
"risc_zero_verifier_address": "0x8EaB2D97Dfce405A1692a21b3ff3A172d593D319" |
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.
It seems odd to me to use snake_case
in a JSON file. I usually see camelCase
or kebab-case
. I'd lean towards using camelCase
here because Solidity uses it.
"risc_zero_verifier_address": "0x8EaB2D97Dfce405A1692a21b3ff3A172d593D319" | |
"riscZeroVerifierAddress": "0x8EaB2D97Dfce405A1692a21b3ff3A172d593D319" |
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.
I've confirmed that the publisher step also works. Here is the contract I've deployed and set an even number on:
https://etherscan.io/address/0x0060518ffad3c2bcee309d308b9f68ec16ba7f85#readContract
Closes #112