Conversation
…--all Sending 1.99 QTC from an account holding exactly 2 QTC was refused right after mainnet enacted spec 153: Insufficient balance for send. Have: 2 QTC, Need: 2.000167025 QTC (estimated fee: 0.010167025 QTC) subxt's partial_fee_estimate calls TransactionPaymentApi_query_info at latest_finalized_block_ref. QPoW finality trails the head by ~100 blocks, so the estimate was computed by spec 152 -- the runtime the upgrade had just replaced -- and 153 cut FEE_SCALE tenfold. The real fee was ~0.001 QTC. The transfer was affordable; only the quote was stale. Estimate against the same block as every other read, via QuantusClient::partial_fee. Unify the finality choice. ExecutionMode::finalized already decided how long to wait for a transaction; it now also decides which block reads are taken at. Reads happen in ~80 places that have no reason to carry an ExecutionMode, so main publishes the flag once with ExecutionMode::install and QuantusClient::get_latest_block consults it -- one switch for waits and reads. wormhole_tip_block's own head/finalized branch and at_finalized_block go away, since get_latest_block already answers that question. --finalized-tx becomes --finalized (kept as an alias) because it no longer only governs transactions. Add send --all, which submits Balances::transfer_all and lets the chain deduct the exact fee. Sweeping an account by subtracting an estimate cannot be done reliably -- too low strands dust, too high is refused -- and --keep-alive chooses between reaping the account and leaving the existential deposit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found live, minutes after mainnet enacted spec 153. Sending 1.99 QTC from an account holding exactly 2 QTC was refused:
The transfer was affordable. Only the quote was stale.
Cause
partial_fee_estimatecallsTransactionPaymentApi_query_infoatlatest_finalized_block_ref(subxttx_client.rs:583). QPoW finality trails the head, so the quote came from the runtime the upgrade had just replaced — and 153 cutFEE_SCALEtenfold. Measured on mainnet at the time:Real fee ~0.001 QTC; quoted 0.0102.
1. Estimate at the block everything else reads
QuantusClient::partial_feeruns the same runtime API atget_latest_block(). Replaces bothpartial_fee_estimatecall sites (send.rs,cold_signing.rs).2. One switch for finality
An audit of every
finalizedreference found those two sites were the only wrong ones — everything else is a deliberate--finalized-txopt-in, or already fixed by #152 (collect-rewards proofs) and #154 (client metadata). So rather than add a parallel mechanism, this unifies what exists.ExecutionMode::finalizedalready decided how long to wait for a transaction. It now also decides which block reads are taken at. Reads happen in ~80 places with no reason to carry anExecutionMode, somainpublishes the flag once viaExecutionMode::install, andget_latest_blockconsults it — one switch governs waits and reads, the waywait_for_transactionalready governs waiting.That makes
wormhole_tip_block's own head/finalized branch redundant, andat_finalized_blockunreachable; both go.--finalized-txbecomes--finalized(kept as a clap alias) since it no longer governs only transactions.Default is the head.
--finalizedopts back in for callers who want finality's guarantees and will wait ~20 minutes for them.3.
send --allSweeping by subtracting an estimate cannot be made reliable — too low strands dust, too high is refused, which is exactly what happened above.
--allsubmitsBalances::transfer_alland lets the chain deduct the exact fee.--keep-alivechooses between reaping the account and leaving the existential deposit.--amountand--allare mutually exclusive, enforced by clap.Verification
--allbuildsBalances::transfer_all, and a fixed amount still buildstransfer_allow_deathSKIP_CIRCUIT_BUILD=1 cargo clippy --all-targets --locked -- -D warningscleancargo +nightly fmt --all -- --checkcleanFollow-up, not in this PR
COMPATIBLE_RUNTIMESstill tops out at 149, so every mainnet command printsspecVersion=153 … newer than this CLI's tested list. Cosmetic —transaction_versionnever moved off 6 — but all three chains are on 153 now and it should be bumped.