144 lines
4.4 KiB
Markdown
144 lines
4.4 KiB
Markdown
|
|
# Comprehensive Code Review and Fixes
|
||
|
|
|
||
|
|
**Date**: 2025-12-24
|
||
|
|
**Status**: ✅ All issues fixed
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## ✅ Fixed Issues Summary
|
||
|
|
|
||
|
|
### 1. Test Event Emission Errors
|
||
|
|
|
||
|
|
**Problem**: Tests were trying to emit events from interfaces/abstract contracts, which is not allowed in Solidity.
|
||
|
|
|
||
|
|
**Fixed Files**:
|
||
|
|
- ✅ `test/compliance/CompliantUSDTTest.t.sol` - Added helper event `ValueTransferDeclared`
|
||
|
|
- ✅ `test/emoney/unit/AccountWalletRegistryTest.t.sol` - Added helper events `AccountWalletLinked`, `AccountWalletUnlinked`
|
||
|
|
- ✅ `test/emoney/unit/RailEscrowVaultTest.t.sol` - Added helper events `Locked`, `Released`
|
||
|
|
- ✅ `test/emoney/unit/SettlementOrchestratorTest.t.sol` - Added helper events `Submitted`, `Rejected`
|
||
|
|
- ✅ `test/emoney/unit/RailTriggerRegistryTest.t.sol` - Added helper events `TriggerCreated`, `TriggerStateUpdated`
|
||
|
|
- ✅ `test/emoney/unit/ISO20022RouterTest.t.sol` - Added helper events `OutboundSubmitted`, `InboundSubmitted`
|
||
|
|
|
||
|
|
**Solution**: Added helper event definitions in each test contract that match the interface event signatures.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 2. Documentation Tag Mismatches
|
||
|
|
|
||
|
|
**Problem**: `@return` tags didn't match renamed return parameters.
|
||
|
|
|
||
|
|
**Fixed Files**:
|
||
|
|
- ✅ `contracts/mirror/TransactionMirror.sol` - Updated `@return tx` → `@return mirroredTx`
|
||
|
|
- ✅ `contracts/reserve/OraclePriceFeed.sol` - Updated `@return needsUpdate` → `@return updateNeeded`
|
||
|
|
- ✅ `contracts/reserve/PriceFeedKeeper.sol` - Updated `@return needsUpdate` → `@return updateNeeded`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 3. Variable Name Conflicts
|
||
|
|
|
||
|
|
**Problem**: Return variables had same names as functions or builtin symbols.
|
||
|
|
|
||
|
|
**Fixed Files**:
|
||
|
|
- ✅ `contracts/mirror/TransactionMirror.sol` - Renamed `tx` → `mirroredTx`
|
||
|
|
- ✅ `contracts/reserve/OraclePriceFeed.sol` - Renamed return `needsUpdate` → `updateNeeded`
|
||
|
|
- ✅ `contracts/reserve/PriceFeedKeeper.sol` - Renamed return `needsUpdate` → `updateNeeded`, fixed assignments
|
||
|
|
- ✅ `test/utils/TokenRegistryTest.t.sol` - Renamed constructor param `decimals` → `decimalsValue`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 4. Missing Override Specifiers
|
||
|
|
|
||
|
|
**Problem**: Overriding functions missing `override` keyword.
|
||
|
|
|
||
|
|
**Fixed Files**:
|
||
|
|
- ✅ `script/DeployWETH9WithCREATE.s.sol` - Added `override` to `computeCreateAddress`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 5. Wrong Constructor Arguments
|
||
|
|
|
||
|
|
**Problem**: Constructor calls with incorrect argument counts.
|
||
|
|
|
||
|
|
**Fixed Files**:
|
||
|
|
- ✅ `script/DeployCCIPSender.s.sol` - Added missing `oracleAggregator` and `feeToken` parameters
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 6. Console.log Syntax Errors
|
||
|
|
|
||
|
|
**Problem**: Incorrect console.log syntax in scripts.
|
||
|
|
|
||
|
|
**Fixed Files**:
|
||
|
|
- ✅ `script/reserve/CheckUpkeep.s.sol` - Fixed console.log format
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 7. Critical Role Permission Fix
|
||
|
|
|
||
|
|
**Problem**: TokenFactory138 calls PolicyManager functions requiring `POLICY_OPERATOR_ROLE`, but wasn't granted this role.
|
||
|
|
|
||
|
|
**Fixed Files**:
|
||
|
|
- ✅ `script/emoney/DeployChain138.s.sol` - Added role grant for TokenFactory138:
|
||
|
|
```solidity
|
||
|
|
// Grant POLICY_OPERATOR_ROLE to TokenFactory138 so it can configure tokens during deployment
|
||
|
|
policyManager.grantRole(policyManager.POLICY_OPERATOR_ROLE(), address(factory));
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## ✅ TokenFactory138 Status
|
||
|
|
|
||
|
|
### Contract Analysis
|
||
|
|
- ✅ **Compilation**: Should compile with `--via-ir`
|
||
|
|
- ✅ **Dependencies**: All dependencies exist and compile
|
||
|
|
- ✅ **Role Permissions**: Fixed - TokenFactory138 now gets POLICY_OPERATOR_ROLE
|
||
|
|
- ✅ **Deployment Script**: Fixed and ready
|
||
|
|
|
||
|
|
### Deployment Requirements
|
||
|
|
1. ✅ ComplianceRegistry (eMoney) - Must be deployed first
|
||
|
|
2. ✅ DebtRegistry - Must be deployed first
|
||
|
|
3. ✅ PolicyManager - Must be deployed first
|
||
|
|
4. ✅ eMoneyToken (implementation) - Must be deployed first
|
||
|
|
5. ✅ TokenFactory138 - Can be deployed after all above
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 📋 Verification Checklist
|
||
|
|
|
||
|
|
- [x] All test event emissions fixed
|
||
|
|
- [x] All documentation tags fixed
|
||
|
|
- [x] All variable name conflicts resolved
|
||
|
|
- [x] All override specifiers added
|
||
|
|
- [x] All constructor arguments fixed
|
||
|
|
- [x] All console.log syntax fixed
|
||
|
|
- [x] TokenFactory138 role permissions fixed
|
||
|
|
- [ ] Compilation test (run `forge build --via-ir`)
|
||
|
|
- [ ] Deployment ready
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🚀 Next Steps
|
||
|
|
|
||
|
|
1. **Test Compilation**:
|
||
|
|
```bash
|
||
|
|
cd /home/intlc/projects/proxmox/smom-dbis-138
|
||
|
|
forge build --via-ir
|
||
|
|
```
|
||
|
|
|
||
|
|
2. **If Compilation Succeeds, Deploy**:
|
||
|
|
```bash
|
||
|
|
source .env
|
||
|
|
forge script script/emoney/DeployChain138.s.sol:DeployChain138 \
|
||
|
|
--rpc-url $RPC_URL \
|
||
|
|
--broadcast \
|
||
|
|
--legacy \
|
||
|
|
--gas-price 20000000000 \
|
||
|
|
--via-ir \
|
||
|
|
-vv
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Last Updated**: 2025-12-24
|
||
|
|
|