From 4c5db9d2b03f56a09ce093645e817713fb5c3f69 Mon Sep 17 00:00:00 2001 From: Marcos Date: Thu, 5 Dec 2024 18:17:57 -0300 Subject: [PATCH 1/4] Set rskj dependency to version 6.5.0-ARROWHEAD --- build.gradle | 2 +- gradle/verification-metadata.xml | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f1e96b880..be66f25d4 100644 --- a/build.gradle +++ b/build.gradle @@ -74,7 +74,7 @@ ext { junitSuiteVersion = '1.10.3' mockitoInlineVer = '5.2.0' mockitoJupiterVer = '5.12.0' - rskjcoreVersion = '6.5.0-SNAPSHOT' + rskjcoreVersion = '6.5.0-ARROWHEAD' } dependencies { diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index c3bbb9521..81824b31f 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -77,6 +77,14 @@ + + + + + + + + From 329873a9568d3926c93a078da7f324ef4a7c5ebe Mon Sep 17 00:00:00 2001 From: Marcos Date: Thu, 5 Dec 2024 18:18:21 -0300 Subject: [PATCH 2/4] Set version modifier to ARROWHEAD --- src/main/resources/version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/version.properties b/src/main/resources/version.properties index b35347519..1fa13b424 100644 --- a/src/main/resources/version.properties +++ b/src/main/resources/version.properties @@ -1,2 +1,2 @@ versionNumber='6.5.0.0' -modifier="SNAPSHOT" +modifier="ARROWHEAD" From 7ead4db9f8e8f4253f58b110720967f1321bd9ba Mon Sep 17 00:00:00 2001 From: Marcos Date: Thu, 5 Dec 2024 18:31:13 -0300 Subject: [PATCH 3/4] Refactor validateCoinbaseInformation --- .../java/co/rsk/federate/BtcToRskClient.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/co/rsk/federate/BtcToRskClient.java b/src/main/java/co/rsk/federate/BtcToRskClient.java index 5676e1e90..598d4f105 100644 --- a/src/main/java/co/rsk/federate/BtcToRskClient.java +++ b/src/main/java/co/rsk/federate/BtcToRskClient.java @@ -329,22 +329,22 @@ private void validateCoinbaseInformation(CoinbaseInformation coinbaseInformation throw new IllegalArgumentException(message); } + Optional expectedWitnessCommitment = BitcoinUtils.findWitnessCommitment(coinbaseTransaction); co.rsk.bitcoinj.core.Sha256Hash calculatedWitnessCommitment = co.rsk.bitcoinj.core.Sha256Hash.twiceOf( witnessMerkleRoot.getReversedBytes(), witnessReservedValue ); - BitcoinUtils.findWitnessCommitment(coinbaseTransaction) - .filter(commitment -> commitment.equals(calculatedWitnessCommitment)) - .orElseThrow(() -> { - String message = String.format( - "Block %s with segwit peg-in tx %s generated an invalid witness merkle root", - coinbaseInformation.getBlockHash(), - coinbaseTransaction.getHash() - ); - logger.error("[validateCoinbaseInformation] {}", message); - return new IllegalArgumentException(message); - }); + if (expectedWitnessCommitment.isEmpty() || !expectedWitnessCommitment.get().equals(calculatedWitnessCommitment)) { + String message = String.format( + "Block %s with segwit peg-in tx %s generated an invalid witness commitment", + coinbaseInformation.getBlockHash(), + coinbaseTransaction.getHash() + ); + logger.error("[validateCoinbaseInformation] {}", message); + throw new IllegalArgumentException(message); + } + logger.debug( "[validateCoinbaseInformation] Block {} with segwit peg-in tx {} has a valid witness merkle root", coinbaseInformation.getBlockHash(), From 5bec38f7f6570436932cfa844817c0ad368356a1 Mon Sep 17 00:00:00 2001 From: Marcos Date: Mon, 9 Dec 2024 09:56:34 -0300 Subject: [PATCH 4/4] Remove unused import --- src/main/java/co/rsk/federate/FedNodeRunner.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/co/rsk/federate/FedNodeRunner.java b/src/main/java/co/rsk/federate/FedNodeRunner.java index b5f876e8f..705922c83 100644 --- a/src/main/java/co/rsk/federate/FedNodeRunner.java +++ b/src/main/java/co/rsk/federate/FedNodeRunner.java @@ -57,7 +57,6 @@ import co.rsk.peg.btcLockSender.BtcLockSenderProvider; import co.rsk.peg.pegininstructions.PeginInstructionsProvider; import org.bitcoinj.core.Context; -import org.bouncycastle.util.encoders.Hex; import org.ethereum.crypto.ECKey; import org.slf4j.Logger; import org.slf4j.LoggerFactory;