From bd8b9a1a4f9f1c37279d861277cff30224099eff Mon Sep 17 00:00:00 2001 From: Reynold Morel Date: Mon, 3 Jun 2024 15:17:43 -0400 Subject: [PATCH] Add RSKIP number and refactor validate method in TxValidatorStep --- .../core/bc/ClaimTransactionValidator.java | 2 +- .../rsk/net/handler/TxPendingValidator.java | 9 ++++- .../txvalidator/TxNotNullValidator.java | 13 +------ .../TxValidatorAccountBalanceValidator.java | 18 +++------ .../TxValidatorAccountStateValidator.java | 16 ++------ .../TxValidatorGasLimitValidator.java | 11 +----- ...TxValidatorIntrinsicGasLimitValidator.java | 9 +---- .../TxValidatorMaximumGasPriceValidator.java | 11 +----- .../TxValidatorMinimuGasPriceValidator.java | 11 +----- .../TxValidatorNonceRangeValidator.java | 14 ++----- .../TxValidatorNotRemascTxValidator.java | 11 +----- .../handler/txvalidator/TxValidatorStep.java | 9 +---- .../blockchain/upgrades/ConsensusRule.java | 2 +- .../blockchain/upgrades/NetworkUpgrade.java | 3 +- .../org/ethereum/core/ValidationArgs.java | 39 +++++++++++++++++++ .../src/main/resources/config/devnet.conf | 1 - rskj-core/src/main/resources/config/main.conf | 1 - .../src/main/resources/config/regtest.conf | 1 - .../src/main/resources/config/testnet.conf | 1 - rskj-core/src/main/resources/expected.conf | 3 +- rskj-core/src/main/resources/reference.conf | 2 +- .../java/co/rsk/mine/MainNetMinerTest.java | 2 +- ...xValidatorAccountBalanceValidatorTest.java | 21 ++++++---- .../TxValidatorAccountStateValidatorTest.java | 7 +++- ...lidatorIntrinsicGasLimitValidatorTest.java | 19 +++++---- .../TxValidatorNonceRangeValidatorTest.java | 13 +++++-- .../rsk/remasc/RemascStorageProviderTest.java | 10 ++--- .../util/ClaimTransactionValidatorTest.java | 2 +- .../upgrades/ActivationConfigTest.java | 3 +- 29 files changed, 123 insertions(+), 141 deletions(-) create mode 100644 rskj-core/src/main/java/org/ethereum/core/ValidationArgs.java diff --git a/rskj-core/src/main/java/co/rsk/core/bc/ClaimTransactionValidator.java b/rskj-core/src/main/java/co/rsk/core/bc/ClaimTransactionValidator.java index f024ccb7f76..30a6f04d43d 100644 --- a/rskj-core/src/main/java/co/rsk/core/bc/ClaimTransactionValidator.java +++ b/rskj-core/src/main/java/co/rsk/core/bc/ClaimTransactionValidator.java @@ -127,7 +127,7 @@ public boolean hasLockedFunds(Transaction tx, RepositorySnapshot repositorySnaps } public boolean isFeatureActive (ActivationConfig.ForBlock activationConfig) { - return activationConfig.isActive(ConsensusRule.RSKIP00); + return activationConfig.isActive(ConsensusRule.RSKIP432); } public boolean isClaimTxAndValid(Transaction tx, RepositorySnapshot repositorySnapshot, ActivationConfig.ForBlock activationConfig) { diff --git a/rskj-core/src/main/java/co/rsk/net/handler/TxPendingValidator.java b/rskj-core/src/main/java/co/rsk/net/handler/TxPendingValidator.java index 1e337428dab..30782d6163c 100644 --- a/rskj-core/src/main/java/co/rsk/net/handler/TxPendingValidator.java +++ b/rskj-core/src/main/java/co/rsk/net/handler/TxPendingValidator.java @@ -28,6 +28,7 @@ import org.ethereum.core.Block; import org.ethereum.core.SignatureCache; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -85,8 +86,14 @@ public TransactionValidationResult isValid(Transaction tx, Block executionBlock, return TransactionValidationResult.withError(String.format("transaction's size is higher than defined maximum: %s > %s", tx.getSize(), TX_MAX_SIZE)); } + ValidationArgs validationArgs = new ValidationArgs( + state, + repositorySnapshot, + activationConfig.forBlock(bestBlockNumber) + ); + for (TxValidatorStep step : validatorSteps) { - TransactionValidationResult validationResult = step.validate(tx, state, blockGasLimit, minimumGasPrice, bestBlockNumber, basicTxCost == 0, repositorySnapshot, activationConfig.forBlock(bestBlockNumber)); + TransactionValidationResult validationResult = step.validate(tx, validationArgs, blockGasLimit, minimumGasPrice, bestBlockNumber, basicTxCost == 0); if (!validationResult.transactionIsValid()) { logger.info("[tx={}] validation failed with error: {}", tx.getHash(), validationResult.getErrorMessage()); return validationResult; diff --git a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxNotNullValidator.java b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxNotNullValidator.java index 6e7d1e6bd19..5d6486a2982 100644 --- a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxNotNullValidator.java +++ b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxNotNullValidator.java @@ -19,13 +19,10 @@ package co.rsk.net.handler.txvalidator; import co.rsk.core.Coin; -import co.rsk.db.RepositorySnapshot; import co.rsk.net.TransactionValidationResult; -import org.ethereum.config.blockchain.upgrades.ActivationConfig; -import org.ethereum.core.AccountState; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; -import javax.annotation.Nullable; import java.math.BigInteger; /** @@ -34,14 +31,8 @@ * Looks a little overhead, but simplifies a little bit the code in other places */ public class TxNotNullValidator implements TxValidatorStep { - - @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx, RepositorySnapshot repositorySnapshot, ActivationConfig.ForBlock activationConfig) { - return this.validate(tx, state, gasLimit, minimumGasPrice, bestBlockNumber, isFreeTx); - } - @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { + public TransactionValidationResult validate(Transaction tx, ValidationArgs validationArgs, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { if (tx != null) { return TransactionValidationResult.ok(); } diff --git a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorAccountBalanceValidator.java b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorAccountBalanceValidator.java index 6fceb9b981d..a77234cff1c 100644 --- a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorAccountBalanceValidator.java +++ b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorAccountBalanceValidator.java @@ -20,15 +20,12 @@ import co.rsk.core.Coin; import co.rsk.core.bc.ClaimTransactionValidator; -import co.rsk.db.RepositorySnapshot; import co.rsk.net.TransactionValidationResult; import org.ethereum.config.Constants; -import org.ethereum.config.blockchain.upgrades.ActivationConfig; -import org.ethereum.core.AccountState; import org.ethereum.core.SignatureCache; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; -import javax.annotation.Nullable; import java.math.BigInteger; /** @@ -45,27 +42,22 @@ public TxValidatorAccountBalanceValidator( } @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx, RepositorySnapshot repositorySnapshot, ActivationConfig.ForBlock activationConfig) { + public TransactionValidationResult validate(Transaction tx, ValidationArgs validationArgs, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { if (isFreeTx) { return TransactionValidationResult.ok(); } - if (state == null) { + if (validationArgs.getAccountState() == null) { return TransactionValidationResult.withError("the sender account doesn't exist"); } BigInteger txGasLimit = tx.getGasLimitAsInteger(); Coin maximumPrice = tx.getGasPrice().multiply(txGasLimit); - if (state.getBalance().compareTo(maximumPrice) >= 0 - || claimTransactionValidator.isClaimTxAndValid(tx, repositorySnapshot, activationConfig)) { + if (validationArgs.getAccountState().getBalance().compareTo(maximumPrice) >= 0 + || claimTransactionValidator.isClaimTxAndValid(tx, validationArgs.getRepositorySnapshot(), validationArgs.getActivationConfig())) { return TransactionValidationResult.ok(); } return TransactionValidationResult.withError("insufficient funds"); } - - @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { - return TransactionValidationResult.ok(); - } } diff --git a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorAccountStateValidator.java b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorAccountStateValidator.java index 925ea5a605d..670a13bd543 100644 --- a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorAccountStateValidator.java +++ b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorAccountStateValidator.java @@ -19,13 +19,10 @@ package co.rsk.net.handler.txvalidator; import co.rsk.core.Coin; -import co.rsk.db.RepositorySnapshot; import co.rsk.net.TransactionValidationResult; -import org.ethereum.config.blockchain.upgrades.ActivationConfig; -import org.ethereum.core.AccountState; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; -import javax.annotation.Nullable; import java.math.BigInteger; /** @@ -34,21 +31,16 @@ public class TxValidatorAccountStateValidator implements TxValidatorStep { @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx, RepositorySnapshot repositorySnapshot, ActivationConfig.ForBlock activationConfig) { - return validate(tx, state, gasLimit, minimumGasPrice, bestBlockNumber, isFreeTx); - } - - @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { + public TransactionValidationResult validate(Transaction tx, ValidationArgs validationArgs, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { if (isFreeTx) { return TransactionValidationResult.ok(); } - if (state == null) { + if (validationArgs.getAccountState() == null) { return TransactionValidationResult.withError("the sender account doesn't exist"); } - if (state.isDeleted()) { + if (validationArgs.getAccountState().isDeleted()) { return TransactionValidationResult.withError("the sender account is deleted"); } diff --git a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorGasLimitValidator.java b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorGasLimitValidator.java index a5088f2aca4..5212b417522 100644 --- a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorGasLimitValidator.java +++ b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorGasLimitValidator.java @@ -19,14 +19,11 @@ package co.rsk.net.handler.txvalidator; import co.rsk.core.Coin; -import co.rsk.db.RepositorySnapshot; import co.rsk.net.TransactionValidationResult; import org.ethereum.config.Constants; -import org.ethereum.config.blockchain.upgrades.ActivationConfig; -import org.ethereum.core.AccountState; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; -import javax.annotation.Nullable; import java.math.BigInteger; /** @@ -35,13 +32,9 @@ * Also Checks that the transaction gas limit is not higher than the max allowed value */ public class TxValidatorGasLimitValidator implements TxValidatorStep { - @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx, RepositorySnapshot repositorySnapshot, ActivationConfig.ForBlock activationConfig) { - return validate(tx, state, gasLimit, minimumGasPrice, bestBlockNumber, isFreeTx); - } @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { + public TransactionValidationResult validate(Transaction tx, ValidationArgs validationArgs, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { BigInteger txGasLimit = tx.getGasLimitAsInteger(); if (txGasLimit.compareTo(gasLimit) <= 0 && txGasLimit.compareTo(Constants.getTransactionGasCap()) <= 0) { diff --git a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorIntrinsicGasLimitValidator.java b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorIntrinsicGasLimitValidator.java index 9e73bf3b90c..76471c368a7 100644 --- a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorIntrinsicGasLimitValidator.java +++ b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorIntrinsicGasLimitValidator.java @@ -18,13 +18,11 @@ package co.rsk.net.handler.txvalidator; import co.rsk.core.Coin; -import co.rsk.db.RepositorySnapshot; import co.rsk.net.TransactionValidationResult; import org.ethereum.config.Constants; import org.ethereum.config.blockchain.upgrades.ActivationConfig; import org.ethereum.core.*; -import javax.annotation.Nullable; import java.math.BigInteger; /** @@ -47,12 +45,7 @@ public TxValidatorIntrinsicGasLimitValidator( } @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx, RepositorySnapshot repositorySnapshot, ActivationConfig.ForBlock activationConfig) { - return validate(tx, state, gasLimit, minimumGasPrice, bestBlockNumber, isFreeTx); - } - - @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { + public TransactionValidationResult validate(Transaction tx, ValidationArgs validationArgs, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { if (BigInteger.valueOf(tx.transactionCost(constants, activationConfig.forBlock(bestBlockNumber), signatureCache)).compareTo(tx.getGasLimitAsInteger()) <= 0) { return TransactionValidationResult.ok(); } diff --git a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorMaximumGasPriceValidator.java b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorMaximumGasPriceValidator.java index d1b9b16078c..2451ed7a73c 100644 --- a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorMaximumGasPriceValidator.java +++ b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorMaximumGasPriceValidator.java @@ -19,15 +19,13 @@ package co.rsk.net.handler.txvalidator; import co.rsk.core.Coin; -import co.rsk.db.RepositorySnapshot; import co.rsk.net.TransactionValidationResult; import co.rsk.validators.TxGasPriceCap; import org.ethereum.config.blockchain.upgrades.ActivationConfig; import org.ethereum.config.blockchain.upgrades.ConsensusRule; -import org.ethereum.core.AccountState; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; -import javax.annotation.Nullable; import java.math.BigInteger; /** @@ -42,12 +40,7 @@ public TxValidatorMaximumGasPriceValidator(ActivationConfig activationConfig) { } @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx, RepositorySnapshot repositorySnapshot, ActivationConfig.ForBlock activationConfig) { - return validate(tx, state, gasLimit, minimumGasPrice, bestBlockNumber, isFreeTx); - } - - @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { + public TransactionValidationResult validate(Transaction tx, ValidationArgs validationArgs, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { boolean isRskip252Enabled = activationConfig.isActive(ConsensusRule.RSKIP252, bestBlockNumber); if (!isRskip252Enabled) { return TransactionValidationResult.ok(); diff --git a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorMinimuGasPriceValidator.java b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorMinimuGasPriceValidator.java index 7345f1718e2..f78d33eae8e 100644 --- a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorMinimuGasPriceValidator.java +++ b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorMinimuGasPriceValidator.java @@ -19,26 +19,19 @@ package co.rsk.net.handler.txvalidator; import co.rsk.core.Coin; -import co.rsk.db.RepositorySnapshot; import co.rsk.net.TransactionValidationResult; -import org.ethereum.config.blockchain.upgrades.ActivationConfig; -import org.ethereum.core.AccountState; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; -import javax.annotation.Nullable; import java.math.BigInteger; /** * Created by maty on 06/03/17. */ public class TxValidatorMinimuGasPriceValidator implements TxValidatorStep { - @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx, RepositorySnapshot repositorySnapshot, ActivationConfig.ForBlock activationConfig) { - return validate(tx, state, gasLimit, minimumGasPrice, bestBlockNumber, isFreeTx); - } @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { + public TransactionValidationResult validate(Transaction tx, ValidationArgs validationArgs, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { Coin gasPrice = tx.getGasPrice(); if (gasPrice != null && gasPrice.compareTo(minimumGasPrice) >= 0) { return TransactionValidationResult.ok(); diff --git a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorNonceRangeValidator.java b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorNonceRangeValidator.java index cc8bd94e442..697e0aaee8d 100644 --- a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorNonceRangeValidator.java +++ b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorNonceRangeValidator.java @@ -19,13 +19,10 @@ package co.rsk.net.handler.txvalidator; import co.rsk.core.Coin; -import co.rsk.db.RepositorySnapshot; import co.rsk.net.TransactionValidationResult; -import org.ethereum.config.blockchain.upgrades.ActivationConfig; -import org.ethereum.core.AccountState; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; -import javax.annotation.Nullable; import java.math.BigInteger; /** @@ -44,14 +41,9 @@ public TxValidatorNonceRangeValidator(int accountSlots) { } @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx, RepositorySnapshot repositorySnapshot, ActivationConfig.ForBlock activationConfig) { - return validate(tx, state, gasLimit, minimumGasPrice, bestBlockNumber, isFreeTx); - } - - @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { + public TransactionValidationResult validate(Transaction tx, ValidationArgs validationArgs, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { BigInteger nonce = tx.getNonceAsInteger(); - BigInteger stateNonce = state == null ? BigInteger.ZERO : state.getNonce(); + BigInteger stateNonce = validationArgs.getAccountState() == null ? BigInteger.ZERO : validationArgs.getAccountState().getNonce(); if (stateNonce.compareTo(nonce) > 0) { return TransactionValidationResult.withError("transaction nonce too low"); diff --git a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorNotRemascTxValidator.java b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorNotRemascTxValidator.java index 8246327a5ef..ccea9844e15 100644 --- a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorNotRemascTxValidator.java +++ b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorNotRemascTxValidator.java @@ -19,14 +19,11 @@ package co.rsk.net.handler.txvalidator; import co.rsk.core.Coin; -import co.rsk.db.RepositorySnapshot; import co.rsk.net.TransactionValidationResult; import co.rsk.remasc.RemascTransaction; -import org.ethereum.config.blockchain.upgrades.ActivationConfig; -import org.ethereum.core.AccountState; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; -import javax.annotation.Nullable; import java.math.BigInteger; /** @@ -35,13 +32,9 @@ * Transaction must not be null */ public class TxValidatorNotRemascTxValidator implements TxValidatorStep { - @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx, RepositorySnapshot repositorySnapshot, ActivationConfig.ForBlock activationConfig) { - return validate(tx, state, gasLimit, minimumGasPrice, bestBlockNumber, isFreeTx); - } @Override - public TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { + public TransactionValidationResult validate(Transaction tx, ValidationArgs validationArgs, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx) { if (!(tx instanceof RemascTransaction)) { return TransactionValidationResult.ok(); } diff --git a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorStep.java b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorStep.java index 51bb58fbf7c..4903be5fd74 100644 --- a/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorStep.java +++ b/rskj-core/src/main/java/co/rsk/net/handler/txvalidator/TxValidatorStep.java @@ -19,13 +19,10 @@ package co.rsk.net.handler.txvalidator; import co.rsk.core.Coin; -import co.rsk.db.RepositorySnapshot; import co.rsk.net.TransactionValidationResult; -import org.ethereum.config.blockchain.upgrades.ActivationConfig; -import org.ethereum.core.AccountState; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; -import javax.annotation.Nullable; import java.math.BigInteger; /** @@ -34,7 +31,5 @@ */ public interface TxValidatorStep { - TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx, RepositorySnapshot repositorySnapshot, ActivationConfig.ForBlock activationConfig); - - TransactionValidationResult validate(Transaction tx, @Nullable AccountState state, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx); + TransactionValidationResult validate(Transaction tx, ValidationArgs validationArgs, BigInteger gasLimit, Coin minimumGasPrice, long bestBlockNumber, boolean isFreeTx); } diff --git a/rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/ConsensusRule.java b/rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/ConsensusRule.java index 126a04cfc40..fc840fb5b56 100644 --- a/rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/ConsensusRule.java +++ b/rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/ConsensusRule.java @@ -93,7 +93,7 @@ public enum ConsensusRule { RSKIP412("rskip412"), // From EIP-3198 BASEFEE opcode RSKIP415("rskip415"), RSKIP417("rskip417"), - RSKIP00("rskip00"), // Placeholder for EthSwap feature + RSKIP432("rskip432"), // From RSKIP-432 RbtcSwap ; private String configKey; diff --git a/rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/NetworkUpgrade.java b/rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/NetworkUpgrade.java index a953bca82fa..e47ed0fe7d6 100644 --- a/rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/NetworkUpgrade.java +++ b/rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/NetworkUpgrade.java @@ -32,8 +32,7 @@ public enum NetworkUpgrade { HOP401("hop401"), FINGERROOT500("fingerroot500"), ARROWHEAD600("arrowhead600"), - LOVELL700("lovell700"), - TBD000("tbd000"); + LOVELL700("lovell700"); private String name; diff --git a/rskj-core/src/main/java/org/ethereum/core/ValidationArgs.java b/rskj-core/src/main/java/org/ethereum/core/ValidationArgs.java new file mode 100644 index 00000000000..f41c00860b0 --- /dev/null +++ b/rskj-core/src/main/java/org/ethereum/core/ValidationArgs.java @@ -0,0 +1,39 @@ +package org.ethereum.core; + +import co.rsk.db.RepositorySnapshot; +import org.ethereum.config.blockchain.upgrades.ActivationConfig; + +import javax.annotation.Nullable; + +public class ValidationArgs { + + @Nullable + AccountState accountState; + + @Nullable + RepositorySnapshot repositorySnapshot; + + @Nullable + ActivationConfig.ForBlock activationConfig; + + public ValidationArgs(@Nullable AccountState accountState, @Nullable RepositorySnapshot repositorySnapshot, @Nullable ActivationConfig.ForBlock activationConfig) { + this.accountState = accountState; + this.repositorySnapshot = repositorySnapshot; + this.activationConfig = activationConfig; + } + + @Nullable + public AccountState getAccountState() { + return accountState; + } + + @Nullable + public RepositorySnapshot getRepositorySnapshot() { + return repositorySnapshot; + } + + @Nullable + public ActivationConfig.ForBlock getActivationConfig() { + return activationConfig; + } +} diff --git a/rskj-core/src/main/resources/config/devnet.conf b/rskj-core/src/main/resources/config/devnet.conf index 0e20333b02a..91756ee1fea 100644 --- a/rskj-core/src/main/resources/config/devnet.conf +++ b/rskj-core/src/main/resources/config/devnet.conf @@ -14,7 +14,6 @@ blockchain.config { fingerroot500 = 0, arrowhead600 = 0, lovell700 = 0, - tbd000 = 0, }, consensusRules = { rskip97 = -1 # disable orchid difficulty drop diff --git a/rskj-core/src/main/resources/config/main.conf b/rskj-core/src/main/resources/config/main.conf index c1d6445c62e..17c5f566201 100644 --- a/rskj-core/src/main/resources/config/main.conf +++ b/rskj-core/src/main/resources/config/main.conf @@ -14,7 +14,6 @@ blockchain.config { fingerroot500 = 5468000, arrowhead600 = 6223700, lovell700 = -1, - tbd000 = -1, } } diff --git a/rskj-core/src/main/resources/config/regtest.conf b/rskj-core/src/main/resources/config/regtest.conf index f801f53b764..32aba51f729 100644 --- a/rskj-core/src/main/resources/config/regtest.conf +++ b/rskj-core/src/main/resources/config/regtest.conf @@ -14,7 +14,6 @@ blockchain.config { fingerroot500 = 0, arrowhead600 = 0, lovell700 = 0, - tbd000 = 0, }, consensusRules = { rskip97 = -1 # disable orchid difficulty drop diff --git a/rskj-core/src/main/resources/config/testnet.conf b/rskj-core/src/main/resources/config/testnet.conf index e3675b73a2b..d0da9e12899 100644 --- a/rskj-core/src/main/resources/config/testnet.conf +++ b/rskj-core/src/main/resources/config/testnet.conf @@ -14,7 +14,6 @@ blockchain.config { fingerroot500 = 4015800, arrowhead600 = 4927100, lovell700 = -1 - tbd000 = -1, }, consensusRules = { rskip97 = -1, # disable orchid difficulty drop diff --git a/rskj-core/src/main/resources/expected.conf b/rskj-core/src/main/resources/expected.conf index 084370f8999..c4b13ac7cd4 100644 --- a/rskj-core/src/main/resources/expected.conf +++ b/rskj-core/src/main/resources/expected.conf @@ -17,7 +17,6 @@ blockchain = { fingerroot500 = arrowhead600 = lovell700 = - tbd000 = } consensusRules = { areBridgeTxsPaid = @@ -94,7 +93,7 @@ blockchain = { rskip412 = rskip415 = rskip417 = - rskip00 = + rskip432 = } } gc = { diff --git a/rskj-core/src/main/resources/reference.conf b/rskj-core/src/main/resources/reference.conf index b3b4d9336a0..a3ee35f7d2e 100644 --- a/rskj-core/src/main/resources/reference.conf +++ b/rskj-core/src/main/resources/reference.conf @@ -79,7 +79,7 @@ blockchain = { rskip412 = arrowhead600 rskip415 = arrowhead600 rskip417 = arrowhead600 - rskip00 = tbd000 + rskip432 = lovell700 } } gc = { diff --git a/rskj-core/src/test/java/co/rsk/mine/MainNetMinerTest.java b/rskj-core/src/test/java/co/rsk/mine/MainNetMinerTest.java index c7be718bca5..4b6ccda8dc8 100644 --- a/rskj-core/src/test/java/co/rsk/mine/MainNetMinerTest.java +++ b/rskj-core/src/test/java/co/rsk/mine/MainNetMinerTest.java @@ -77,7 +77,7 @@ class MainNetMinerTest { void setup() { config = spy(new TestSystemProperties()); when(config.getNetworkConstants()).thenReturn(Constants.mainnet()); - when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.allBut(ConsensusRule.RSKIP00)); + when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.allBut(ConsensusRule.RSKIP432)); RskTestFactory factory = new RskTestFactory(tempDir, config) { @Override public GenesisLoader buildGenesisLoader() { diff --git a/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorAccountBalanceValidatorTest.java b/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorAccountBalanceValidatorTest.java index c13ca983e8a..e7b3ea4885d 100644 --- a/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorAccountBalanceValidatorTest.java +++ b/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorAccountBalanceValidatorTest.java @@ -30,6 +30,7 @@ import org.ethereum.core.ReceivedTxSignatureCache; import org.ethereum.core.SignatureCache; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; import org.ethereum.crypto.ECKey; import org.ethereum.vm.DataWord; import org.junit.jupiter.api.Assertions; @@ -66,13 +67,15 @@ void validAccountBalance() { Mockito.when(tx2.getGasPrice()).thenReturn(Coin.valueOf(10000)); Mockito.when(tx3.getGasPrice()).thenReturn(Coin.valueOf(5000)); Mockito.when(as.getBalance()).thenReturn(Coin.valueOf(10000)); - Mockito.when(activationConfig.isActive(ConsensusRule.RSKIP00)).thenReturn(false); + Mockito.when(activationConfig.isActive(ConsensusRule.RSKIP432)).thenReturn(false); TxValidatorAccountBalanceValidator tvabv = new TxValidatorAccountBalanceValidator(constants, signatureCache); - Assertions.assertTrue(tvabv.validate(tx1, as, null, null, Long.MAX_VALUE, false, null, activationConfig).transactionIsValid()); - Assertions.assertTrue(tvabv.validate(tx2, as, null, null, Long.MAX_VALUE, false, null, activationConfig).transactionIsValid()); - Assertions.assertTrue(tvabv.validate(tx3, as, null, null, Long.MAX_VALUE, false, null, activationConfig).transactionIsValid()); + ValidationArgs va = new ValidationArgs(as, null, activationConfig); + + Assertions.assertTrue(tvabv.validate(tx1, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertTrue(tvabv.validate(tx2, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertTrue(tvabv.validate(tx3, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); } @Test @@ -90,12 +93,13 @@ void invalidAccountBalance() { Mockito.when(as.getBalance()).thenReturn(Coin.valueOf(19)); Mockito.when(rs.getStorageValue(Mockito.any(RskAddress.class), Mockito.any(DataWord.class))).thenReturn(null); Mockito.when(rs.getBalance(Mockito.any(RskAddress.class))).thenReturn(Coin.valueOf(19)); - Mockito.when(activationConfig.isActive(ConsensusRule.RSKIP00)).thenReturn(true); + Mockito.when(activationConfig.isActive(ConsensusRule.RSKIP432)).thenReturn(true); TxValidatorAccountBalanceValidator tvabv = new TxValidatorAccountBalanceValidator(constants, signatureCache); + ValidationArgs va = new ValidationArgs(as, rs, activationConfig); - Assertions.assertFalse(tvabv.validate(tx1, as, null, null, Long.MAX_VALUE, false, rs, activationConfig).transactionIsValid()); - Assertions.assertFalse(tvabv.validate(tx2, as, null, null, Long.MAX_VALUE, false, rs, activationConfig).transactionIsValid()); + Assertions.assertFalse(tvabv.validate(tx1, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertFalse(tvabv.validate(tx2, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); } @Test @@ -114,8 +118,9 @@ void balanceIsNotValidatedIfFreeTx() { tx.sign(new ECKey().getPrivKeyBytes()); TxValidatorAccountBalanceValidator tv = new TxValidatorAccountBalanceValidator(constants, signatureCache); + ValidationArgs va = new ValidationArgs(new AccountState(), null, null); - Assertions.assertTrue(tv.validate(tx, new AccountState(), BigInteger.ONE, Coin.valueOf(1L), Long.MAX_VALUE, true, null, null).transactionIsValid()); + Assertions.assertTrue(tv.validate(tx, va, BigInteger.ONE, Coin.valueOf(1L), Long.MAX_VALUE, true).transactionIsValid()); } } diff --git a/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorAccountStateValidatorTest.java b/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorAccountStateValidatorTest.java index 93a9e98eaf4..52e8a883841 100644 --- a/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorAccountStateValidatorTest.java +++ b/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorAccountStateValidatorTest.java @@ -19,6 +19,7 @@ package co.rsk.net.handler.txvalidator; import org.ethereum.core.AccountState; +import org.ethereum.core.ValidationArgs; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -31,7 +32,8 @@ void validAccountState() { Mockito.when(state.isDeleted()).thenReturn(false); TxValidatorAccountStateValidator tvasv = new TxValidatorAccountStateValidator(); - Assertions.assertTrue(tvasv.validate(null, state, null, null, Long.MAX_VALUE, false).transactionIsValid()); + ValidationArgs va = new ValidationArgs(state, null, null); + Assertions.assertTrue(tvasv.validate(null, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); } @Test @@ -40,6 +42,7 @@ void invalidAccountState() { Mockito.when(state.isDeleted()).thenReturn(true); TxValidatorAccountStateValidator tvasv = new TxValidatorAccountStateValidator(); - Assertions.assertFalse(tvasv.validate(null, state, null, null, Long.MAX_VALUE, false).transactionIsValid()); + ValidationArgs va = new ValidationArgs(state, null, null); + Assertions.assertFalse(tvasv.validate(null, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); } } diff --git a/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorIntrinsicGasLimitValidatorTest.java b/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorIntrinsicGasLimitValidatorTest.java index 00fb4feb170..bd586f28a97 100644 --- a/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorIntrinsicGasLimitValidatorTest.java +++ b/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorIntrinsicGasLimitValidatorTest.java @@ -27,6 +27,7 @@ import org.ethereum.core.BlockTxSignatureCache; import org.ethereum.core.ReceivedTxSignatureCache; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; import org.ethereum.crypto.ECKey; import org.ethereum.vm.PrecompiledContracts; import org.junit.jupiter.api.Assertions; @@ -96,11 +97,12 @@ void validIntrinsicGasPrice() { tx4.sign(BridgeRegTestConstants.REGTEST_FEDERATION_PRIVATE_KEYS.get(0).getPrivKeyBytes()); TxValidatorIntrinsicGasLimitValidator tvigpv = new TxValidatorIntrinsicGasLimitValidator(constants, activationConfig, new BlockTxSignatureCache(new ReceivedTxSignatureCache())); + ValidationArgs va = new ValidationArgs(new AccountState(), null, null); - Assertions.assertTrue(tvigpv.validate(tx1, new AccountState(), null, null, Long.MAX_VALUE, false).transactionIsValid()); - Assertions.assertTrue(tvigpv.validate(tx2, new AccountState(), null, null, Long.MAX_VALUE, false).transactionIsValid()); - Assertions.assertTrue(tvigpv.validate(tx3, new AccountState(), null, null, Long.MAX_VALUE, false).transactionIsValid()); - Assertions.assertTrue(tvigpv.validate(tx4, new AccountState(), null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertTrue(tvigpv.validate(tx1, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertTrue(tvigpv.validate(tx2, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertTrue(tvigpv.validate(tx3, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertTrue(tvigpv.validate(tx4, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); } @Test @@ -152,11 +154,12 @@ void invalidIntrinsicGasPrice() { tx4.sign(new ECKey().getPrivKeyBytes()); TxValidatorIntrinsicGasLimitValidator tvigpv = new TxValidatorIntrinsicGasLimitValidator(constants, activationConfig, new BlockTxSignatureCache(new ReceivedTxSignatureCache())); + ValidationArgs va = new ValidationArgs(new AccountState(), null, null); - Assertions.assertFalse(tvigpv.validate(tx1, new AccountState(), null, null, Long.MAX_VALUE, false).transactionIsValid()); - Assertions.assertFalse(tvigpv.validate(tx2, new AccountState(), null, null, Long.MAX_VALUE, false).transactionIsValid()); - Assertions.assertFalse(tvigpv.validate(tx3, new AccountState(), null, null, Long.MAX_VALUE, false).transactionIsValid()); - Assertions.assertFalse(tvigpv.validate(tx4, new AccountState(), null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertFalse(tvigpv.validate(tx1, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertFalse(tvigpv.validate(tx2, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertFalse(tvigpv.validate(tx3, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertFalse(tvigpv.validate(tx4, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); } } diff --git a/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorNonceRangeValidatorTest.java b/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorNonceRangeValidatorTest.java index 56cd2c92da3..008e92745b2 100644 --- a/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorNonceRangeValidatorTest.java +++ b/rskj-core/src/test/java/co/rsk/net/handler/txvalidator/TxValidatorNonceRangeValidatorTest.java @@ -20,6 +20,7 @@ import org.ethereum.core.AccountState; import org.ethereum.core.Transaction; +import org.ethereum.core.ValidationArgs; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -41,9 +42,11 @@ void oneSlotRange() { Mockito.when(as.getNonce()).thenReturn(BigInteger.valueOf(1)); TxValidatorNonceRangeValidator tvnrv = new TxValidatorNonceRangeValidator(1); - Assertions.assertFalse(tvnrv.validate(tx1, as, null, null, Long.MAX_VALUE, false).transactionIsValid()); - Assertions.assertTrue(tvnrv.validate(tx2, as, null, null, Long.MAX_VALUE, false).transactionIsValid()); - Assertions.assertFalse(tvnrv.validate(tx3, as, null, null, Long.MAX_VALUE, false).transactionIsValid()); + ValidationArgs va = new ValidationArgs(as, null, null); + + Assertions.assertFalse(tvnrv.validate(tx1, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertTrue(tvnrv.validate(tx2, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); + Assertions.assertFalse(tvnrv.validate(tx3, va, null, null, Long.MAX_VALUE, false).transactionIsValid()); } @Test @@ -62,7 +65,9 @@ void fiveSlotsRange() { for (int i = 0; i < 7; i++) { Transaction tx = txs[i]; long txNonce = tx.getNonceAsInteger().longValue(); - boolean isValid = tvnrv.validate(tx, as, null, null, Long.MAX_VALUE, false).transactionIsValid(); + ValidationArgs va = new ValidationArgs(as, null, null); + + boolean isValid = tvnrv.validate(tx, va, null, null, Long.MAX_VALUE, false).transactionIsValid(); Assertions.assertEquals(isValid, txNonce >= 1 && txNonce <= 5); // only valid if tx nonce is in the range [1; 5] } } diff --git a/rskj-core/src/test/java/co/rsk/remasc/RemascStorageProviderTest.java b/rskj-core/src/test/java/co/rsk/remasc/RemascStorageProviderTest.java index 2109e823403..3d5f3d9eed0 100644 --- a/rskj-core/src/test/java/co/rsk/remasc/RemascStorageProviderTest.java +++ b/rskj-core/src/test/java/co/rsk/remasc/RemascStorageProviderTest.java @@ -320,7 +320,7 @@ void doesntPayFedBelowMinimumRewardAfterRFS() throws IOException { when(constants.getFederatorMinimumPayableGas()).thenReturn(BigInteger.valueOf(10000L)); RskSystemProperties config = spy(new TestSystemProperties()); when(config.getNetworkConstants()).thenReturn(constants); - when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.allBut(ConsensusRule.RSKIP00)); + when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.allBut(ConsensusRule.RSKIP432)); long minerFee = 21000; long txValue = 10000; long gasPrice = 1L; @@ -359,7 +359,7 @@ void doesntPayBelowMinimumRewardAfterRFS() throws IOException { when(constants.getMinimumPayableGas()).thenReturn(BigInteger.valueOf(10000L)); RskSystemProperties config = spy(new TestSystemProperties()); when(config.getNetworkConstants()).thenReturn(constants); - when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.allBut(ConsensusRule.RSKIP00)); + when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.allBut(ConsensusRule.RSKIP432)); long minerFee = 21000; long txValue = 10000; long gasPrice = 1L; @@ -384,7 +384,7 @@ void paysFedWhenHigherThanMinimumRewardAfterRFS() throws IOException { when(constants.getFederatorMinimumPayableGas()).thenReturn(BigInteger.valueOf(10L)); RskSystemProperties config = spy(new TestSystemProperties()); when(config.getNetworkConstants()).thenReturn(constants); - when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.allBut(ConsensusRule.RSKIP00)); + when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.allBut(ConsensusRule.RSKIP432)); long minerFee = 21000; long txValue = 10000; long gasPrice = 10L; @@ -426,7 +426,7 @@ void paysWhenHigherThanMinimumRewardAfterRFS() throws IOException { when(constants.getFederatorMinimumPayableGas()).thenReturn(BigInteger.valueOf(10L)); RskSystemProperties config = spy(new TestSystemProperties()); when(config.getNetworkConstants()).thenReturn(constants); - when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.allBut(ConsensusRule.RSKIP00)); + when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.allBut(ConsensusRule.RSKIP432)); long minerFee = 21000; long txValue = 10000; long gasPrice = 10L; @@ -451,7 +451,7 @@ void paysOnlyBlocksWithEnoughBalanceAccumulatedAfterRFS() throws IOException { when(constants.getMinimumPayableGas()).thenReturn(BigInteger.valueOf(21000L)); RskSystemProperties config = spy(new TestSystemProperties()); when(config.getNetworkConstants()).thenReturn(constants); - when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.allBut(ConsensusRule.RSKIP00)); + when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.allBut(ConsensusRule.RSKIP432)); long txValue = 10000; long gasLimit = 100000L; long gasPrice = 10L; diff --git a/rskj-core/src/test/java/co/rsk/util/ClaimTransactionValidatorTest.java b/rskj-core/src/test/java/co/rsk/util/ClaimTransactionValidatorTest.java index 3a3561dc4d2..1d48497e6d7 100644 --- a/rskj-core/src/test/java/co/rsk/util/ClaimTransactionValidatorTest.java +++ b/rskj-core/src/test/java/co/rsk/util/ClaimTransactionValidatorTest.java @@ -73,7 +73,7 @@ public void whenIsClaimTxAndValidIsCalled_shouldReturnTrue() { when(mockedRepository.getStorageValue(eq(mockedClaimTx.getReceiveAddress()), any(DataWord.class))) .thenReturn(DataWord.valueOf(1)); when(mockedRepository.getBalance(any(RskAddress.class))).thenReturn(Coin.valueOf(3)); - when(mockedActivationConfig.isActive(ConsensusRule.RSKIP00)).thenReturn(true); + when(mockedActivationConfig.isActive(ConsensusRule.RSKIP432)).thenReturn(true); boolean result = claimTransactionValidator.isClaimTxAndValid(mockedClaimTx, mockedRepository, mockedActivationConfig); diff --git a/rskj-core/src/test/java/org/ethereum/config/blockchain/upgrades/ActivationConfigTest.java b/rskj-core/src/test/java/org/ethereum/config/blockchain/upgrades/ActivationConfigTest.java index 100252e53c2..54a91c0a251 100644 --- a/rskj-core/src/test/java/org/ethereum/config/blockchain/upgrades/ActivationConfigTest.java +++ b/rskj-core/src/test/java/org/ethereum/config/blockchain/upgrades/ActivationConfigTest.java @@ -44,7 +44,6 @@ class ActivationConfigTest { " fingerroot500: 0", " arrowhead600: 0", " lovell700: 0", - " tbd000: 0", "},", "consensusRules: {", " areBridgeTxsPaid: afterBridgeSync,", @@ -121,7 +120,7 @@ class ActivationConfigTest { " rskip412: arrowhead600", " rskip415: arrowhead600", " rskip417: arrowhead600", - " rskip00: tbd000", + " rskip432: lovell700", "}" ));