Skip to content

Commit

Permalink
Number of digits - check if the value can be updated on the runtime...
Browse files Browse the repository at this point in the history
Signed-off-by: Mariusz Jasuwienas <[email protected]>
  • Loading branch information
arianejasuwienas committed Nov 26, 2024
1 parent ccc545c commit 060f735
Show file tree
Hide file tree
Showing 13 changed files with 11 additions and 35 deletions.
4 changes: 2 additions & 2 deletions hedera-dependency-versions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ dependencies.constraints {
api("org.hamcrest:hamcrest:2.2") {
because("org.hamcrest")
}
api("org.hyperledger.besu:besu-datatypes:23.10.0") {
api("org.hyperledger.besu:besu-datatypes:24.3.3") {
because("org.hyperledger.besu.datatypes")
}
api("org.hyperledger.besu:evm:23.10.0") {
api("org.hyperledger.besu:evm:24.3.3") {
because("org.hyperledger.besu.evm")
}
api("org.hyperledger.besu:secp256k1:0.8.2") {
Expand Down
1 change: 0 additions & 1 deletion hedera-node/configuration/compose/bootstrap.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ accounts.blocklist.enabled=false
accounts.blocklist.path=

contracts.knownBlockHash=
contracts.evm.version=v0.30
1 change: 0 additions & 1 deletion hedera-node/configuration/dev/bootstrap.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ staking.fees.nodeRewardPercentage=10
staking.fees.stakingRewardPercentage=10

contracts.knownBlockHash=
contracts.evm.version=v0.30
1 change: 0 additions & 1 deletion hedera-node/configuration/mainnet/bootstrap.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
# 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
1 change: 0 additions & 1 deletion hedera-node/configuration/preprod/bootstrap.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ accounts.blocklist.enabled=false
accounts.blocklist.path=

contracts.knownBlockHash=
contracts.evm.version=v0.30
2 changes: 1 addition & 1 deletion hedera-node/configuration/previewnet/bootstrap.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=
1 change: 0 additions & 1 deletion hedera-node/configuration/testnet/bootstrap.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ ledger.id=0x01
contracts.chainId=296
bootstrap.genesisPublicKey=e06b22e0966108fa5d63fc6ae53f9824319b891cd4d6050dbf2b242be7e13344
contracts.knownBlockHash=
contracts.evm.version=v0.30
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
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,
Expand All @@ -56,7 +55,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(1L);
public static final BigInteger WEIBARS_IN_A_TINYBAR = BigInteger.valueOf(10_000_000_000L);

// Copy of constants from besu-native, remove when next besu-native publishes
static final int SECP256K1_FLAGS_TYPE_COMPRESSION = 1 << 1;
Expand Down Expand Up @@ -386,7 +385,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 = BigIntegers.asUnsignedByteArray(vBI.subtract(BigInteger.valueOf(35)).shiftRight(1));
chainId = vBI.subtract(BigInteger.valueOf(35)).shiftRight(1).toByteArray();
} else if (isLegacyUnprotectedEtx(vBI)) {
// before EIP155 the chain id is considered equal to 0
chainId = new byte[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
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;
Expand All @@ -47,8 +46,6 @@ 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";
// {
Expand Down Expand Up @@ -604,18 +601,4 @@ 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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class TestingConstants {

static final byte[] CHAINID_TESTNET = unhex("0128");

static final BigInteger WEIBARS_IN_TINYBAR = BigInteger.valueOf(1L);
static final BigInteger WEIBARS_IN_TINYBAR = BigInteger.valueOf(10_000_000_000L);

static final byte[] TINYBARS_57_IN_WEIBARS =
BigInteger.valueOf(57).multiply(WEIBARS_IN_TINYBAR).toByteArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ 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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ public MessageFrame buildInitialFrameWith(
.originator(from)
.gasPrice(Wei.of(context.gasPrice()))
.sender(from)
.value(value)
.apparentValue(value)
.value(Wei.of(1))
.apparentValue(Wei.of(1))
// .value(value)
// .apparentValue(value)
.blockValues(context.blockValuesOf(transaction.gasLimit()))
.completer(unused -> {})
.isStatic(context.staticCall())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(1L);
public static final BigInteger WEIBARS_IN_A_TINYBAR = BigInteger.valueOf(10_000_000_000L);
// 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 =
Expand Down

0 comments on commit 060f735

Please sign in to comment.