|
125 | 125 | wait_for_anvil "$ANVIL_RPC" |
126 | 126 |
|
127 | 127 | # ─── Step 1b: Drain inherited excess blob gas ──────────────────────────────── |
128 | | -# Anvil 1.0.0 predates Fusaka: when forking post-Fusaka mainnet state it keeps |
| 128 | +# Anvil ≤1.5.x predates Fusaka: when forking post-Fusaka mainnet state it keeps |
129 | 129 | # the forked excessBlobGas but prices blob gas with the Dencun formula, so the |
130 | 130 | # blob base fee explodes (~1e18 wei) and every commit tx fails with |
131 | 131 | # "Insufficient funds". Mine empty blocks until the excess drains away |
132 | | -# (excess decays by ~1/8 per empty block under Dencun rules). |
133 | | -log_info "Draining inherited excess blob gas..." |
| 132 | +# (excess decays by ~1/8 per empty block under Dencun rules). On Anvil ≥1.6.0 |
| 133 | +# (Osaka/Fusaka-aware) the forked fee is already sane and this loop is a no-op. |
| 134 | +# Note: `cast blob-base-fee` was removed in cast 1.6+; query eth_blobBaseFee. |
| 135 | +log_info "Checking inherited blob base fee..." |
134 | 136 | for _ in $(seq 1 8); do |
135 | | - blob_fee=$(cast blob-base-fee --rpc-url "$ANVIL_RPC" 2>/dev/null || echo 0) |
136 | | - # Stop once the blob base fee is below 1 gwei (1e9 wei). |
137 | | - if [[ -z "$blob_fee" || "$blob_fee" -lt 1000000000 ]]; then |
| 137 | + blob_fee_hex=$(cast rpc eth_blobBaseFee --rpc-url "$ANVIL_RPC" 2>/dev/null | tr -d '"') |
| 138 | + blob_fee=$(printf '%d' "$blob_fee_hex" 2>/dev/null || echo 0) |
| 139 | + # Stop once the blob base fee is below 1e16 wei. The old bug produced |
| 140 | + # ~1e18; a Fusaka-aware fork sits around 1e13 (EIP-7918 floor is |
| 141 | + # 2^13 × execution base fee), which the relayer can afford. |
| 142 | + if [[ "$blob_fee" -lt 10000000000000000 ]]; then |
138 | 143 | break |
139 | 144 | fi |
140 | 145 | log_info " blob base fee = $blob_fee wei; mining 100 empty blocks..." |
141 | 146 | cast rpc anvil_mine 100 --rpc-url "$ANVIL_RPC" >/dev/null 2>&1 |
142 | 147 | done |
143 | | -blob_fee=$(cast blob-base-fee --rpc-url "$ANVIL_RPC" 2>/dev/null || echo unknown) |
144 | 148 | log_ok " blob base fee = $blob_fee wei" |
145 | 149 |
|
146 | 150 | # ─── Step 2: Reset ScrollChain miscData ────────────────────────────────────── |
|
0 commit comments