Set bitcoinj-thin and bitcoinj dependencies to versions that support BTC testnet4 - #654
Set bitcoinj-thin and bitcoinj dependencies to versions that support BTC testnet4#654marcos-iov wants to merge 3 commits into
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
f2b2144 to
4242051
Compare
There was a problem hiding this comment.
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) {
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
Suppressed comments (1)
src/main/java/co/rsk/federate/signing/hsm/config/PowHSMConfig.java:136
- This method block is indented with a different style than the rest of the class, which makes the file harder to read/maintain. Please reformat it to match the existing 2-space indentation used above in this file.
public BigInteger getDifficultyCap(String networkParameter) {
switch (networkParameter) {
case NetworkParameters.ID_MAINNET:
return NetworkDifficultyCap.MAINNET.getDifficultyCap();
case NetworkParameters.ID_TESTNET4:
| /** | ||
| * 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. | ||
| */ |
| case NetworkParameters.ID_TESTNET4: | ||
| return NetworkDifficultyCap.TESTNET2.getDifficultyCap(); | ||
| case NetworkParameters.ID_TESTNET: |
| public enum NetworkDifficultyCap { | ||
| MAINNET(new BigInteger("7000000000000000000000")), | ||
| TESTNET(BigInteger.valueOf(3000000000L)), | ||
| REGTEST(BigInteger.valueOf(20L)); | ||
| MAINNET(new BigInteger("7000000000000000000000")), | ||
| TESTNET2(BigInteger.valueOf(3000000000L)), | ||
| TESTNET(BigInteger.valueOf(3000000000L)), | ||
| REGTEST(BigInteger.valueOf(20L)); |
| void getDifficultyCap_whenGivenNetwork_shouldMatchExpectedDifficultyCap( | ||
| String networkId, | ||
| NetworkDifficultyCap expectedNetworkDifficultyCap | ||
| ) { | ||
| assertEquals( | ||
| expectedNetworkDifficultyCap.getDifficultyCap(), | ||
| powHsmConfig.getDifficultyCap(networkId) | ||
| ); | ||
| } |
|



Description
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist:
rskj:testnet2-integration