Gas simulation misses ~24k gas on paid MsgVote; --gas-adjustment 1.5 votes fail on v0.2.18 #2300
Summary
--gas auto underestimates a paid MsgVote by a fixed ~24,072 gas. With --gas-adjustment 1.5, votes passed only by a 0.07% margin before v0.2.18. v0.2.18 lowered the vote's base cost by 1,973 gas, so the same 24,072 now exceeds the 1.5× headroom and votes fail with out of gas. CheckTx still returns code=0, so the failure is silent for the sender.
Evidence (gonka-testnet-4, same voters, same harness, identical votes)
| Votes | Simulated | Used | Used − simulated | Used / simulated | Result at 1.5× |
|---|---|---|---|---|---|
| Proposals 6–10, v0.2.17 (heights 109575–153892) | 48,236 | 72,308 | 24,072 | 1.499 | pass (49–97 gas spare) |
| Proposal 12, v0.2.18 (height 155071) | 46,263 | 70,335 | 24,072 | 1.520 | code=11 |
- The gap is identical before and after the upgrade. v0.2.18 only moved both values down by 1,973.
- Re-voting with
--gas-adjustment 2.0works: 92,730 wanted, 70,437 used. - PoC messages are unaffected. Paid ones (
MsgPoCV2StoreCommit,MsgSubmitHardwareDiff) are simulated to within ~5% (wanted/used = 1.43 at 1.5×). Fee-exempt ones use fixed gas limits.
Likely cause (not confirmed)
Simulation runs with a zero fee, but the real tx pays fee = gas_wanted × 1ngonka. So the fee deduction (a bank transfer to the fee collector, which costs WritePerByte) is charged only on execution. Supporting clue: fee-0 votes on the same chain use ~50.7k gas, against ~72.4k for paid votes.
Impact
Any script, guide or wallet that votes, or sends other small paid txs, with --gas-adjustment 1.5 now fails silently on v0.2.18.
Suggested fix
- Include the fee deduction in the simulation (simulate with a non-zero fee), or add a fixed fee-deduction margin to the estimate.
- Until then, document
--gas-adjustment 2.0as the minimum for votes.
💬 Comments (1)
🔄 Auto-synced from Issue #2300 every hour.
@tcharchian fyi, minor