Skip to content
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: bitcoin dynamic depositor fee #1747

Merged
merged 10 commits into from
Feb 13, 2024
Merged

Conversation

ws4charlie
Copy link
Contributor

@ws4charlie ws4charlie commented Feb 12, 2024

Description

  1. Use Bitcoin block average fee rate in depositor fee calculation for Athens3 and mainnet
  2. The tentative upgrade height for the dynamic fee is set at 832000 for mainnet. (in 14 days)

Closes: 1698

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Go unit tests

The calculated fee rate of 9998/10000 mainnet blocks matched mempool.space, 2/10000 of blocks saw a diff of 1 sat/vB.

result_mainnet.txt
result_testnet.txt
image
image
image

@ws4charlie ws4charlie changed the title feat: bitcoin dynamic depositor fee fix: bitcoin dynamic depositor fee Feb 12, 2024
Copy link

github-actions bot commented Feb 12, 2024

!!!WARNING!!!
nosec detected in the following files: zetaclient/bitcoin/bitcoin_client.go, zetaclient/bitcoin/inbound_tracker.go, zetaclient/bitcoin/utils.go

Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.

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
Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.

Pay extra attention to the way #nosec is being used in the files listed above.

@github-actions github-actions bot added the nosec label Feb 12, 2024
@ws4charlie ws4charlie changed the title fix: bitcoin dynamic depositor fee feat: bitcoin dynamic depositor fee Feb 12, 2024
Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding zetaclient/testdata/bitcoin_block_828440.json
Do we need the entire data for the block?
I think we should trim to only keep what we need.

zetaclient/utils.go Outdated Show resolved Hide resolved
zetaclient/bitcoin_client_test.go Outdated Show resolved Hide resolved
@ws4charlie
Copy link
Contributor Author

Regarding zetaclient/testdata/bitcoin_block_828440.json Do we need the entire data for the block? I think we should trim to only keep what we need.

Good idea. I can set the tx input/output as nil to make the block compact.

@ws4charlie
Copy link
Contributor Author

Regarding zetaclient/testdata/bitcoin_block_828440.json Do we need the entire data for the block? I think we should trim to only keep what we need.

trimmed in commit

common/constant.go Outdated Show resolved Hide resolved
zetaclient/bitcoin/bitcoin_client_rpc_test.go Outdated Show resolved Hide resolved
zetaclient/bitcoin/bitcoin_client_test.go Outdated Show resolved Hide resolved
zetaclient/bitcoin/bitcoin_client_test.go Show resolved Hide resolved
@ws4charlie ws4charlie merged commit 165fe5d into develop Feb 13, 2024
15 checks passed
@ws4charlie ws4charlie deleted the feat-btc-dynamic-deposit-fee branch February 13, 2024 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider using a more realistic fee rate (not fixed 20 sats/vB) to calculate depositor fee
3 participants