Files
proxmox/docs/06-besu/GAS_PRICE_RESOLUTION.md

163 lines
3.8 KiB
Markdown
Raw Normal View History

# Gas Price Issue - Resolution Guide
**Last Updated:** 2026-01-31
**Document Version:** 1.0
**Status:** Active Documentation
---
**Date**: 2026-01-18
**Issue**: Transaction not mined due to gas price below network minimum
**Status**: ⚠️ **RESOLUTION IDENTIFIED**
---
## 🔍 Problem Analysis
### Issue
- Transaction submitted with: **1000 wei** gas price
- Network requires: **1,000,000,000 wei** (1 gwei)
- Result: Transaction rejected by Besu, not included in any block
### Evidence
```bash
Transaction Hash: 0x1b786e061eefc0dc8dee4fc23071314f94096f8e701c978539e793a32ccd1012
Gas Price Used: 1000 wei
Effective Gas Price: 1000 wei
Block Hash: (empty - not mined)
```
### Configuration
From `config/chain138.json`:
```json
{
"gasPrice": "1000000000" // 1 gwei = 1,000,000,000 wei
}
```
**Gap**: Transaction used 1,000,000x less than required!
---
## ✅ Solution: Deploy with Dynamic Gas Price Calculation
### Option 1: Automated Deployment (Recommended)
Use the automated script that calculates gas price from API:
```bash
cd /home/intlc/projects/proxmox
./scripts/deploy-phase3-bridges-with-gas-api.sh
```
This script:
- ✅ Fetches current gas price from ChainID 138 RPC
- ✅ Respects minimum gas price from config (1 gwei)
- ✅ Applies safety multiplier (10% buffer)
- ✅ Deploys both bridges with optimal gas price
- ✅ Verifies deployments automatically
### Option 2: Manual Calculation
First, calculate optimal gas price:
```bash
cd /home/intlc/projects/proxmox
GAS_PRICE=$(./scripts/calculate-chain138-gas-price.sh)
echo "Using gas price: $GAS_PRICE wei"
```
Then deploy with calculated gas price:
```bash
cd /home/intlc/projects/proxmox/smom-dbis-138
PK="5373d11ee2cad4ed82b9208526a8c358839cbfe325919fb250f062a25153d1c8"
RPC="http://192.168.11.211:8545"
# Deploy WETH9 Bridge
forge script script/DeployCCIPWETH9Bridge.s.sol:DeployCCIPWETH9Bridge \
--rpc-url "$RPC" \
--broadcast \
--private-key "0x$PK" \
--gas-price "$GAS_PRICE" \
--slow \
-vvvv
# Deploy WETH10 Bridge
forge script script/DeployCCIPWETH10Bridge.s.sol:DeployCCIPWETH10Bridge \
--rpc-url "$RPC" \
--broadcast \
--private-key "0x$PK" \
--gas-price "$GAS_PRICE" \
--slow \
-vvvv
```
### Option 3: Fixed Gas Price (Fallback)
If gas API is unavailable, use minimum from config:
```bash
# Use 1 gwei (minimum required)
GAS_PRICE=1000000000
```
### Alternative: Use EIP-1559 Format
If the above doesn't work, try EIP-1559 format:
```bash
forge script script/DeployCCIPWETH9Bridge.s.sol:DeployCCIPWETH9Bridge \
--rpc-url "$RPC" \
--broadcast \
--private-key "0x$PK" \
--max-fee-per-gas 1000000000 \
--priority-fee-per-gas 100000000 \
--slow \
-vvvv
```
---
## 🧪 Verification After Deployment
```bash
# Check if contract is deployed
cast code 0x646e0026F8B5BCB94986377a25Da6f89BdCbBF6e --rpc-url "$RPC"
# Verify admin
cast call 0x646e0026F8B5BCB94986377a25Da6f89BdCbBF6e \
"admin()(address)" \
--rpc-url "$RPC"
# Expected: 0x4A666F96fC8764181194447A7dFdb7d471b301C8
# Verify router
cast call 0x646e0026F8B5BCB94986377a25Da6f89BdCbBF6e \
"ccipRouter()(address)" \
--rpc-url "$RPC"
# Expected: 0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e
# Verify functions exist
cast 4byte "addDestination(uint64,address)"
cast 4byte "getDestinationChains()(uint64[])"
```
---
## 📝 Notes
1. **Why `--slow` flag?**: Gives Foundry more time to submit and confirm transaction
2. **Gas Price Units**: Always use wei (not gwei) in forge commands
3. **Transaction Format**: Legacy (`--gas-price`) should work, but EIP-1559 is fallback
4. **Expected Cost**: 1,962,548 gas × 1 gwei = ~0.00196 ETH per deployment
---
**Status**: ✅ **RESOLUTION IDENTIFIED - READY TO DEPLOY**
**Next Action**: Run deployment commands with `--gas-price 1000000000` (1 gwei)
---
**Last Updated**: 2026-01-18