Skip to content

Commit 31716b2

Browse files
Update readme with the latest changes
1 parent c109a9d commit 31716b2

1 file changed

Lines changed: 147 additions & 40 deletions

File tree

scripts/biconomy/README-deploy-infrastructure-and-wallet.md

Lines changed: 147 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ The `deploy-infrastructure-and-wallet.js` script is a **complete, self-contained
66

77
- **Passport Infrastructure** (proven stable base) - Factory + MultiCallDeploy
88
- **Nexus Core** (modern Account Abstraction) - K1Validator + Implementation
9-
- **Hybrid Wallet Deployment** - Using Passport Factory with Nexus functionality
9+
- **Hybrid Wallet Deployment** - Configurable deployment via Factory or MultiCallDeploy
10+
- **Complete 6-Step Coverage** - Implements all original deployment steps in one script
1011

1112
## Key Features
1213

@@ -18,9 +19,12 @@ The `deploy-infrastructure-and-wallet.js` script is a **complete, self-contained
1819

1920
### **Robust Architecture**
2021
- **Hybrid approach** combines the best of both systems
22+
- **Complete 6-step implementation** (all original steps in one script)
23+
- **Dual deployment methods** (Factory and MultiCallDeploy)
2124
- **Proper timing** with verification between deployments
2225
- **Comprehensive verification** of all components
2326
- **Deterministic deployment** using CREATE2 for wallet addresses
27+
- **Automatic fallback** from MultiCallDeploy to Factory if needed
2428

2529
### **Production Ready**
2630
- **Error handling** with detailed diagnostics
@@ -36,28 +40,45 @@ The `deploy-infrastructure-and-wallet.js` script is a **complete, self-contained
3640
- Node.js with required dependencies
3741

3842
### Basic Deployment
43+
44+
#### Default Method (Factory)
3945
```bash
40-
# Deploy complete infrastructure + wallet
46+
# Deploy complete infrastructure + wallet using Factory
4147
NODE_ENV=development npx hardhat run scripts/biconomy/deploy-infrastructure-and-wallet.js --network hardhat
4248
```
4349

44-
### What Gets Deployed
50+
#### MultiCallDeploy Method (with Initial Transactions)
51+
```bash
52+
# Deploy using MultiCallDeploy with automatic fallback to Factory
53+
USE_MULTICALL_DEPLOY=true NODE_ENV=development npx hardhat run scripts/biconomy/deploy-infrastructure-and-wallet.js --network hardhat
54+
```
4555

46-
#### Phase 1: Infrastructure Components
47-
1. **MultiCallDeploy (Passport)** - Batch transaction execution
48-
2. **Factory (Passport)** - Deterministic wallet deployment
49-
3. **K1Validator (Nexus)** - ECDSA signature validation
50-
4. **Nexus Implementation** - Modern AA smart account
56+
### What Gets Deployed
5157

52-
#### Phase 2: Wallet Deployment
53-
1. **Hybrid Wallet** - Deployed via Passport Factory using Nexus as main module
54-
2. **Deterministic Address** - Predictable wallet address using CREATE2
55-
3. **Permission Setup** - Automatic role configuration
58+
#### Phase 1: Complete Infrastructure (All 6 Steps)
59+
1. **Step 1**: MultiCallDeploy (Passport) + Factory (Passport)
60+
2. **Step 2**: LatestWalletImplLocator deployment
61+
3. **Step 3**: StartupWalletImpl deployment
62+
4. **Step 4**: K1Validator (Nexus) + Nexus Implementation
63+
5. **Step 5**: ImmutableSigner deployment
64+
6. **Step 6**: LatestWalletImplLocator → Nexus configuration
65+
66+
#### Phase 2: Wallet Deployment (Configurable Method)
67+
**Factory Method (Default)**:
68+
- Deployed via Passport Factory using Nexus as main module
69+
- Salt: `hybrid-wallet-factory`
70+
- Simple, reliable deployment
71+
72+
**MultiCallDeploy Method (Optional)**:
73+
- Deployed via MultiCallDeploy with initial transactions
74+
- Salt: `hybrid-wallet-multicall`
75+
- Includes example initial transaction (0.1 ETH transfer)
76+
- Automatic fallback to Factory if interface issues occur
5677

5778
#### Phase 3: Verification
58-
1. **Code Verification** - Ensures all contracts have bytecode
79+
1. **Code Verification** - Ensures all 8 components have bytecode
5980
2. **Size Validation** - Confirms proper deployment
60-
3. **Integration Testing** - Validates hybrid architecture
81+
3. **Integration Testing** - Validates complete 6-step architecture
6182

6283
## Output
6384

