fix(sdk-coin-flrp): add correct C-chain atomic import gas formula - #9378
Closed
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Closed
fix(sdk-coin-flrp): add correct C-chain atomic import gas formula#9378bitgo-ai-agent-dev[bot] wants to merge 1 commit into
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Conversation
The coreth gas formula for an atomic import is: gas = txByteLen × 1 + numSigs × 1000 + AtomicTxBaseCost(10000) Wallet-platform was computing ~5700 gas (missing the 10k base cost), which underpriced the fee at elevated base fees (e.g. 500 gwei on Coston2 requires ~5.66M nFLR but only ~2.85M was provided). Add `calcImportCGas(txByteLen, numSigs)` and `calcImportCFee(txByteLen, numSigs, baseFeeNanoFlr, multiplier=2n)` to sdk-coin-flrp/utils and export them from the lib index. Also add `importFeeMultiplier = 2` to FlareP / FlarePTestnet statics so wallet-platform can read the recommended volatility buffer from the network config. Ticket: CECHO-1820 Session-Id: 9f75098f-e910-4499-a1d8-721714606982 Task-Id: e8063c60-329d-4d80-9a39-725b4abc5ade
Contributor
bitgo-ai-agent-dev
Bot
force-pushed
the
cecho-1820/fix-flare-atomic-import-gas-estimate
branch
from
July 29, 2026 06:43
f7a85c2 to
d47a626
Compare
ralph-bitgo
Bot
force-pushed
the
cecho-1820/fix-flare-atomic-import-gas-estimate
branch
from
July 29, 2026 06:43
d47a626 to
33640ae
Compare
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.
What
calcImportCGas(txByteLen, numSigs)tosdk-coin-flrp/src/lib/utils.tsimplementing the correct coreth gas formula:txByteLen × 1 + numSigs × 1000 + AtomicTxBaseCost(10000)calcImportCFee(txByteLen, numSigs, baseFeeNanoFlr, multiplier=2n)that multiplies the gas estimate by the live C-chain base fee with a 2× volatility buffersdk-coin-flrplib indeximportFeeMultiplier = 2toFlarePandFlarePTestnetnetwork statics so wallet-platform can read the recommended buffer from network configWhy
AtomicTxBaseCost), resulting in 2.85M nFLR baked in when the node required ~5.66M nFLR. The import fails withinputs < outputs + requiredFee.calcImportCGas/calcImportCFeeinstead of maintaining its own (broken) estimate.Test plan
modules/sdk-coin-flrp/test/unit/lib/utils.tsall passsdk-coin-flrpandstaticsFlrPLib.calcImportCFee(txByteLen, numSigs, liveBaseFee)instead of the static gas estimateTicket: CECHO-1820