@@ -62,122 +62,116 @@ Then add a `{CHAIN_ID}.json` file in the [deployments](./deployments) directory
6262CHAIN_ID=$( cast chain-id --rpc-url $ETH_RPC_URL ) ; mkdir -p ./deployments && [ -f " ./deployments/${CHAIN_ID} .json" ] || echo ' {}' > " ./deployments/${CHAIN_ID} .json"
6363```
6464
65- ### Run the scripts
65+ Then you should add the ` VKEY ` and ` GENESIS_STATE_ROOT ` to the ` {CHAIN_ID}.json ` file:
6666
67- Deploy all contracts:
68-
69- ``` sh
70- FOUNDRY_PROFILE=deploy forge script AllScript --private-key $PRIVATE_KEY --broadcast --rpc-url $ETH_RPC_URL
67+ ``` json
68+ {
69+ "VKEY" : " 0x004988f252500633b4d3d369b3726d5bdacfbe35236b36eb2d487af3742c905e" ,
70+ "GENESIS_STATE_ROOT" : " 0xc88159adb4da01a67b90803d48a35fbf7f457572b61377e5d4b090c89488b838"
71+ }
7172```
7273
73- Then mint some $PROVE tokens (assuming you made the $OWNER the same as the $PRIVATE_KEY address):
74+ Ensure these match the actual vkey and genesis state root for the Rust vApp program.
7475
75- ``` sh
76- FOUNDRY_PROFILE=deploy forge script MintScript --private-key $PRIVATE_KEY --broadcast --rpc-url $ETH_RPC_URL
77- ```
76+ Note: the production version of these contracts were deployed using foundry [ v1.3.0] ( https://github.com/foundry-rs/foundry/releases/tag/v1.3.0 ) .
77+
78+ ### Bulk deployment
79+
80+ This should generally only be used for testing.
7881
79- Then create a prover and stake :
82+ Deploy all contracts at once :
8083
8184``` sh
82- FOUNDRY_PROFILE=deploy forge script CreateProverAndStakeScript --private-key $PRIVATE_KEY --broadcast --rpc-url $ETH_RPC_URL
85+ FOUNDRY_PROFILE=deploy forge script AllScript --private-key $PRIVATE_KEY --broadcast --rpc-url $ETH_RPC_URL
8386```
8487
8588You can append ` --verify --verifier etherscan --etherscan-api-key $ETHERSCAN_API_KEY ` to the above commands to verify the contracts on Etherscan.
8689
87- ## Other Operations
90+ ### Individual deployment
8891
89- To run cast commands, you need to set the environment variables to the addresses of the contracts you deployed, by looking at the [ deployments] ( ./deployments ) directory .
92+ Instead of deploying all contracts at once, it's recommended to deploy each contract individually for production deployments.
9093
91- ``` sh
92- CHAIN_ID=$( cast chain-id --rpc-url " $ETH_RPC_URL " ) && export $( jq -r ' to_entries|map("\(.key)=\(.value)")|.[]' ./deployments/${CHAIN_ID} .json) > /dev/null
93- ```
94+ #### Pre-deployed contracts
9495
95- ### Deposit
96+ Fill out ` {CHAIN_ID}.json ` with any pre-deployed contracts. For example, if there is an existing ` PROVE ` and ` VERIFIER ` those keys would be filled:
9697
97- ``` sh
98- cast send $PROVE " approve(address,uint256)" $VAPP 10000000e18 --private-key $PRIVATE_KEY --rpc-url $ETH_RPC_URL
98+ ``` json
99+ {
100+ "VKEY" : " 0x004988f252500633b4d3d369b3726d5bdacfbe35236b36eb2d487af3742c905e" ,
101+ "GENESIS_STATE_ROOT" : " 0xc88159adb4da01a67b90803d48a35fbf7f457572b61377e5d4b090c89488b838" ,
102+ "PROVE" : " 0x6BEF15D938d4E72056AC92Ea4bDD0D76B1C4ad29" ,
103+ "VERIFIER" : " 0x397A5f7f3dBd538f23DE225B51f532c34448dA9B"
104+ }
99105```
100106
101- ``` sh
102- cast send $VAPP " deposit(uint256)" 10000000e18 --private-key $PRIVATE_KEY --rpc-url $ETH_RPC_URL
103- ```
107+ #### Deploy each contract
104108
105- ### Withdraw
109+ Deploy the SuccinctStaking contract:
106110
107111``` sh
108- cast send $VAPP " requestWithdraw(address,uint256) " $( cast wallet address --private-key $PRIVATE_KEY ) 100e18 --private-key $PRIVATE_KEY --rpc-url $ETH_RPC_URL
112+ FOUNDRY_PROFILE=deploy forge script SuccinctStakingScript --private-key $PRIVATE_KEY --broadcast --rpc-url $ETH_RPC_URL --verify --verifier etherscan --etherscan-api-key $ETHERSCAN_API_KEY
109113```
110114
111- You need to wait for the withdrawal to be processed before you can finish it:
115+ This DOES NOT initalize the contract - this will be done in a later step once references to other contracts are available.
116+
117+ Deploy the $iPROVE contract (assumes $PROVE is already deployed):
112118
113119``` sh
114- if [ $( cast call $VAPP " claimableWithdrawal(address)" $( cast wallet address --private-key $PRIVATE_KEY ) --rpc-url $ETH_RPC_URL ) -gt 0 ]; then
115- cast send $VAPP " finishWithdraw()" --private-key $PRIVATE_KEY --rpc-url $ETH_RPC_URL
116- fi
120+ FOUNDRY_PROFILE=deploy forge script IntermediateSuccinctScript --private-key $PRIVATE_KEY --broadcast --rpc-url $ETH_RPC_URL --verify --verifier etherscan --etherscan-api-key $ETHERSCAN_API_KEY
117121```
118122
119- ### Create a Prover
123+ Deploy the SuccinctGovernor contract:
120124
121125``` sh
122- cast send $STAKING " createProver() " $( cast wallet address --private-key $PRIVATE_KEY ) --private-key $PRIVATE_KEY --rpc-url $ETH_RPC_URL
126+ FOUNDRY_PROFILE=deploy forge script SuccinctGovernorScript --private-key $PRIVATE_KEY --broadcast --rpc-url $ETH_RPC_URL --verify --verifier etherscan --etherscan-api-key $ETHERSCAN_API_KEY
123127```
124128
125- ### Stake
129+ Deploy the SuccinctVApp implementation and proxy contracts (assumes verifier is already deployed):
126130
127131``` sh
128- cast send $PROVE " approve(address,uint256) " $STAKING 10000e18 --private-key $PRIVATE_KEY --rpc-url $ETH_RPC_URL
132+ FOUNDRY_PROFILE=deploy forge script SuccinctVAppScript --private-key $PRIVATE_KEY --broadcast -- rpc-url $ETH_RPC_URL --verify --verifier etherscan --etherscan-api-key $ETHERSCAN_API_KEY
129133```
130134
131- ``` sh
132- cast send $STAKING " stake(address,uint256)" $PROVER 9990e18 --private-key $PRIVATE_KEY --rpc-url $ETH_RPC_URL
133- ```
135+ If the SP1VerifierGateway is not already deployed, follow steps in [ sp1-contracts] ( https://github.com/succinctlabs/sp1-contracts ) to deploy it and fill out the address in your ` {CHAIN_ID}.json ` file.
134136
135- ### Unstake
137+ Initalize the SuccinctStaking contract:
136138
137139``` sh
138- cast send $STAKING " requestUnstake(uint256 )" 2000e18 --private-key $PRIVATE_KEY --rpc-url $ETH_RPC_URL
140+ FOUNDRY_PROFILE=deploy forge script SuccinctStakingScript --sig " initialize( )" --private-key $PRIVATE_KEY --broadcast --rpc-url $ETH_RPC_URL
139141```
140142
143+ Run the integrity check:
144+
141145``` sh
142- cast send $STAKING " finishUnstake() " --private-key $PRIVATE_KEY --rpc-url $ETH_RPC_URL
146+ FOUNDRY_PROFILE=deploy forge script PostDeploymentScript --rpc-url $ETH_RPC_URL
143147```
144148
145- ### Dispense
149+ If that passes without reverting, the contracts have been successfully deployed and initalized. The addresses are in the ` {CHAIN_ID}.json ` file.
146150
147- Figure out the maximum amount of $PROVE that can be dispensed:
151+ ## Verification
148152
149- ``` sh
150- export DISPENSE_AMOUNT=$( cast call $STAKING " maxDispense()" --rpc-url $ETH_RPC_URL )
151- ```
153+ If any of the contracts failed to verify on Etherscan, you can manually verify them by copying the the flatten source code and uploading it to Etherscan.
152154
153- Send some $PROVE to the $STAKING contract (assumes your balance is enough) :
155+ To do this, go to the address on Etherscan and click "Verify Contract". Choose :
154156
155- ``` sh
156- cast send $PROVE " transfer(address,uint256) " $STAKING $DISPENSE_AMOUNT --private-key $PRIVATE_KEY --rpc-url $ETH_RPC_URL
157- ```
157+ * Compiler: "Solidity (Single File)"
158+ * Compiler Version: "0.8.28"
159+ * License: "MIT"
158160
159- Dispense it :
161+ Then flatten the contract you're verifying, for example the SuccinctStaking contract :
160162
161163``` sh
162- cast send $STAKING " dispense(uint256) " $DISPENSE_AMOUNT --private-key $PRIVATE_KEY --rpc-url $ETH_RPC_URL
164+ forge flatten src/SuccinctStaking.sol
163165```
164166
165- OR just simply dispense the maximum amount:
167+ Copy the output into the "Contract Code" field.
166168
167- ``` sh
168- cast send $STAKING " dispense(uint256)" $( cast max-uint) --private-key $PRIVATE_KEY --rpc-url $ETH_RPC_URL
169- ```
170-
171- ### Check stake balances
169+ Then enter the compiler settings from the [ foundry.toml] ( ./foundry.toml ) file's ` [profile.deploy] ` section.
172170
173- Staker :
171+ If any constructor arguements were used but not shown in the "Constructor Arguments" field, use ` cast abi-encode ` with the appropriate signature to encode them, for example :
174172
175173``` sh
176- cast to-dec $( cast call $STAKING " staked (address)" $( cast wallet address --private-key $PRIVATE_KEY ) --rpc-url $ETH_RPC_URL )
174+ cast abi-encode " constructor (address)" 0xbD74E9B0Dcb0317E26505CA93757c29d564B533B
177175```
178176
179- Prover:
180-
181- ``` sh
182- cast to-dec $( cast call $STAKING " proverStaked(address)" $PROVER --rpc-url $ETH_RPC_URL )
183- ```
177+ strip the ` 0x ` prefix from this output and paste it into the "Constructor Arguments" field.
0 commit comments