feat: adjustable fee rate mode#283
Open
frolvanya wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an “adjustable fee rate” mode for UTXO withdrawals so callers (and the CLI) can optionally auto-lower the effective fee rate to fit an on-chain max_gas_fee constraint, instead of always failing when the estimated gas fee exceeds that cap.
Changes:
- Introduces
FeeRate(Strict vs CapToMaxGasFee) inomni-connectorand wires it into BTC transfer submission paths. - Adds
utxo_utils::max_fee_rate_for_gas_fee()(an inverse helper for BTC gas fee estimation). - Exposes the behavior via
bridge-cliwith a new--fee-rate-mode {exact,adjustable}flag.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Cargo.lock | Bumps crate versions to reflect published changes. |
| bridge-sdk/utxo-utils/src/lib.rs | Refactors BTC tx size calc + adds inverse helper for deriving a max fee rate from a gas-fee cap. |
| bridge-sdk/utxo-utils/Cargo.toml | Bumps utxo-utils version. |
| bridge-sdk/connectors/omni-connector/src/omni_connector.rs | Adds FeeRate strategy and implements “cap to max_gas_fee” logic for BTC submission. |
| bridge-sdk/connectors/omni-connector/Cargo.toml | Bumps omni-connector version and changes edition to 2024. |
| bridge-cli/src/omni_connector_command.rs | Adds CLI FeeRateMode and plumbs it into connector calls. |
| bridge-cli/Cargo.toml | Bumps bridge-cli version. |
Comments suppressed due to low confidence (1)
bridge-sdk/connectors/omni-connector/src/omni_connector.rs:3621
CapToMaxGasFeemay not achieve its goal whenmax_gas_fee < 141(the constant overhead):max_fee_rate_for_gas_feewill computenew_rate = 0, butget_gas_feestill returns 141, so the adjustable path can never satisfymax_gas_feeandnear_submit_btc_transferwill still fail withInsufficientUTXOGasFee. Consider explicitly detecting this case (or, more generally, re-checkingnew_gas_fee <= max) and returning a clearer error early, so callers don’t expect the transaction to be broadcastable.
if allow_cap
&& let Some(max) = max_gas_fee
&& gas_fee > u128::from(max)
&& let Some(new_rate) =
utxo_utils::max_fee_rate_for_gas_fee(chain, num_inputs, num_outputs, max)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.