From 63933997fd5eef3d8d75321ebd4f85464d9fa7f7 Mon Sep 17 00:00:00 2001 From: Daniel Lehrner Date: Wed, 9 Oct 2024 16:24:25 +0200 Subject: [PATCH] warm delegatee account if transaction destination has delegated code Signed-off-by: Daniel Lehrner --- .../besu/ethereum/mainnet/MainnetTransactionProcessor.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java index 7aaf68fd62..615218aec3 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java @@ -415,7 +415,6 @@ public class MainnetTransactionProcessor { .miningBeneficiary(miningBeneficiary) .blockHashLookup(blockHashLookup) .contextVariables(contextVariablesBuilder.build()) - .accessListWarmAddresses(warmAddressList) .accessListWarmStorage(storageList); if (transaction.getVersionedHashes().isPresent()) { @@ -439,12 +438,17 @@ public class MainnetTransactionProcessor { .contract(contractAddress) .inputData(initCodeBytes.slice(code.getSize())) .code(code) + .accessListWarmAddresses(warmAddressList) .build(); } else { @SuppressWarnings("OptionalGetWithoutIsPresent") // isContractCall tests isPresent final Address to = transaction.getTo().get(); final Optional maybeContract = Optional.ofNullable(evmWorldUpdater.get(to)); + if (maybeContract.isPresent() && maybeContract.get().hasDelegatedCode()) { + warmAddressList.add(maybeContract.get().delegatedCodeAddress().get()); + } + initialFrame = commonMessageFrameBuilder .type(MessageFrame.Type.MESSAGE_CALL) @@ -455,6 +459,7 @@ public class MainnetTransactionProcessor { maybeContract .map(c -> messageCallProcessor.getCodeFromEVM(c.getCodeHash(), c.getCode())) .orElse(CodeV0.EMPTY_CODE)) + .accessListWarmAddresses(warmAddressList) .build(); } Deque messageFrameStack = initialFrame.getMessageFrameStack();