Skip to content

Conversation

@bhandras
Copy link
Member

This commit changes all new Bitcoin transactions from version 2 to version 3 (TRUC - Topologically Restricted Until Confirmed) as defined in BIP 431. Version 3 transactions provide better fee-bumping and pinning protection, which is beneficial for Taproot Assets anchor transactions.

@gemini-code-assist
Copy link

Summary of Changes

Hello @bhandras, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request systematically updates the default Bitcoin transaction version to 3 (TRUC) across various components of the system. This foundational change is implemented to leverage the improved security features of BIP 431, such as enhanced fee-bumping and pinning protection, which are critical for the robustness of Taproot Assets. The update is accompanied by comprehensive testing to confirm the new version's adoption and ensure seamless integration with existing data.

Highlights

  • Transaction Version Upgrade: All newly created Bitcoin transactions within the codebase are now initialized as version 3, moving from previous versions (primarily version 2, with one instance from version 1). This change aligns with BIP 431 (TRUC) to enhance fee-bumping and pinning protection, particularly beneficial for Taproot Assets anchor transactions.
  • New Test Cases for Version 3 Transactions: New tests have been introduced to explicitly verify that newly created transactions are indeed version 3. Additionally, backward compatibility tests ensure that the v3-enabled codebase can correctly load and verify existing proofs that were generated using version 2 transactions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly updates the Bitcoin transaction version from 2 to 3 across the codebase, aligning with BIP 431 for TRUC transactions. The change is consistently applied, and the inclusion of new tests to verify the transaction version and ensure backward compatibility with v2 proofs is a great addition. My review includes a couple of suggestions to improve code clarity and maintainability.

proof := proofs[0]

require.Equal(t, int32(3), proof.AnchorTx.Version,
"Post-commit b3562461: all new transactions should be v3")

Choose a reason for hiding this comment

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

medium

It's great that you've included a commit hash in this assertion message. However, it might be even more helpful to also include a reference to the BIP (BIP 431) that introduces v3 transactions. This would provide more context for future developers.

}

txTemplate := wire.NewMsgTx(2)
// TODO(bhandras)

Choose a reason for hiding this comment

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

medium

This TODO was added without any context. Could you please clarify what this refers to or remove it if it's not needed?


txTemplate := wire.NewMsgTx(2)
// TODO(bhandras)
txTemplate := wire.NewMsgTx(3)

Choose a reason for hiding this comment

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

medium

To improve maintainability and avoid the use of magic numbers, it would be beneficial to define a constant for the new transaction version, for example const BitcoinTxVersion3 = 3. This constant could then be used here and in all other places in this PR where the transaction version is set to 3.

Suggested change
txTemplate := wire.NewMsgTx(3)
txTemplate := wire.NewMsgTx(BitcoinTxVersion3)

This commit changes all new Bitcoin transactions from version 2 to
version 3 (TRUC - Topologically Restricted Until Confirmed) as defined
in BIP 431. Version 3 transactions provide better fee-bumping and
pinning protection, which is beneficial for Taproot Assets anchor
transactions.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 18785634524

Details

  • 6 of 9 (66.67%) changed or added relevant lines in 8 files are covered.
  • 28113 unchanged lines in 194 files lost coverage.
  • Overall coverage decreased (-21.9%) to 34.485%

Changes Missing Coverage Covered Lines Changed/Added Lines %
itest/utils.go 0 1 0.0%
tapchannel/commitment.go 0 1 0.0%
tapgarden/mock.go 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
universe/supplyverifier/util.go 1 98.75%
proof/util.go 2 81.63%
tapdb/migrations.go 2 76.19%
address/log.go 3 0.0%
commitment/log.go 3 0.0%
internal/pedersen/commitment.go 3 95.31%
lndservices/log.go 3 0.0%
rfq/log.go 3 0.0%
tapchannel/log.go 3 0.0%
tapdb/supply_syncer.go 3 73.85%
Totals Coverage Status
Change from base Build 18715089238: -21.9%
Covered Lines: 30532
Relevant Lines: 88537

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants