Skip to content

test: lower Bitcoin E2E deposit tx fee to make nightly test cheaper#3989

Merged
lumtis merged 1 commit intodevelopfrom
test-reduce-bitcoin-e2e-deposit-fee
Jun 19, 2025
Merged

test: lower Bitcoin E2E deposit tx fee to make nightly test cheaper#3989
lumtis merged 1 commit intodevelopfrom
test-reduce-bitcoin-e2e-deposit-fee

Conversation

@ws4charlie
Copy link
Contributor

@ws4charlie ws4charlie commented Jun 19, 2025

Description

The current fee 0.0005 BTC used in the E2E deposit test is quite generous and should be reduced for nightly CI test.

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

  • Chores
    • Updated the Bitcoin deposit transaction fee used in end-to-end tests to a new fixed value, ensuring more accurate fee calculations during test runs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 19, 2025

📝 Walkthrough

Walkthrough

A new constant for the Bitcoin deposit transaction fee was introduced in the E2E runner code. The transaction fee calculation within the sendToAddrWithMemo method now references this constant instead of a hardcoded value, standardizing fee usage across Bitcoin transaction construction in end-to-end tests.

Changes

File(s) Change Summary
e2e/runner/bitcoin.go Added BTCDepositTxFee constant; updated transaction fee calculation to use the new constant.

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner
    participant BitcoinRunner

    TestRunner->>BitcoinRunner: sendToAddrWithMemo(address, memo, amount)
    BitcoinRunner->>BitcoinRunner: Calculate requiredAmount = amount + BTCDepositTxFee
    BitcoinRunner->>BitcoinRunner: Select UTXOs to cover requiredAmount
    BitcoinRunner->>BitcoinRunner: Construct transaction with fee = BTCDepositTxFee
    BitcoinRunner->>BitcoinRunner: Broadcast transaction
    BitcoinRunner-->>TestRunner: Return transaction result
Loading

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f24176 and aa1eaa7.

📒 Files selected for processing (1)
  • e2e/runner/bitcoin.go (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.go`: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

**/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

  • e2e/runner/bitcoin.go
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: build-zetanode
  • GitHub Check: build
  • GitHub Check: gosec
  • GitHub Check: rpcimportable
  • GitHub Check: lint
  • GitHub Check: build-and-test
  • GitHub Check: semgrep/ci
  • GitHub Check: analyze (go)
🔇 Additional comments (2)
e2e/runner/bitcoin.go (2)

39-41: Well-structured constant declaration with comprehensive documentation.

The constant extraction follows clean code principles by replacing magic numbers with a named constant. The documentation appropriately explains both the value and the context (E2E tests with approximate fee rate).


297-297: Proper implementation of the fee constant usage.

The fee calculation correctly utilizes the new constant and maintains the existing conversion logic to satoshis. This change successfully achieves the PR objective of reducing E2E test costs while preserving code clarity.

Verify that no other hardcoded Bitcoin fees exist in the codebase that should also be updated for consistency:

#!/bin/bash
# Description: Search for other hardcoded Bitcoin fee values that might need updating
# Expected: Should find minimal or no other hardcoded fee values in E2E test files

# Search for potential hardcoded Bitcoin fee patterns
rg -A 3 -B 3 "0\.0005|0\.00005|0\.0001" --type go e2e/
rg -A 3 -B 3 "(fee|Fee).*=.*0\." --type go e2e/
rg -A 3 -B 3 "btcutil\.Amount.*\*.*0\." --type go e2e/
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ws4charlie ws4charlie marked this pull request as ready for review June 19, 2025 00:34
@ws4charlie ws4charlie requested a review from a team as a code owner June 19, 2025 00:34
@ws4charlie ws4charlie added E2E E2E tests related chain:bitcoin Bitcoin chain related labels Jun 19, 2025
@ws4charlie ws4charlie requested a review from morde08 June 19, 2025 00:34
Copy link
Collaborator

@morde08 morde08 left a comment

Choose a reason for hiding this comment

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

for e2e specifically can we go lower on fees or would that cause issues?

@ws4charlie
Copy link
Contributor Author

for e2e specifically can we go lower on fees or would that cause issues?

0.00003 BTC evaluates to a 10 satoshis / vB, which is also a generous gas price. Providing low fee in a deposit tx may lead to long pending transaction.

@ws4charlie ws4charlie added the no-changelog Skip changelog CI check label Jun 19, 2025
@lumtis lumtis added this pull request to the merge queue Jun 19, 2025
Merged via the queue into develop with commit d43f906 Jun 19, 2025
59 of 67 checks passed
@lumtis lumtis deleted the test-reduce-bitcoin-e2e-deposit-fee branch June 19, 2025 08:13
lumtis pushed a commit that referenced this pull request Jul 2, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jul 9, 2025
* add empty test dapp

* add test

* generate

* update gomod

* fix imports

* smaller message

* fix size

* ci: generate TypeScript types (#3978)

* test: lower Bitcoin E2E deposit tx fee to make nightly test cheaper (#3989)

lower Bitcoin E2E deposit test tx fee

* test: add connector fund migration e2e test using contracts only  (#3976)

* update go mod

* add a new message for migrating funds

* add migrate funds to e2e

* rebase from develop

* add v2 e2e test to check flow

* add zeta gateway deposit to zetaclient

* add github workflow

* update comments

* fix code formating

* fix code formating

* fix code formating

* fix unit tests

* fix unit tests

* revert to old command to start e2e test

* remove message for migration and refactor to using contract directly

* add changelog

* generate files after removing new message

* update generated files

* update generated files

* resolve comments 1

* remove v2 from naming

* generate files

* chore: fix some comments (#3993)

Signed-off-by: yingshanghuangqiao <yingshanghuangqiao@foxmail.com>

* feat(ton): integrate new functionality (#3977)

* Add ton.call operation

* vote inbound call

* update ton's gateway code

* e2e: ton_to_zevm_call

* Add increaseSeqno parsing

* ton: signer: increase_seqno integration

* ton: observer: increase_seqno integration

* Fix bugs. E2E for increase_seqno

* Update changelog

* Address PR comments

* Simplify inbound voting

* outbounds: validate nonce & simplify code

* bump gw

* refactor: update generated files (#4000)

update generated files

* ci: run simualtion tests nightly (#3999)

* update sim.yml

* add changelog

* update generated files

* generate

* add test for deposit with big payload

* generate

* update contract version

* try removing test

* fix wrong method called

* remove redundant log

* generate

* add version condition

---------

Signed-off-by: yingshanghuangqiao <yingshanghuangqiao@foxmail.com>
Co-authored-by: Denis Fadeev <denis@fadeev.org>
Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com>
Co-authored-by: Tanmay <tanmay@zetachain.com>
Co-authored-by: yingshanghuangqiao <yingshanghuangqiao@foxmail.com>
Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chain:bitcoin Bitcoin chain related E2E E2E tests related no-changelog Skip changelog CI check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants