Skip to content

Commit b38c29f

Browse files
Fix K1ValidatorFactory implementation
1 parent 940975d commit b38c29f

8 files changed

Lines changed: 1757 additions & 111 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The `deploy-infrastructure-and-wallet.js` script is a **complete, self-contained
77
- **Passport Infrastructure** (proven stable base) - Factory + MultiCallDeploy
88
- **Nexus Core** (modern Account Abstraction) - K1Validator + Implementation
99
- **Hybrid Wallet Deployment** - Configurable deployment via Factory or MultiCallDeploy
10-
- **Complete 9-Step Coverage** - Implements all deployment steps (0-9) in one script
10+
- **Complete 11-Step Coverage** - Implements all deployment steps (0-10) in one script
1111
- **CFA Compatibility** - Uses `PassportCompatibleNexusFactory` for address compatibility
1212

1313
**⚠️ Note**: This script contains some legacy functions that are now redundant after the step-based approach implementation. Consider using `wallet-deployment.ts` for wallet-only deployments, which has been cleaned and optimized.
@@ -17,7 +17,7 @@ The `deploy-infrastructure-and-wallet.js` script is a **complete, self-contained
1717
| Feature | `deploy-infrastructure-and-wallet.js` | `wallet-deployment.ts` |
1818
|---------|---------------------------------------|------------------------|
1919
| **Purpose** | Complete infrastructure + wallet deployment | Wallet-only deployment using existing infrastructure |
20-
| **Dependencies** | Self-contained, no external files | Requires step artifacts (step0.json - step9.json) |
20+
| **Dependencies** | Self-contained, no external files | Requires step artifacts (step0.json - step10.json) |
2121
| **Code Status** | Contains some legacy functions (~60% redundant) | Cleaned & optimized (45% smaller) |
2222
| **Deployment Methods** | CFA Factory + MultiCallDeploy | CFA Factory + MultiCallDeploy (with robust fallback) |
2323
| **Use Case** | Fresh deployments, testing, development | Production wallet deployment |
@@ -33,7 +33,7 @@ The `deploy-infrastructure-and-wallet.js` script is a **complete, self-contained
3333

3434
### **Robust Architecture**
3535
- **Hybrid approach** combines the best of both systems
36-
- **Complete 9-step implementation** (all steps 0-9 in one script including NexusBootstrap, EntryPoint, and PassportCompatibleNexusFactory)
36+
- **Complete 11-step implementation** (all steps 0-10 in one script including NexusBootstrap, EntryPoint, PassportCompatibleNexusFactory, and K1ValidatorFactory)
3737
- **Dual deployment methods** (Factory and MultiCallDeploy)
3838
- **Proper timing** with verification between deployments
3939
- **Comprehensive verification** of all components

scripts/biconomy/README.md

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ scripts/biconomy/
1616
│ ├── step6.ts # Configure LatestWalletImplLocator → Nexus
1717
│ ├── step7.ts # Deploy NexusBootstrap (REQUIRED for Nexus)
1818
│ ├── step8.ts # Deploy/Configure EntryPoint (ERC-4337)
19-
│ └── step9.ts # Deploy PassportCompatibleNexusFactory (CFA)
19+
│ ├── step9.ts # Deploy PassportCompatibleNexusFactory (CFA)
20+
│ └── step10.ts # Deploy K1ValidatorFactory (Complete Factory)
2021
│ ├── step0.json # Step 0 deployment results
2122
│ ├── step1.json # Step 1 deployment results
2223
│ ├── step2.json # Step 2 deployment results
@@ -26,7 +27,8 @@ scripts/biconomy/
2627
│ ├── step6.json # Step 6 deployment results
2728
│ ├── step7.json # Step 7 deployment results
2829
│ ├── step8.json # Step 8 deployment results
29-
│ └── step9.json # Step 9 deployment results
30+
│ ├── step9.json # Step 9 deployment results
31+
│ └── step10.json # Step 10 deployment results
3032
├── deploy-infrastructure-and-wallet.js # Complete deployment script (all-in-one)
3133
├── wallet-deployment.ts # Step-based wallet deployment (CFA + MultiCall support)
3234
├── final-deployment.js # Legacy deployment script
@@ -113,6 +115,22 @@ Step 9: CFA-Compatible Factory Step 0: CREATE2 Foundation
113115
│ Old Passport │ │ Deterministic │
114116
│ Addresses │ │ Addresses │
115117
└─────────────────┘ └──────────────────┘
118+
119+
Step 10: Complete K1Validator Factory
120+
┌─────────────────┐
121+
│ K1ValidatorFactory│ ──uses──▶ Nexus Implementation
122+
│ (Official SDK) │ K1Validator
123+
│ │ NexusBootstrap
124+
└─────────────────┘ Registry (optional)
125+
126+
│ creates complete
127+
│ Nexus accounts with
128+
129+
┌─────────────────┐
130+
│ Fully Configured│
131+
│ Nexus Accounts │
132+
│ (SDK Compatible)│
133+
└─────────────────┘
116134
```
117135

118136
### Core Components
@@ -182,6 +200,9 @@ NODE_ENV=development npx hardhat run scripts/biconomy/steps/step8.ts --network l
182200

183201
# Step 9: Deploy PassportCompatibleNexusFactory (CFA compatibility)
184202
NODE_ENV=development npx hardhat run scripts/biconomy/steps/step9.ts --network localhost
203+
204+
# Step 10: Deploy K1ValidatorFactory (Complete Factory)
205+
NODE_ENV=development npx hardhat run scripts/biconomy/steps/step10.ts --network localhost
185206
```
186207

