diff --git a/hedera-node/configuration/compose/bootstrap.properties b/hedera-node/configuration/compose/bootstrap.properties index f46de3d2dac2..65699edba791 100644 --- a/hedera-node/configuration/compose/bootstrap.properties +++ b/hedera-node/configuration/compose/bootstrap.properties @@ -3,3 +3,4 @@ accounts.blocklist.enabled=false accounts.blocklist.path= contracts.knownBlockHash= +contracts.evm.version=v0.30 \ No newline at end of file diff --git a/hedera-node/configuration/dev/bootstrap.properties b/hedera-node/configuration/dev/bootstrap.properties index 391cc478a4ac..aa1159b02393 100644 --- a/hedera-node/configuration/dev/bootstrap.properties +++ b/hedera-node/configuration/dev/bootstrap.properties @@ -11,3 +11,4 @@ staking.fees.nodeRewardPercentage=10 staking.fees.stakingRewardPercentage=10 contracts.knownBlockHash= +contracts.evm.version=v0.30 \ No newline at end of file diff --git a/hedera-node/configuration/mainnet/bootstrap.properties b/hedera-node/configuration/mainnet/bootstrap.properties index 432b7ad28eab..5fa2a8207f71 100644 --- a/hedera-node/configuration/mainnet/bootstrap.properties +++ b/hedera-node/configuration/mainnet/bootstrap.properties @@ -4,3 +4,4 @@ # This file MUST match application.properties exactly as they are both a replica of file 121 on mainnet and # this file is utilized by the mono-service config for property overrides whereas application.properties is utilized as # an override by the hedera-config base config. +contracts.evm.version=v0.30 \ No newline at end of file diff --git a/hedera-node/configuration/preprod/bootstrap.properties b/hedera-node/configuration/preprod/bootstrap.properties index 9e986e1919b1..e6d7a76ea17f 100644 --- a/hedera-node/configuration/preprod/bootstrap.properties +++ b/hedera-node/configuration/preprod/bootstrap.properties @@ -4,3 +4,4 @@ accounts.blocklist.enabled=false accounts.blocklist.path= contracts.knownBlockHash= +contracts.evm.version=v0.30 \ No newline at end of file diff --git a/hedera-node/configuration/previewnet/bootstrap.properties b/hedera-node/configuration/previewnet/bootstrap.properties index 13797d13fbf8..111decce3920 100644 --- a/hedera-node/configuration/previewnet/bootstrap.properties +++ b/hedera-node/configuration/previewnet/bootstrap.properties @@ -5,5 +5,5 @@ accounts.blocklist.enabled=false accounts.blocklist.path= contracts.evm.version.dynamic=true contracts.maxNumWithHapiSigsAccess=0 - +contracts.evm.version=v0.30 contracts.knownBlockHash= diff --git a/hedera-node/configuration/testnet/bootstrap.properties b/hedera-node/configuration/testnet/bootstrap.properties index 017d695f584c..aaa8090ef19e 100644 --- a/hedera-node/configuration/testnet/bootstrap.properties +++ b/hedera-node/configuration/testnet/bootstrap.properties @@ -14,3 +14,4 @@ ledger.id=0x01 contracts.chainId=296 bootstrap.genesisPublicKey=e06b22e0966108fa5d63fc6ae53f9824319b891cd4d6050dbf2b242be7e13344 contracts.knownBlockHash= +contracts.evm.version=v0.30 diff --git a/hedera-node/hapi-utils/src/main/java/com/hedera/node/app/hapi/utils/ethereum/EthTxData.java b/hedera-node/hapi-utils/src/main/java/com/hedera/node/app/hapi/utils/ethereum/EthTxData.java index e655ef159256..ee7f9f49392c 100644 --- a/hedera-node/hapi-utils/src/main/java/com/hedera/node/app/hapi/utils/ethereum/EthTxData.java +++ b/hedera-node/hapi-utils/src/main/java/com/hedera/node/app/hapi/utils/ethereum/EthTxData.java @@ -31,6 +31,7 @@ import java.util.Objects; import org.apache.commons.codec.binary.Hex; import org.bouncycastle.jcajce.provider.digest.Keccak; +import org.bouncycastle.util.BigIntegers; public record EthTxData( byte[] rawTx, @@ -55,7 +56,7 @@ public record EthTxData( * transactions come in with transfer amounts in units of weibar. Elsewhere in Hedera we use * units of tinybar (10⁻⁸ of an hbar), and here is the conversion factor: */ - public static final BigInteger WEIBARS_IN_A_TINYBAR = BigInteger.valueOf(10_000_000_000L); + public static final BigInteger WEIBARS_IN_A_TINYBAR = BigInteger.valueOf(1L); // Copy of constants from besu-native, remove when next besu-native publishes static final int SECP256K1_FLAGS_TYPE_COMPRESSION = 1 << 1; @@ -385,7 +386,7 @@ private static EthTxData populateLegacyEthTxData(RLPItem rlpItem, byte[] rawTx) if (vBI.compareTo(BigInteger.valueOf(34)) > 0) { // after EIP155 the chain id is equal to // CHAIN_ID = (v - {0,1} - 35) / 2 - chainId = vBI.subtract(BigInteger.valueOf(35)).shiftRight(1).toByteArray(); + chainId = BigIntegers.asUnsignedByteArray(vBI.subtract(BigInteger.valueOf(35)).shiftRight(1)); } else if (isLegacyUnprotectedEtx(vBI)) { // before EIP155 the chain id is considered equal to 0 chainId = new byte[0]; diff --git a/hedera-node/hapi-utils/src/test/java/com/hedera/node/app/hapi/utils/ethereum/EthTxDataTest.java b/hedera-node/hapi-utils/src/test/java/com/hedera/node/app/hapi/utils/ethereum/EthTxDataTest.java index 3d87475d37fb..746ce9399e04 100644 --- a/hedera-node/hapi-utils/src/test/java/com/hedera/node/app/hapi/utils/ethereum/EthTxDataTest.java +++ b/hedera-node/hapi-utils/src/test/java/com/hedera/node/app/hapi/utils/ethereum/EthTxDataTest.java @@ -35,6 +35,7 @@ import java.math.BigInteger; import java.util.Arrays; import java.util.List; +import org.bouncycastle.util.BigIntegers; import org.bouncycastle.util.encoders.Hex; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -46,6 +47,8 @@ class EthTxDataTest { static final String SIGNATURE_PUBKEY = "033a514176466fa815ed481ffad09110a2d344f6c9b78c1d14afc351c3a51be33d"; static final String RAW_TX_TYPE_0 = "f864012f83018000947e3a9eaf9bcc39e2ffa38eb30bf7a93feacbc18180827653820277a0f9fbff985d374be4a55f296915002eec11ac96f1ce2df183adf992baa9390b2fa00c1e867cc960d9c74ec2e6a662b7908ec4c8cc9f3091e886bcefbeb2290fb792"; + static final String RAW_TX_TYPE_0_WITH_CHAIN_ID_11155111 = + "f86b048503ff9aca0782520f94e64fac7f3df5ab44333ad3d3eb3fb68be43f2e8c830fffff808401546d71a026cf0758fda122862a4de71a82a3210ef7c172ee13eae42997f5d32b747ec78ca03587c5c2eee373b1e45693544edcde8dde883d2be3e211b3f0f3c840d6389c8a"; static final String RAW_TX_TYPE_0_TRIMMED_LAST_BYTES = "f864012f83018000947e3a9eaf9bcc39e2ffa38eb30bf7a93feacbc18180827653820277a0f9fbff985d374be4a55f296915002eec11ac96f1ce2df183adf992baa9390b2fa00c1e867cc960d9c74ec2e6a662b7908ec4c8cc9f3091e886bcefbeb2290000"; // { @@ -601,4 +604,18 @@ void bigPositiveValueWithDifferentTypes(EthTransactionType type) { assertEquals(bigValue, populateEthTxData.value()); } + + @Test + void thatPassesOnBigIntegerByteArray() { + final var subject = EthTxData.populateEthTxData(Hex.decode(RAW_TX_TYPE_0_WITH_CHAIN_ID_11155111)); + byte[] passingChainId = BigIntegers.asUnsignedByteArray(BigInteger.valueOf(11155111L)); + assertEquals(Hex.toHexString(subject.chainId()), Hex.toHexString(passingChainId)); + } + + @Test + void thatFailsOnBigIntegerByteArray() { + final var subject = EthTxData.populateEthTxData(Hex.decode(RAW_TX_TYPE_0_WITH_CHAIN_ID_11155111)); + byte[] failingChainId = BigInteger.valueOf(11155111L).toByteArray(); + assertNotEquals(Hex.toHexString(subject.chainId()), Hex.toHexString(failingChainId)); + } } diff --git a/hedera-node/hapi-utils/src/test/java/com/hedera/node/app/hapi/utils/ethereum/TestingConstants.java b/hedera-node/hapi-utils/src/test/java/com/hedera/node/app/hapi/utils/ethereum/TestingConstants.java index 20a44d5b186e..937e203d346a 100644 --- a/hedera-node/hapi-utils/src/test/java/com/hedera/node/app/hapi/utils/ethereum/TestingConstants.java +++ b/hedera-node/hapi-utils/src/test/java/com/hedera/node/app/hapi/utils/ethereum/TestingConstants.java @@ -35,7 +35,7 @@ public class TestingConstants { static final byte[] CHAINID_TESTNET = unhex("0128"); - static final BigInteger WEIBARS_IN_TINYBAR = BigInteger.valueOf(10_000_000_000L); + static final BigInteger WEIBARS_IN_TINYBAR = BigInteger.valueOf(1L); static final byte[] TINYBARS_57_IN_WEIBARS = BigInteger.valueOf(57).multiply(WEIBARS_IN_TINYBAR).toByteArray(); diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/ingest/IngestChecker.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/ingest/IngestChecker.java index b5ffdfd3f2eb..4b34692d3b1b 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/ingest/IngestChecker.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/ingest/IngestChecker.java @@ -148,6 +148,9 @@ public IngestChecker( */ public void checkNodeState() throws PreCheckException { if (currentPlatformStatus.get() != ACTIVE) { + logger.info( + "CURRENT PLATFORM STATUS is {} just before PLATFORM_NOT_ACTIVE error \n\n", + currentPlatformStatus.get().toString()); throw new PreCheckException(PLATFORM_NOT_ACTIVE); } } diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/HapiSuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/HapiSuite.java index f882089461fd..022e6686ad13 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/HapiSuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/HapiSuite.java @@ -95,7 +95,7 @@ private static HapiSpec specFrom(@NonNull final DynamicTest test) { .build(); private static final int BYTES_PER_KB = 1024; public static final int MAX_CALL_DATA_SIZE = 6 * BYTES_PER_KB; - public static final BigInteger WEIBARS_IN_A_TINYBAR = BigInteger.valueOf(10_000_000_000L); + public static final BigInteger WEIBARS_IN_A_TINYBAR = BigInteger.valueOf(1L); // Useful for testing overflow scenarios when an ERC-20/721 ABI specifies // a uint256, but a valid value on Hedera will be an 8-byte long only public static final BigInteger MAX_UINT256_VALUE =