-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: DON'T review before merging previous PRs, (BitcoinRBF-Step3) zetaclient
watches BTC mempool stuck txs and bump fee
#3396
base: develop
Are you sure you want to change the base?
Conversation
…ForRegnetAndTestnet; code simplification
…e fee rate according to Bitcoin network type
…t-bitcoin-RBF-zetaclient-refactor-minimum
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
!!!WARNING!!! Be very careful about using Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203 Pay extra attention to the way |
zetaclient
watches BTC mempool stuck txs and bump feezetaclient
watches BTC mempool stuck txs and bump fee
zetaclient
watches BTC mempool stuck txs and bump feezetaclient
watches BTC mempool stuck txs and bump fee
…t-bitcoin-RBF-zetaclient-refactor-minimum
…t-bitcoin-RBF-zetaclient-implementation
…as a method of TSS PubKey
…ode simplification
…t-bitcoin-RBF-zetaclient-refactor-minimum
…t-bitcoin-RBF-zetaclient-refactor-minimum
…//github.com/zeta-chain/node into feat-bitcoin-RBF-zetaclient-refactor-minimum
…t-bitcoin-RBF-zetaclient-implementation
…//github.com/zeta-chain/node into feat-bitcoin-RBF-zetaclient-implementation
Description
This PR will replace #3306
The goals:
The fee change:
BTCGasPriceMultiplierFeeCharge = 2.0
multiplier.BTCGasPriceMultiplierSendTx = 1.5
multiplier for quick finality.25%
profit out of the fees paid by user, without worrying about stuck txs.How it works:
RBF
flag in every Bitcoin outbound.WatchMempoolTxs
inzetaclient
to monitor pending outbound txs, so we know how long the txs have been sitting in the Bitcoin mempool.zetaclient
will mark the outbound status asstuck
and trigger tx replacement usingRBF
andCPFP
.feeRateCap = 100
zetaclient
will ALWAYS use most recent fee rate (feed byzetacore
) to initiate new outbound transactions. The reason is that using an outdatedGasPrice
in CCTX struct is usually the root cause (not the Bitcoin network traffic) of stuck transactions, the low-fee problem needs to be solved at its root cause to reduce the chance of stuck txs. Similarly, whenGasPrice
in CCTX struct is higher than market, TSS signers will also use the most recent fee rate to send outbound and save gas fees.A few concepts and parameters introduced:
LastPendingOutbound
:Bitcoin outbounds are sequentially chained transactions by nonce. Given
N
pending txs[TX1, TX2, TX3, TX4]
in the mempool,zetaclient
only need to watch and bump the fee ofTX4
in order to clear all of them. According to BitcoinCPFP
strategy, the chained pending txs are treated as a package by miners. BumpingTX4
will increase the average fee rate of the whole txs package and make it more attractive to miners.minCPFPFeeBumpPercent
:It is set to
20%
as an exercise for the initial play. It is designed to balance effectiveness in replacing stuck tx while avoiding excessive sensitivity to fee market fluctuations. For example, given apaidRate == 10
, RBF will not happen until the market rate goes up toliveRate==12
.feeRateCap
:It is the maximum average fee rate for fee bumping.
100 sat/vB
is a chosen heuristic based on Bitcoin mempool statistics to avoid excessive (or accidental) fees.reservedRBFFees
:It is the amount of BTC reserved in the outbound transaction for fee bumping. It is set to
0.01 BTC
by default, which can bmp 10 transactions (1KB each) by100 sat/vB
. Most of the time, we have just 1 or 2 stuck transactions in the mempool and the signers will automatically stop signing new transactions by design, so the number0.01 BTC
is good enough.Closes: #1695