187208
### Method 2: Complete Deployment (Recommended)
@@ -213,7 +234,7 @@ USE_MULTICALL_DEPLOY=true NODE_ENV=development npx hardhat run scripts/biconomy/
213234
- **🎯 Dual Deployment Methods**: PassportCompatibleNexusFactory (CFA) + MultiCallDeploy (with graceful fallback)
214235
- **🔄 CFA Compatibility**: Maintains address compatibility with old Passport wallets
215236
- **🚀 ERC-4337 Testing**: Full UserOperation testing with real EntryPoint
216-
- **📋 Step-based**: Uses modular step artifacts (steps 0-9)
237+
- **📋 Step-based**: Uses modular step artifacts (steps 0-10)
217238
- **⚡ Robust Fallback**: MultiCallDeploy automatically falls back to Factory if interface issues occur
218239

219240
## Environment Variables
@@ -397,14 +418,6 @@ Development settings optimized for speed:
397418

398419
### Step 8: EntryPoint (ERC-4337)
399420
**Account Abstraction support for advanced wallet features**
400-
401-
### Step 9: PassportCompatibleNexusFactory (CFA)
402-
**CFA-compatible factory for seamless Passport address compatibility**
403-
- Deploys `PassportCompatibleNexusFactory` contract
404-
- Maintains address compatibility with old Passport wallets
405-
- Uses old Factory address for CFA calculations
406-
- Enables seamless migration without address changes
407-
408421
- **Purpose**: Enables ERC-4337 Account Abstraction functionality
409422
- **Features**:
410423
- UserOperation validation and execution
@@ -417,11 +430,39 @@ Development settings optimized for speed:
417430
- Falls back to MockEntryPoint for development if real EntryPoint unavailable
418431
- **Output**: `step8.json` with EntryPoint address and source type
419432

433+
### Step 9: PassportCompatibleNexusFactory (CFA)
434+
**CFA-compatible factory for seamless Passport address compatibility**
435+
- Deploys `PassportCompatibleNexusFactory` contract
436+
- Maintains address compatibility with old Passport wallets
437+
- Uses old Factory address for CFA calculations
438+
- Enables seamless migration without address changes
439+
440+
### Step 10: K1ValidatorFactory (Complete Factory)
441+
**Official SDK-compatible factory for complete Nexus account creation**
442+
- **Purpose**: Deploys the **correct** K1ValidatorFactory from official Biconomy SDK
443+
- **Features**:
444+
- Full Nexus account creation with proper initialization
445+
- Uses `initNexusWithSingleValidator` for complete setup
446+
- Integrates K1Validator, NexusBootstrap, and Registry
447+
- SDK-compatible account creation patterns
448+
- **Components**:
449+
- **ACCOUNT_IMPLEMENTATION**: Nexus smart account implementation
450+
- **K1_VALIDATOR**: ECDSA signature validation module
451+
- **BOOTSTRAPPER**: NexusBootstrap for proper initialization
452+
- **REGISTRY**: Optional registry for attesters (configurable)
453+
- **Benefits**:
454+
- **SDK Compatibility**: Creates accounts exactly like official Biconomy SDK
455+
- **Complete Initialization**: Accounts are fully configured and ready to use
456+
- **Registry Support**: Optional attester registry for enhanced security
457+
- **Deterministic Addresses**: Predictable account addresses via CREATE2
458+
- **Output**: `step10.json` with K1ValidatorFactory address and configuration
459+
420460
### Integration Notes
421461
- **Step 7** is **required** for Nexus wallets to function properly
422462
- **Step 8** is **optional** but recommended for full ERC-4337 support
423-
- Both steps integrate seamlessly with existing Passport infrastructure
424-
- Complete deployment now covers **9 steps** (0-8) for full functionality
463+
- **Step 10** provides **official SDK compatibility** for complete Nexus account creation
464+
- All steps integrate seamlessly with existing Passport infrastructure
465+
- Complete deployment now covers **11 steps** (0-10) for full functionality
425466

426467
## Support
427468

0 commit comments

Comments
 (0)