Skip to content

Set bitcoinj-thin and bitcoinj dependencies to versions that support BTC testnet4 - #654

Open
marcos-iov wants to merge 2 commits into
masterfrom
testnet2-integration
Open

Set bitcoinj-thin and bitcoinj dependencies to versions that support BTC testnet4#654
marcos-iov wants to merge 2 commits into
masterfrom
testnet2-integration

Conversation

@marcos-iov

@marcos-iov marcos-iov commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Description

Motivation and Context

How Has This Been Tested?

Types of changes

  • 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)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • Tests for the changes have been added (for bug fixes / features)
  • Requires Activation Code (Hard Fork)
  • Other information:
    rskj:testnet2-integration

Copilot AI review requested due to automatic review settings July 27, 2026 19:52
@marcos-iov
marcos-iov requested a review from a team as a code owner July 27, 2026 19:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@marcos-iov
marcos-iov force-pushed the testnet2-integration branch from f2b2144 to 4242051 Compare July 27, 2026 20:09
Copilot AI review requested due to automatic review settings August 3, 2026 16:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (4)

src/main/java/co/rsk/federate/signing/hsm/config/NetworkDifficultyCap.java:19

  • NetworkDifficultyCap has inconsistent indentation inside the constructor and getter (method bodies are not indented like the rest of the enum), which hurts readability and deviates from the style used elsewhere in this repo.
    NetworkDifficultyCap(BigInteger difficultyCap) {
    this.difficultyCap = difficultyCap;
    }

    public BigInteger getDifficultyCap() {
    return difficultyCap;
  }

src/main/java/co/rsk/federate/signing/hsm/config/NetworkDifficultyCap.java:9

  • The new enum constant name TESTNET2 is now used to represent NetworkParameters.ID_TESTNET4. This is confusing (name doesn’t match the bitcoinj network id) and it duplicates TESTNET with the same numeric cap value; consider either mapping ID_TESTNET4 to the existing TESTNET cap, or renaming the constant to something like TESTNET4 so the code/doc match the intent.

This issue also appears on line 13 of the same file.

    MAINNET(new BigInteger("7000000000000000000000")),
    TESTNET2(BigInteger.valueOf(3000000000L)),
    TESTNET(BigInteger.valueOf(3000000000L)),
    REGTEST(BigInteger.valueOf(20L));

src/test/java/co/rsk/federate/signing/hsm/config/PowHSMConfigTest.java:159

  • This newly reformatted test block uses indentation and wrapping that doesn’t match the surrounding style in this file (2-space indent, compact assert formatting). Keeping it consistent makes diffs smaller and the tests easier to scan.
  void getDifficultyCap_whenGivenNetwork_shouldMatchExpectedDifficultyCap(
      String networkId,
      NetworkDifficultyCap expectedNetworkDifficultyCap
  ) {
      assertEquals(
          expectedNetworkDifficultyCap.getDifficultyCap(),
          powHsmConfig.getDifficultyCap(networkId)
      );
  }

src/main/java/co/rsk/federate/signing/hsm/config/PowHSMConfig.java:133

  • In PowHSMConfig, the newly edited Javadoc/method block is indented differently than the surrounding methods (extra leading spaces and deeper switch indentation). Please reformat this block to match the file’s existing indentation style to keep the codebase consistent.
    /**
    * Retrieves the difficulty cap for a given network parameter.
    * The difficulty cap is determined based on the network type (mainnet, testnet,
    * or regtest). This value will be used to determine the maximum allowed
    * difficulty for any given block.
    *
    * @param networkParameter the network parameter identifier, which can be one of the following:
    * <ul>
    *   <li>{@link NetworkParameters#ID_MAINNET} - Mainnet network</li>
    *   <li>{@link NetworkParameters#ID_TESTNET4} - Testnet4 network</li>
    *   <li>{@link NetworkParameters#ID_TESTNET} - Testnet network</li>
    *   <li>{@link NetworkParameters#ID_REGTEST} - Regtest network</li>
    * </ul>
    * @return the difficulty cap as a {@link BigInteger} for the specified network.
    * @throws IllegalArgumentException if the provided network parameter is invalid.
    */
    public BigInteger getDifficultyCap(String networkParameter) {
        switch (networkParameter) {

@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

@jeremy-then jeremy-then left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

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.

3 participants