@@ -73,40 +94,51 @@ The script generates `complete-deployment-success.json` with:
7394
"infrastructure": {
7495
"passportMultiCallDeploy": "0x5FbDB...",
7596
"passportFactory": "0xe7f17...",
76-
"nexusK1Validator": "0x9fE46...",
77-
"nexusImplementation": "0xCf7Ed..."
97+
"latestWalletImplLocator": "0x9fE46...",
98+
"startupWalletImpl": "0xCf7Ed...",
99+
"nexusK1Validator": "0xDc64a...",
100+
"nexusImplementation": "0x5FC8d...",
101+
"immutableSigner": "0x0165...",
102+
"locatorToNexusConfigured": true,
103+
"configurationTxHash": "0x7252..."
78104
},
79105
"wallet": {
80-
"address": "0x8cba831e033bE660b4B9B36d09D0119AC7754cD5",
106+
"address": "0x828709bE90a398c2a21cB2EeC27A82866Aab7466",
81107
"owner": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
82-
"mainModule": "0xCf7Ed..."
108+
"mainModule": "0x5FC8d...",
109+
"deploymentMethod": "Factory"
83110
}
84111
}
85112
```
86113

87114
### Console Output Example
88115
```
89116
🚀 COMPLETE INFRASTRUCTURE + WALLET DEPLOYMENT
90-
==============================================
91117
Deployer: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
92118
Network: hardhat
93119
Balance: 10000.0 ETH
120+
🎯 Deployment Method: Factory
94121
95122
🏗️ PHASE 1: DEPLOYING INFRASTRUCTURE
96123
=====================================
97-
✅ MultiCallDeploy: 0x5FbDB... (4608 bytes)
98-
✅ Factory: 0xe7f17... (3367 bytes)
99-
✅ K1Validator: 0x9fE46... (4479 bytes)
100-
✅ Nexus Implementation: 0xCf7Ed... (28720 bytes)
124+
1️⃣ ✅ MultiCallDeploy: 0x5FbDB... (4608 bytes)
125+
2️⃣ ✅ Factory: 0xe7f17... (3367 bytes)
126+
3️⃣ ✅ LatestWalletImplLocator: 0x9fE46... (2691 bytes)
127+
4️⃣ ✅ StartupWalletImpl: 0xCf7Ed... (478 bytes)
128+
5️⃣ ✅ K1Validator: 0xDc64a... (4479 bytes)
129+
6️⃣ ✅ Nexus Implementation: 0x5FC8d... (28720 bytes)
130+
7️⃣ ✅ ImmutableSigner: 0x0165... (4942 bytes)
131+
8️⃣ ✅ LatestWalletImplLocator → Nexus configured
101132
102133
🎯 PHASE 2: DEPLOYING WALLET
103134
=============================
104-
✅ WALLET DEPLOYED SUCCESSFULLY!
105-
Address: 0x8cba831e033bE660b4B9B36d09D0119AC7754cD5
135+
🏛️ Using Factory deployment method...
136+
✅ FACTORY WALLET DEPLOYED SUCCESSFULLY!
137+
Address: 0x828709bE90a398c2a21cB2EeC27A82866Aab7466
106138
107139
✅ PHASE 3: FINAL VERIFICATION
108140
==============================
109-
✅ ALL COMPONENTS VERIFIED SUCCESSFULLY
141+
✅ ALL 8 COMPONENTS VERIFIED SUCCESSFULLY
110142
111143
🎉 COMPLETE DEPLOYMENT SUCCESSFUL!
112144
```
@@ -133,29 +165,79 @@ Address: 0x8cba831e033bE660b4B9B36d09D0119AC7754cD5
133165
### Contract Interactions
134166

135167
```
136-
┌─────────────────┐ ┌──────────────────┐
137-
│ Passport Factory│───▶│ Nexus Wallet │
138-
│ │ │ (Implementation) │
139-
└─────────────────┘ └──────────────────┘
140-
│ │
141-
▼ ▼
142-
┌─────────────────┐ ┌──────────────────┐
143-
│ MultiCallDeploy │ │ K1Validator │
144-
│ │ │ │
145-
└─────────────────┘ └──────────────────┘
168+
🏗️ PASSPORT-NEXUS HYBRID ARCHITECTURE (Complete 6-Step Infrastructure)
169+
170+
Step 1: Passport Base Step 4: Nexus Core
171+
┌─────────────────┐ ┌──────────────────┐
172+
│ MultiCallDeploy │◄─────────┐ │ K1Validator │
173+
│ (Passport) │ │ │ (Nexus) │
174+
└─────────────────┘ │ └──────────────────┘
175+
│ │ │
176+
▼ │ ▼
177+
┌─────────────────┐ │ ┌──────────────────┐
178+
│ Factory │ │ │ Nexus Implementation│
179+
│ (Passport) │──────────┼─────▶│ (Nexus) │
180+
└─────────────────┘ │ └──────────────────┘
181+
│ │ │
182+
│ deploys │ │ configured via
183+
▼ │ ▼
184+
┌─────────────────┐ │ ┌──────────────────┐
185+
│ Deployed Wallet │ │ │LatestWalletImpl │
186+
│ (Hybrid Proxy) │ │ │ Locator │
187+
└─────────────────┘ │ └──────────────────┘
188+
│ │
189+
Step 3: Startup │ │ Step 6: Config
190+
┌─────────────────┐ │ │
191+
│StartupWalletImpl│ │ │
192+
│ │ │ │
193+
└─────────────────┘ │ │
194+
│ │
195+
Step 5: Security │ │
196+
┌─────────────────┐ │ │
197+
│ ImmutableSigner │──────────┘ │
198+
│ │ │
199+
└─────────────────┘ │
200+
201+
Step 2: Implementation Management │
202+
┌─────────────────┐◄─────────────────────────┘
203+
│LatestWalletImpl │
204+
│ Locator │ ──points to──▶ Nexus Implementation
205+
└─────────────────┘
206+
207+
Deployment Methods:
208+
• Factory Method: Factory ──deploy──▶ Wallet (using Nexus as main module)
209+
• MultiCallDeploy: MultiCallDeploy ──deploy+execute──▶ Wallet + Initial TXs
146210
```
147211

148212
## Configuration
149213

150214
### Environment Variables
215+
- `USE_MULTICALL_DEPLOY` - Deployment method selection (default: `false`)
216+
- `false` or unset: Use Factory deployment
217+
- `true`: Use MultiCallDeploy with automatic fallback
151218
- `GAS_LIMIT` - Transaction gas limit (default: 30000000)
152219
- `MAX_FEE_PER_GAS` - Maximum fee per gas (default: 1875000000)
153220
- `MAX_PRIORITY_FEE_PER_GAS` - Priority fee (default: 1000000000)
154221

222+
### Deployment Method Configuration
223+
**Factory Method (Default)**:
224+
- Uses Passport Factory for reliable deployment
225+
- Salt: `hybrid-wallet-factory`
226+
- No initial transactions
227+
- Proven stable method
228+
229+
**MultiCallDeploy Method (Experimental)**:
230+
- Uses MultiCallDeploy for deployment with initial transactions
231+
- Salt: `hybrid-wallet-multicall`
232+
- Includes example initial transaction (0.1 ETH transfer)
233+
- Automatic fallback to Factory if interface issues occur
234+
- Requires EXECUTOR_ROLE permission
235+
155236
### Customizable Parameters
156237
- **Wallet Owner** - Currently set to deployer address
157-
- **Salt Generation** - Uses "hybrid-wallet-final" string
238+
- **Salt Generation** - Method-specific salts for unique addresses
158239
- **EntryPoint** - Hardcoded test address for local development
240+
- **Initial Transactions** - Configurable for MultiCallDeploy method
159241

160242
## Troubleshooting
161243

@@ -172,9 +254,15 @@ Address: 0x8cba831e033bE660b4B9B36d09D0119AC7754cD5
172254
- Verify factory deployment success
173255

174256
3. **"Wallet deployment failed"**
175-
- Check salt uniqueness
257+
- Check salt uniqueness for the selected method
176258
- Verify Nexus implementation size
177-
- Ensure factory permissions
259+
- Ensure factory permissions (DEPLOYER_ROLE)
260+
- For MultiCallDeploy: verify EXECUTOR_ROLE
261+
262+
4. **"MultiCallDeploy failed" with automatic fallback**
263+
- This is expected behavior due to interface compatibility
264+
- Script automatically falls back to Factory method
265+
- Check console output for fallback confirmation
178266

179267
### Debug Mode
180268
Add console logs or increase verbosity by modifying the script logging levels.
@@ -192,6 +280,14 @@ To add additional infrastructure components:
192280
1. Add deployment logic in `deployInfrastructure()`
193281
2. Update verification in `finalVerification()`
194282
3. Include in output JSON structure
283+
4. Update the component count in verification messages
284+
285+
### Customizing MultiCallDeploy Interface
286+
To fix MultiCallDeploy compatibility:
287+
1. Investigate the exact interface of `MultiCallDeploy` contract
288+
2. Update parameters in `deployWalletWithMultiCallDeploy()`
289+
3. Adjust transaction encoding format
290+
4. Test with different initial transaction configurations
195291

196292
## Security Considerations
197293

@@ -210,4 +306,15 @@ For issues or questions:
210306

211307
---
212308

213-
**Note**: This script represents the final working solution for Passport-Nexus hybrid deployment. It supersedes individual step scripts and provides a complete, reliable deployment process.
309+
## Summary
310+
311+
**Note**: This script represents the complete working solution for Passport-Nexus hybrid deployment with dual deployment methods. Key achievements:
312+
313+
-**Complete 6-step implementation** - All original deployment steps in one script
314+
-**Dual deployment methods** - Factory (stable) and MultiCallDeploy (experimental)
315+
-**Automatic fallback** - Graceful handling of interface incompatibilities
316+
-**Self-contained** - No external dependencies or pre-deployment requirements
317+
-**Production ready** - Comprehensive error handling and verification
318+
-**Hybrid architecture** - Best of Passport stability + Nexus innovation
319+
320+
This script supersedes individual step scripts and provides a complete, reliable deployment process with flexible wallet deployment options.

0 commit comments

Comments
 (0)