- Organized 252 files across project - Root directory: 187 → 2 files (98.9% reduction) - Moved configuration guides to docs/04-configuration/ - Moved troubleshooting guides to docs/09-troubleshooting/ - Moved quick start guides to docs/01-getting-started/ - Moved reports to reports/ directory - Archived temporary files - Generated comprehensive reports and documentation - Created maintenance scripts and guides All files organized according to established standards.
158 lines
4.2 KiB
Markdown
158 lines
4.2 KiB
Markdown
# Etherscan Bytecode Mismatch - Troubleshooting Guide
|
|
|
|
**Error**: "Unable to find matching Contract Bytecode and ABI"
|
|
**Contract**: `0x89dd12025bfCD38A168455A44B400e913ED33BE2`
|
|
|
|
---
|
|
|
|
## 🔍 Root Cause
|
|
|
|
The bytecode mismatch occurs when the compiler settings used for verification don't match the settings used during deployment.
|
|
|
|
**Key Finding**: The contract was deployed with `--via-ir` flag, which is likely the issue.
|
|
|
|
---
|
|
|
|
## ✅ Solution: Try These Settings in Order
|
|
|
|
### Option 1: With Via IR Enabled (MOST LIKELY)
|
|
|
|
**Settings**:
|
|
- **Compiler Type**: `SINGLE FILE / CONCATENATED METHOD`
|
|
- **Compiler Version**: `v0.8.20+commit.a1b79de6`
|
|
- **License**: `MIT License (MIT)`
|
|
- **Optimization**: `Yes` (200 runs)
|
|
- **Via IR**: ✅ **YES** ← **This is likely the issue!**
|
|
|
|
**Why**: The deployment script used `--via-ir` flag, so verification must also use via-ir.
|
|
|
|
---
|
|
|
|
### Option 2: Without Via IR
|
|
|
|
**Settings**:
|
|
- **Compiler Type**: `SINGLE FILE / CONCATENATED METHOD`
|
|
- **Compiler Version**: `v0.8.20+commit.a1b79de6`
|
|
- **License**: `MIT License (MIT)`
|
|
- **Optimization**: `Yes` (200 runs)
|
|
- **Via IR**: `No`
|
|
|
|
**Try this if Option 1 fails**.
|
|
|
|
---
|
|
|
|
### Option 3: Different Compiler Version
|
|
|
|
If the exact commit hash doesn't match, try:
|
|
- `v0.8.20` (without commit hash)
|
|
- Or check the exact compiler version from the deployment transaction
|
|
|
|
---
|
|
|
|
## 🔧 Additional Troubleshooting Steps
|
|
|
|
### 1. Verify Constructor Arguments
|
|
|
|
**ABI-Encoded Constructor Arguments**:
|
|
```
|
|
0x00000000000000000000000080226fc0ee2b096224eeac085bb9a8cba1146f7d000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
|
|
```
|
|
|
|
**Decoded**:
|
|
1. `_ccipRouter`: `0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D`
|
|
2. `_weth9`: `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`
|
|
3. `_feeToken`: `0x514910771AF9Ca656af840dff83E8264EcF986CA`
|
|
|
|
**Verify**: Double-check these addresses are correct.
|
|
|
|
---
|
|
|
|
### 2. Check Source Code
|
|
|
|
Ensure the flattened contract source code matches exactly what was deployed:
|
|
- **File**: `docs/CCIPWETH9Bridge_flattened.sol`
|
|
- **Lines**: 396 lines
|
|
- **Includes**: IRouterClient interface and IERC20 interface
|
|
|
|
---
|
|
|
|
### 3. Verify Compiler Settings Match
|
|
|
|
From `foundry.toml`:
|
|
- `solc_version = "0.8.20"`
|
|
- `optimizer = true`
|
|
- `optimizer_runs = 200`
|
|
- `via_ir = false` (default, but deployment used `--via-ir`)
|
|
|
|
**Important**: The deployment used `--via-ir` flag, which overrides the default `via_ir = false` setting.
|
|
|
|
---
|
|
|
|
### 4. Try Standard JSON Input Method
|
|
|
|
If single-file method continues to fail:
|
|
|
|
1. **Generate Standard JSON**:
|
|
```bash
|
|
cd /home/intlc/projects/smom-dbis-138
|
|
forge build --via-ir --force
|
|
```
|
|
|
|
2. **Use Standard JSON Input** on Etherscan:
|
|
- Select "Standard JSON Input" instead of "Single file"
|
|
- Upload the Standard JSON from build artifacts
|
|
|
|
---
|
|
|
|
## 📋 Deployment Information
|
|
|
|
From `broadcast/DeployCCIPWETH9Bridge.s.sol/1/run-latest.json`:
|
|
|
|
- **Deployment Transaction**: `0x424b51cac9bf78c59629af93b8bcdabe8fee6235458785da32bec933bac1051d`
|
|
- **Block Number**: `0x16afbd0` (23,844,816)
|
|
- **Deployer**: `0x4a666f96fc8764181194447a7dfdb7d471b301c8`
|
|
- **Constructor Args**:
|
|
- `0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D`
|
|
- `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`
|
|
- `0x514910771AF9Ca656af840dff83E8264EcF986CA`
|
|
|
|
**Note**: The broadcast file shows a different contract address (`0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6`), which suggests the contract at `0x89dd12025bfCD38A168455A44B400e913ED33BE2` may have been deployed separately or with different settings.
|
|
|
|
---
|
|
|
|
## 🎯 Recommended Action
|
|
|
|
**Try Option 1 first** (with Via IR: YES):
|
|
|
|
1. Go to Etherscan verification page
|
|
2. Select **Via IR: YES**
|
|
3. Use all other settings as before
|
|
4. Paste the flattened contract code
|
|
5. Enter constructor arguments
|
|
6. Submit
|
|
|
|
If that fails, try Option 2 (Via IR: NO), then Option 3 (different compiler version).
|
|
|
|
---
|
|
|
|
## 🔍 Verify Bytecode Match
|
|
|
|
To verify the bytecode matches:
|
|
|
|
```bash
|
|
# Get deployed bytecode
|
|
cast code 0x89dd12025bfCD38A168455A44B400e913ED33BE2 --rpc-url $ETHEREUM_MAINNET_RPC > deployed.bytecode
|
|
|
|
# Compile with via-ir
|
|
cd /home/intlc/projects/smom-dbis-138
|
|
forge build --via-ir --force
|
|
|
|
# Compare bytecode from build artifacts
|
|
```
|
|
|
|
---
|
|
|
|
**Last Updated**: $(date)
|
|
**Status**: ⚠️ **TROUBLESHOOTING - TRY VIA IR: YES**
|
|
|