Skip to content

Commit

Permalink
Fix building non-tests-related errors
Browse files Browse the repository at this point in the history
  • Loading branch information
julia-zack committed Sep 29, 2023
1 parent daabd88 commit efcb50b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
6 changes: 4 additions & 2 deletions rskj-core/src/main/java/co/rsk/config/BridgeConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -94,7 +96,7 @@ public String getBtcParamsString() {
return btcParamsString;
}

public Federation getGenesisFederation() { return genesisFederation; }
public StandardMultisigFederation getGenesisFederation() { return genesisFederation; }

public int getBtc2RskMinimumAcceptableConfirmations() {
return btc2RskMinimumAcceptableConfirmations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -326,7 +326,7 @@ public static ErpFederation deserializeErpFederation(
BridgeSerializationUtils::deserializeFederationMember
);

return new ErpFederation(
return new LegacyErpFederation(
federation.getMembers(),
federation.creationTime,
federation.getCreationBlockNumber(),
Expand Down
2 changes: 1 addition & 1 deletion rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions rskj-core/src/main/java/co/rsk/peg/BridgeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -490,7 +490,7 @@ private static boolean isPegOutTx(BtcTransaction tx, Federation federation, Acti
}

public static boolean isPegOutTx(BtcTransaction tx, List<Federation> 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) {
Expand Down
4 changes: 2 additions & 2 deletions rskj-core/src/main/java/co/rsk/peg/PendingFederation.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -130,7 +130,7 @@ public Federation buildFederation(
);
}

return new Federation(
return new StandardMultisigFederation(
members,
creationTime,
blockNumber,
Expand Down

0 comments on commit efcb50b

Please sign in to comment.