From d2c2e767cd6729a9b9e834c5e46bc45210aa71ac Mon Sep 17 00:00:00 2001 From: Mariusz Jasuwienas Date: Tue, 26 Nov 2024 13:56:38 +0100 Subject: [PATCH] Number of digits - check if the value can be updated on the runtime... Signed-off-by: Mariusz Jasuwienas --- .../impl/exec/utils/FrameBuilder.java | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/FrameBuilder.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/FrameBuilder.java index 111a1b220bf7..32f571a203b3 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/FrameBuilder.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/FrameBuilder.java @@ -95,28 +95,41 @@ public MessageFrame buildInitialFrameWith( final var ledgerConfig = config.getConfigData(LedgerConfig.class); final var nominalCoinbase = asLongZeroAddress(ledgerConfig.fundingAccount()); final var contextVariables = contextVariablesFrom(config, context); - final var builder = MessageFrame.builder() + if (transaction.isCreate()) { + final var standardBuilder = MessageFrame.builder() .maxStackSize(MAX_STACK_SIZE) .worldUpdater(worldUpdater.updater()) .initialGas(transaction.gasAvailable(intrinsicGas)) .originator(from) .gasPrice(Wei.of(context.gasPrice())) .sender(from) - .value(Wei.of(1)) - .apparentValue(Wei.of(1)) - // .value(value) - // .apparentValue(value) + .value(value) + .apparentValue(value) .blockValues(context.blockValuesOf(transaction.gasLimit())) .completer(unused -> {}) .isStatic(context.staticCall()) .miningBeneficiary(nominalCoinbase) .blockHashLookup(context.blocks()::blockHashOf) .contextVariables(contextVariables); - if (transaction.isCreate()) { - return finishedAsCreate(to, builder, transaction); + return finishedAsCreate(to, standardBuilder, transaction); } else { + final var fakeValueBuilder = MessageFrame.builder() + .maxStackSize(MAX_STACK_SIZE) + .worldUpdater(worldUpdater.updater()) + .initialGas(transaction.gasAvailable(intrinsicGas)) + .originator(from) + .gasPrice(Wei.of(context.gasPrice())) + .sender(from) + .value(Wei.of(1000_000_001L)) + .apparentValue(Wei.of(1000_000_001L)) + .blockValues(context.blockValuesOf(transaction.gasLimit())) + .completer(unused -> {}) + .isStatic(context.staticCall()) + .miningBeneficiary(nominalCoinbase) + .blockHashLookup(context.blocks()::blockHashOf) + .contextVariables(contextVariables); return finishedAsCall( - to, worldUpdater, builder, transaction, featureFlags, config.getConfigData(ContractsConfig.class)); + to, worldUpdater, fakeValueBuilder, transaction, featureFlags, config.getConfigData(ContractsConfig.class)); } }