Skip to content

Commit f3edbdf

Browse files
committed
chore: wallet deployment script that takes into account the SignedMultiCallDeploy contract
1 parent f485baa commit f3edbdf

4 files changed

Lines changed: 927 additions & 0 deletions

File tree

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Wallet Deployment with SignedMultiCallDeploy
2+
3+
This document describes the new wallet deployment workflow using `SignedMultiCallDeploy` instead of calling `MultiCallDeploy` directly.
4+
5+
## Overview
6+
7+
The `SignedMultiCallDeploy` contract sits in front of the `MultiCallDeploy` contract and requires a provenance signature from a trusted central party to ensure that wallet deployment requests are authorized.
8+
9+
## Key Changes from Original Workflow
10+
11+
### 1. Contract Usage
12+
- **Original**: Direct call to `MultiCallDeploy.deployAndExecute()`
13+
- **New**: Call to `SignedMultiCallDeploy.deployAndExecuteWithSignature()`
14+
15+
### 2. Required Parameters
16+
- **Original**: Only wallet owner signatures
17+
- **New**: Both wallet owner signatures AND central executor signature
18+
19+
### 3. Environment Variables
20+
- **New Requirement**: `CENTRAL_SIGNER_PRIVATE_KEY` environment variable must be set
21+
22+
## Script: `wallet-deployment-with-signed-multicall.ts`
23+
24+
### Prerequisites
25+
26+
1. **Environment Variable**: Set `CENTRAL_SIGNER_PRIVATE_KEY` in your environment
27+
2. **Deployment Steps**: Ensure steps 1, 3, 7, and 8 have been completed
28+
3. **Whitelisting**: SignedMultiCallDeploy must be whitelisted as an executor on MultiCallDeploy
29+
30+
### Usage
31+
32+
```bash
33+
# Set the required environment variable
34+
export CENTRAL_SIGNER_PRIVATE_KEY="0x..."
35+
36+
# Run the deployment script
37+
npx hardhat run scripts/v2/wallet-deployment-with-signed-multicall.ts --network <network>
38+
```
39+
40+
### How It Works
41+
42+
1. **Load Deployment Artifacts**: Loads contract addresses from previous deployment steps
43+
2. **Generate Wallet Configuration**: Creates a random owner for the new wallet
44+
3. **Create Bootstrap Transaction**: Prepares the `initializeAccount` call with bootstrap data
45+
4. **Generate Wallet Owner Signature**: Signs the transaction with the wallet owner's private key
46+
5. **Generate Central Executor Signature**: Signs the call data with the central executor's private key
47+
6. **Execute Deployment**: Calls `SignedMultiCallDeploy.deployAndExecuteWithSignature()`
48+
7. **Verify Results**: Checks that the wallet was deployed and modules were installed
49+
50+
### Signature Generation Process
51+
52+
#### Wallet Owner Signature
53+
- Uses the same process as the original script
54+
- Signs the meta-transaction data with the wallet owner's private key
55+
- Uses the `walletMultiSign` helper function
56+
57+
#### Central Executor Signature
58+
- Encodes the call data that will be made to `MultiCallDeploy.deployAndExecute()`
59+
- Creates a hash of the call data
60+
- Signs the hash with the central executor's private key
61+
- This signature proves that the central party authorized this specific deployment
62+
63+
### Key Differences from Original Script
64+
65+
1. **Contract Interface**: Uses `SignedMultiCallDeploy` instead of `MultiCallDeploy`
66+
2. **Function Call**: Calls `deployAndExecuteWithSignature()` instead of `deployAndExecute()`
67+
3. **Additional Signature**: Requires and generates a central executor signature
68+
4. **Artifact Loading**: Loads `signedMultiCallDeploy` address from step1.json
69+
5. **Event Monitoring**: Looks for `MultiCallDeployInvocationSuccess` event
70+
71+
### Error Handling
72+
73+
The script includes comprehensive error handling:
74+
- Validates that `CENTRAL_SIGNER_PRIVATE_KEY` is set
75+
- Checks that all required contracts exist
76+
- Performs static calls before execution
77+
- Provides detailed error messages and debugging information
78+
79+
### Events to Monitor
80+
81+
- `ModuleInstalled`: Indicates successful module installation via bootstrap
82+
- `MultiCallDeployInvocationSuccess`: Indicates successful execution by SignedMultiCallDeploy
83+
- Standard wallet deployment events
84+
85+
## Security Considerations
86+
87+
1. **Central Executor Key**: The `CENTRAL_SIGNER_PRIVATE_KEY` must be kept secure
88+
2. **Whitelisting**: Only whitelisted addresses can call `SignedMultiCallDeploy`
89+
3. **Signature Validation**: Both wallet owner and central executor signatures are validated
90+
4. **Provenance**: The central executor signature provides provenance for the deployment request
91+
92+
## Troubleshooting
93+
94+
### Common Issues
95+
96+
1. **Missing Environment Variable**: Ensure `CENTRAL_SIGNER_PRIVATE_KEY` is set
97+
2. **Contract Not Found**: Verify that all deployment steps have been completed
98+
3. **Signature Validation Failed**: Check that the central executor key matches the signer in SignedMultiCallDeploy
99+
4. **Gas Estimation Failed**: This is often normal - the script will proceed with a high gas limit
100+
101+
### Debug Information
102+
103+
The script provides extensive debug information:
104+
- Contract existence checks
105+
- Signature generation details
106+
- Static call results
107+
- Gas estimation results
108+
- Event monitoring
109+
- Post-execution verification
110+
111+
## Example Output
112+
113+
```
114+
[hardhat] Starting wallet deployment with SignedMultiCallDeploy...
115+
[hardhat] 🎲 Generated random owner: 0x...
116+
[hardhat] Generated salt: 0x...
117+
[hardhat] Counterfactual address: 0x...
118+
[hardhat] 🔐 Generating wallet owner signature with nonce: 0
119+
[hardhat] ✅ Generated wallet owner signature (length: 132): 0x...
120+
[hardhat] Central executor address: 0x...
121+
[hardhat] 📋 Central executor signature details:
122+
[hardhat] - Call data length: 1234
123+
[hardhat] - Call data hash: 0x...
124+
[hardhat] - Executor signature: 0x...
125+
[hardhat] 🚀 About to call deployAndExecuteWithSignature:
126+
[hardhat] 📡 Deployment transaction hash: 0x...
127+
[hardhat] ✅ Transaction confirmed in block: 12345
128+
[hardhat] 🎉 MultiCallDeployInvocationSuccess event found - SignedMultiCallDeploy executed successfully
129+
[hardhat] 🎉 ModuleInstalled events found: 2
130+
[hardhat] ✅ Wallet deployed and bootstrap initialization executed via SignedMultiCallDeploy!
131+
```
132+

0 commit comments

Comments
 (0)