From efcb50b2c95dc1ef00e57b54f3f97cc60fa84bd1 Mon Sep 17 00:00:00 2001 From: julia zack Date: Fri, 29 Sep 2023 12:35:48 -0300 Subject: [PATCH] Fix building non-tests-related errors --- rskj-core/src/main/java/co/rsk/config/BridgeConstants.java | 6 ++++-- .../src/main/java/co/rsk/peg/BridgeSerializationUtils.java | 4 ++-- rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java | 2 +- rskj-core/src/main/java/co/rsk/peg/BridgeUtils.java | 4 ++-- rskj-core/src/main/java/co/rsk/peg/PendingFederation.java | 4 ++-- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/rskj-core/src/main/java/co/rsk/config/BridgeConstants.java b/rskj-core/src/main/java/co/rsk/config/BridgeConstants.java index 11329b1accf..fae35ee98b9 100644 --- a/rskj-core/src/main/java/co/rsk/config/BridgeConstants.java +++ b/rskj-core/src/main/java/co/rsk/config/BridgeConstants.java @@ -24,13 +24,15 @@ import co.rsk.peg.AddressBasedAuthorizer; import co.rsk.peg.Federation; import java.util.List; + +import co.rsk.peg.StandardMultisigFederation; import org.ethereum.config.blockchain.upgrades.ActivationConfig; import org.ethereum.config.blockchain.upgrades.ConsensusRule; public abstract class BridgeConstants { protected String btcParamsString; - protected Federation genesisFederation; + protected StandardMultisigFederation genesisFederation; protected int btc2RskMinimumAcceptableConfirmations; protected int btc2RskMinimumAcceptableConfirmationsOnRsk; @@ -94,7 +96,7 @@ public String getBtcParamsString() { return btcParamsString; } - public Federation getGenesisFederation() { return genesisFederation; } + public StandardMultisigFederation getGenesisFederation() { return genesisFederation; } public int getBtc2RskMinimumAcceptableConfirmations() { return btc2RskMinimumAcceptableConfirmations; diff --git a/rskj-core/src/main/java/co/rsk/peg/BridgeSerializationUtils.java b/rskj-core/src/main/java/co/rsk/peg/BridgeSerializationUtils.java index 852d04602b4..aed12514fe8 100644 --- a/rskj-core/src/main/java/co/rsk/peg/BridgeSerializationUtils.java +++ b/rskj-core/src/main/java/co/rsk/peg/BridgeSerializationUtils.java @@ -273,7 +273,7 @@ private static Federation deserializeFederationWithDeserializer( federationMembers.add(member); } - return new Federation(federationMembers, creationTime, creationBlockNumber, networkParameters); + return new StandardMultisigFederation(federationMembers, creationTime, creationBlockNumber, networkParameters); } /** @@ -326,7 +326,7 @@ public static ErpFederation deserializeErpFederation( BridgeSerializationUtils::deserializeFederationMember ); - return new ErpFederation( + return new LegacyErpFederation( federation.getMembers(), federation.creationTime, federation.getCreationBlockNumber(), diff --git a/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java b/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java index ec6d8515c15..b60bb52da9e 100644 --- a/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java +++ b/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java @@ -2079,7 +2079,7 @@ protected Integer commitFederation(boolean dryRun, Keccak256 hash) throws IOExce // Preserve federation change info long nextFederationCreationBlockHeight = rskExecutionBlock.getNumber(); provider.setNextFederationCreationBlockHeight(nextFederationCreationBlockHeight); - Script oldFederationP2SHScript = activations.isActive(RSKIP377)? oldFederation.getStandardP2SHScript(): oldFederation.getP2SHScript(); + Script oldFederationP2SHScript = activations.isActive(RSKIP377)? ((ErpFederation) oldFederation).getStandardP2SHScript(): oldFederation.getP2SHScript(); provider.setLastRetiredFederationP2SHScript(oldFederationP2SHScript); } diff --git a/rskj-core/src/main/java/co/rsk/peg/BridgeUtils.java b/rskj-core/src/main/java/co/rsk/peg/BridgeUtils.java index 0a1035365f0..80cadbb1813 100644 --- a/rskj-core/src/main/java/co/rsk/peg/BridgeUtils.java +++ b/rskj-core/src/main/java/co/rsk/peg/BridgeUtils.java @@ -402,7 +402,7 @@ public static boolean isValidPegInTx( throw new ScriptException(message); } Script inputStandardRedeemScript = redeemScriptParser.extractStandardRedeemScript(); - if (activeFederations.stream().anyMatch(federation -> federation.getStandardRedeemScript().equals(inputStandardRedeemScript))) { + if (activeFederations.stream().anyMatch(federation -> (federation instanceof ErpFederation ? ((ErpFederation) federation).getStandardRedeemScript() : federation.getRedeemScript()).equals(inputStandardRedeemScript))) { return false; } @@ -490,7 +490,7 @@ private static boolean isPegOutTx(BtcTransaction tx, Federation federation, Acti } public static boolean isPegOutTx(BtcTransaction tx, List federations, ActivationConfig.ForBlock activations) { - return isPegOutTx(tx, activations, federations.stream().filter(Objects::nonNull).map(Federation::getStandardP2SHScript).toArray(Script[]::new)); + return isPegOutTx(tx, activations, federations.stream().filter(Objects::nonNull).map(fed -> fed instanceof ErpFederation ? ((ErpFederation) fed).getStandardRedeemScript() : fed.getRedeemScript()).toArray(Script[]::new)); } public static boolean isPegOutTx(BtcTransaction tx, ActivationConfig.ForBlock activations, Script... p2shScript) { diff --git a/rskj-core/src/main/java/co/rsk/peg/PendingFederation.java b/rskj-core/src/main/java/co/rsk/peg/PendingFederation.java index 33e388bed43..c0ddd49878e 100644 --- a/rskj-core/src/main/java/co/rsk/peg/PendingFederation.java +++ b/rskj-core/src/main/java/co/rsk/peg/PendingFederation.java @@ -119,7 +119,7 @@ public Federation buildFederation( if (activations.isActive(ConsensusRule.RSKIP201)) { logger.info("[buildFederation] Going to create an ERP Federation"); - return new ErpFederation( + return new LegacyErpFederation( members, creationTime, blockNumber, @@ -130,7 +130,7 @@ public Federation buildFederation( ); } - return new Federation( + return new StandardMultisigFederation( members, creationTime, blockNumber,