From 1d95147ef4cd72960e4a24c691213916b649b024 Mon Sep 17 00:00:00 2001 From: tbenr Date: Mon, 27 Sep 2021 19:46:46 +0200 Subject: [PATCH 01/14] updated BlockProcessorMerge::processExecutionPayload and GenesisGenerator::updateCandidateState * is_valid_gas_limit validation * random validation * added new params for megre --- .../pegasys/teku/spec/config/SpecConfig.java | 2 + .../teku/spec/config/SpecConfigBuilder.java | 26 ++++++++++++- .../teku/spec/config/SpecConfigMerge.java | 25 +++++++++++- .../teku/spec/config/SpecConfigReader.java | 2 + .../teku/spec/genesis/GenesisGenerator.java | 8 ++-- .../merge/block/BlockProcessorMerge.java | 39 +++++++++++++++++++ .../config/invalid/invalidPreset_unknown.yaml | 3 ++ .../invalid/invalidPreset_wrongType.yaml | 3 ++ .../invalid/multifile_dupFields/config.yaml | 3 ++ .../teku/spec/config/standard/mainnet.yaml | 3 ++ .../teku/spec/config/standard/minimal.yaml | 3 ++ .../teku/cli/subcommand/test-spec.yaml | 3 ++ .../teku/util/config/ConstantsReader.java | 2 + .../teku/util/config/configs/mainnet.yaml | 3 ++ .../teku/util/config/configs/minimal.yaml | 3 ++ .../teku/util/config/configs/prater.yaml | 3 ++ .../teku/util/config/configs/pyrmont.yaml | 3 ++ .../config/invalid/invalidPresetType.yaml | 3 ++ .../util/config/invalid/unknownPreset.yaml | 3 ++ 19 files changed, 133 insertions(+), 7 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfig.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfig.java index a3b1148c894..a707cfcda9f 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfig.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfig.java @@ -29,6 +29,8 @@ public interface SpecConfig { int BYTES_PER_LOGS_BLOOM = 256; int MAX_BYTES_PER_OPAQUE_TRANSACTION = 1048576; int MAX_EXECUTION_TRANSACTIONS = 16384; + int GAS_LIMIT_DENOMINATOR = 1024; + int MIN_GAS_LIMIT = 5000; int MAX_EXTRA_DATA_BYTES = 32; static SpecConfigBuilder builder() { diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBuilder.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBuilder.java index da37640b920..b20a468dfa4 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBuilder.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBuilder.java @@ -22,6 +22,7 @@ import java.util.Optional; import java.util.function.Consumer; import org.apache.tuweni.bytes.Bytes; +import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.units.bigints.UInt256; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.ssz.type.Bytes4; @@ -674,6 +675,10 @@ public SpecConfigBuilder mergeBuilder(final Consumer consumer) { public class MergeBuilder { + // Genesis + private UInt64 genesisGasLimit; + private Bytes32 genesisBaseFeePerGas; + // Fork private Bytes4 mergeForkVersion; private UInt64 mergeForkEpoch; @@ -685,15 +690,34 @@ private MergeBuilder() {} SpecConfigMerge build(final SpecConfigAltair specConfig) { return new SpecConfigMerge( - specConfig, mergeForkVersion, mergeForkEpoch, terminalTotalDifficulty); + specConfig, + genesisGasLimit, + genesisBaseFeePerGas, + mergeForkVersion, + mergeForkEpoch, + terminalTotalDifficulty); } void validate() { + validateConstant("genesisGasLimit", genesisGasLimit); + validateConstant("genesisBaseFeePerGas", genesisBaseFeePerGas); validateConstant("mergeForkVersion", mergeForkVersion); validateConstant("mergeForkEpoch", mergeForkEpoch); validateConstant("terminalTotalDifficulty", terminalTotalDifficulty); } + public MergeBuilder genesisGasLimit(UInt64 genesisGasLimit) { + checkNotNull(genesisGasLimit); + this.genesisGasLimit = genesisGasLimit; + return this; + } + + public MergeBuilder genesisBaseFeePerGas(Bytes32 genesisBaseFeePerGas) { + checkNotNull(genesisBaseFeePerGas); + this.genesisBaseFeePerGas = genesisBaseFeePerGas; + return this; + } + public MergeBuilder mergeForkVersion(Bytes4 mergeForkVersion) { checkNotNull(mergeForkVersion); this.mergeForkVersion = mergeForkVersion; diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java index 76111f7a284..e29e961acce 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java @@ -16,12 +16,17 @@ import java.util.Objects; import java.util.Optional; import java.util.function.Function; +import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.units.bigints.UInt256; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.ssz.type.Bytes4; public class SpecConfigMerge extends DelegatingSpecConfigAltair { + // Genesis + private UInt64 genesisGasLimit; + private Bytes32 genesisBaseFeePerGas; + // Fork private final Bytes4 mergeForkVersion; private final UInt64 mergeForkEpoch; @@ -31,6 +36,8 @@ public class SpecConfigMerge extends DelegatingSpecConfigAltair { public SpecConfigMerge( SpecConfigAltair specConfig, + UInt64 genesisGasLimit, + Bytes32 genesisBaseFeePerGas, Bytes4 mergeForkVersion, UInt64 mergeForkEpoch, UInt256 terminalTotalDifficulty) { @@ -62,6 +69,14 @@ public static T required( + specConfig.getClass().getSimpleName()))); } + public UInt64 getGenesisGasLimit() { + return genesisGasLimit; + } + + public Bytes32 getGenesisBaseFeePerGas() { + return genesisBaseFeePerGas; + } + public Bytes4 getMergeForkVersion() { return mergeForkVersion; } @@ -88,13 +103,19 @@ public boolean equals(Object o) { return false; } SpecConfigMerge that = (SpecConfigMerge) o; - return Objects.equals(mergeForkVersion, that.mergeForkVersion) + return Objects.equals(genesisGasLimit, that.genesisGasLimit) + && Objects.equals(genesisBaseFeePerGas, that.genesisBaseFeePerGas) + && Objects.equals(mergeForkVersion, that.mergeForkVersion) && Objects.equals(mergeForkEpoch, that.mergeForkEpoch) && Objects.equals(terminalTotalDifficulty, that.terminalTotalDifficulty); } @Override public int hashCode() { - return Objects.hash(mergeForkVersion, mergeForkEpoch, terminalTotalDifficulty); + return Objects.hash(genesisGasLimit, + genesisBaseFeePerGas, + mergeForkVersion, + mergeForkEpoch, + terminalTotalDifficulty); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigReader.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigReader.java index 76d4f2a6b5b..3b132ba814f 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigReader.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigReader.java @@ -40,6 +40,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.tuweni.bytes.Bytes; +import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.units.bigints.UInt256; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.config.SpecConfigBuilder.MergeBuilder; @@ -89,6 +90,7 @@ public class SpecConfigReader { .put(String.class, Function.identity()) .put(Bytes.class, fromString(Bytes::fromHexString)) .put(Bytes4.class, fromString(Bytes4::fromHexString)) + .put(Bytes32.class, fromString(Bytes32::fromHexStringStrict)) .put(boolean.class, fromString(Boolean::valueOf)) .build(); diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/genesis/GenesisGenerator.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/genesis/GenesisGenerator.java index 4db13b493db..bcdf85db264 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/genesis/GenesisGenerator.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/genesis/GenesisGenerator.java @@ -93,13 +93,13 @@ public void updateCandidateState( Bytes32.ZERO, Bytes32.ZERO, Bytes.wrap(new byte[SpecConfig.BYTES_PER_LOGS_BLOOM]), - Bytes32.ZERO, - UInt64.ZERO, - UInt64.ZERO, + eth1BlockHash, UInt64.ZERO, + specConfig.toVersionMerge().orElseThrow().getGenesisGasLimit(), UInt64.ZERO, + eth1Timestamp, Bytes.EMPTY, - Bytes32.ZERO, + specConfig.toVersionMerge().orElseThrow().getGenesisBaseFeePerGas(), Bytes32.ZERO, Bytes32.ZERO))); diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/block/BlockProcessorMerge.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/block/BlockProcessorMerge.java index 79c4b407bc9..e2538a33994 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/block/BlockProcessorMerge.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/block/BlockProcessorMerge.java @@ -19,7 +19,9 @@ import org.apache.logging.log4j.Logger; import org.apache.tuweni.bytes.Bytes32; import tech.pegasys.teku.bls.BLSSignatureVerifier; +import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.cache.IndexedAttestationCache; +import tech.pegasys.teku.spec.config.SpecConfig; import tech.pegasys.teku.spec.config.SpecConfigMerge; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; @@ -153,8 +155,20 @@ public void processExecutionPayload( .getBlockNumber() .equals(state.getLatest_execution_payload_header().getBlockNumber().increment()), "process_execution_payload: Verify that the number is consequent"); + + checkArgument( + isValidGasLimit(executionPayload, state.getLatest_execution_payload_header()), + "process_execution_payload: Verify that gas limit is valid"); } + checkArgument( + executionPayload + .getRandom() + .equals( + beaconStateAccessors.getRandaoMix( + state, beaconStateAccessors.getCurrentEpoch(state))), + "process_execution_payload: Verify that the random is correct"); + checkArgument( executionPayload .getTimestamp() @@ -190,4 +204,29 @@ public void processExecutionPayload( throw new BlockProcessingException(e); } } + + private boolean isValidGasLimit(ExecutionPayload payload, ExecutionPayloadHeader parent) { + final UInt64 parentGasLimit = parent.getGas_limit(); + + // Check if the payload used too much gas + if (payload.getGas_used().isGreaterThan(parentGasLimit)) { + return false; + } + + // Check if the payload changed the gas limit too much + final UInt64 gasLimitMaxDeviation = parentGasLimit.dividedBy(SpecConfig.GAS_LIMIT_DENOMINATOR); + if (payload.getGas_limit().isGreaterThanOrEqualTo(parentGasLimit.plus(gasLimitMaxDeviation))) { + return false; + } + if (payload.getGas_limit().isLessThanOrEqualTo(parentGasLimit.minus(gasLimitMaxDeviation))) { + return false; + } + + // Check if the gas limit is at least the minimum gas limit + if (payload.getGas_limit().isLessThan(SpecConfig.MIN_GAS_LIMIT)) { + return false; + } + + return true; + } } diff --git a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/invalidPreset_unknown.yaml b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/invalidPreset_unknown.yaml index f5f4642037a..3953222e2d7 100644 --- a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/invalidPreset_unknown.yaml +++ b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/invalidPreset_unknown.yaml @@ -14,6 +14,9 @@ GENESIS_FORK_VERSION: 0x00000001 # [customized] Faster to spin up testnets, but does not give validator reasonable warning time for genesis GENESIS_DELAY: 300 +# Genesis - Merge +GENESIS_GAS_LIMIT: 30000000 +GENESIS_BASE_FEE_PER_GAS: 0x00ca9a3b00000000000000000000000000000000000000000000000000000000 # Forking # --------------------------------------------------------------- diff --git a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/invalidPreset_wrongType.yaml b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/invalidPreset_wrongType.yaml index 8a498dc804b..6184db16673 100644 --- a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/invalidPreset_wrongType.yaml +++ b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/invalidPreset_wrongType.yaml @@ -14,6 +14,9 @@ GENESIS_FORK_VERSION: 0x00000001 # [customized] Faster to spin up testnets, but does not give validator reasonable warning time for genesis GENESIS_DELAY: 300 +# Genesis - Merge +GENESIS_GAS_LIMIT: 30000000 +GENESIS_BASE_FEE_PER_GAS: 0x00ca9a3b00000000000000000000000000000000000000000000000000000000 # Forking # --------------------------------------------------------------- diff --git a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/multifile_dupFields/config.yaml b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/multifile_dupFields/config.yaml index 2ec9212c56e..e168ca8c273 100644 --- a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/multifile_dupFields/config.yaml +++ b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/multifile_dupFields/config.yaml @@ -17,6 +17,9 @@ GENESIS_FORK_VERSION: 0x00000000 # 604800 seconds (7 days) GENESIS_DELAY: 604800 +# Genesis - Merge +GENESIS_GAS_LIMIT: 30000000 +GENESIS_BASE_FEE_PER_GAS: 0x00ca9a3b00000000000000000000000000000000000000000000000000000000 # Forking # --------------------------------------------------------------- diff --git a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/standard/mainnet.yaml b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/standard/mainnet.yaml index 97649995448..46f6426b969 100644 --- a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/standard/mainnet.yaml +++ b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/standard/mainnet.yaml @@ -14,6 +14,9 @@ GENESIS_FORK_VERSION: 0x00000000 # 604800 seconds (7 days) GENESIS_DELAY: 604800 +# Genesis - Merge +GENESIS_GAS_LIMIT: 30000000 +GENESIS_BASE_FEE_PER_GAS: 0x00ca9a3b00000000000000000000000000000000000000000000000000000000 # Forking # --------------------------------------------------------------- diff --git a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/standard/minimal.yaml b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/standard/minimal.yaml index 7172fa3ede9..05a5af6d8c2 100644 --- a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/standard/minimal.yaml +++ b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/standard/minimal.yaml @@ -14,6 +14,9 @@ GENESIS_FORK_VERSION: 0x00000001 # [customized] Faster to spin up testnets, but does not give validator reasonable warning time for genesis GENESIS_DELAY: 300 +# Genesis - Merge +GENESIS_GAS_LIMIT: 30000000 +GENESIS_BASE_FEE_PER_GAS: 0x00ca9a3b00000000000000000000000000000000000000000000000000000000 # Forking # --------------------------------------------------------------- diff --git a/teku/src/integration-test/resources/tech/pegasys/teku/cli/subcommand/test-spec.yaml b/teku/src/integration-test/resources/tech/pegasys/teku/cli/subcommand/test-spec.yaml index d647762197e..2263665a493 100644 --- a/teku/src/integration-test/resources/tech/pegasys/teku/cli/subcommand/test-spec.yaml +++ b/teku/src/integration-test/resources/tech/pegasys/teku/cli/subcommand/test-spec.yaml @@ -16,6 +16,9 @@ GENESIS_FORK_VERSION: 0x00001020 # Customized for Prater: 1919188 seconds (Mar-23-2021 02:00:00 PM +UTC) GENESIS_DELAY: 1919188 +# Genesis - Merge +GENESIS_GAS_LIMIT: 30000000 +GENESIS_BASE_FEE_PER_GAS: 0x00ca9a3b00000000000000000000000000000000000000000000000000000000 # Forking # --------------------------------------------------------------- diff --git a/util/src/main/java/tech/pegasys/teku/util/config/ConstantsReader.java b/util/src/main/java/tech/pegasys/teku/util/config/ConstantsReader.java index d45828e0a9c..12553ac80bb 100644 --- a/util/src/main/java/tech/pegasys/teku/util/config/ConstantsReader.java +++ b/util/src/main/java/tech/pegasys/teku/util/config/ConstantsReader.java @@ -56,6 +56,8 @@ class ConstantsReader { "TRANSITION_TOTAL_DIFFICULTY", "MIN_ANCHOR_POW_BLOCK_DIFFICULTY", "TERMINAL_TOTAL_DIFFICULTY", + "GENESIS_GAS_LIMIT", + "GENESIS_BASE_FEE_PER_GAS", // Phase0 constants which may exist in legacy config files, but should now be ignored "BLS_WITHDRAWAL_PREFIX", "TARGET_AGGREGATORS_PER_COMMITTEE", diff --git a/util/src/main/resources/tech/pegasys/teku/util/config/configs/mainnet.yaml b/util/src/main/resources/tech/pegasys/teku/util/config/configs/mainnet.yaml index 39e3bc1f541..6cfe7b0c747 100644 --- a/util/src/main/resources/tech/pegasys/teku/util/config/configs/mainnet.yaml +++ b/util/src/main/resources/tech/pegasys/teku/util/config/configs/mainnet.yaml @@ -17,6 +17,9 @@ GENESIS_FORK_VERSION: 0x00000000 # 604800 seconds (7 days) GENESIS_DELAY: 604800 +# Genesis - Merge +GENESIS_GAS_LIMIT: 30000000 +GENESIS_BASE_FEE_PER_GAS: 0x00ca9a3b00000000000000000000000000000000000000000000000000000000 # Forking # --------------------------------------------------------------- diff --git a/util/src/main/resources/tech/pegasys/teku/util/config/configs/minimal.yaml b/util/src/main/resources/tech/pegasys/teku/util/config/configs/minimal.yaml index 72e6cb7a5c5..7fdaf024263 100644 --- a/util/src/main/resources/tech/pegasys/teku/util/config/configs/minimal.yaml +++ b/util/src/main/resources/tech/pegasys/teku/util/config/configs/minimal.yaml @@ -14,6 +14,9 @@ GENESIS_FORK_VERSION: 0x00000001 # [customized] Faster to spin up testnets, but does not give validator reasonable warning time for genesis GENESIS_DELAY: 300 +# Genesis - Merge +GENESIS_GAS_LIMIT: 30000000 +GENESIS_BASE_FEE_PER_GAS: 0x00ca9a3b00000000000000000000000000000000000000000000000000000000 # Forking # --------------------------------------------------------------- diff --git a/util/src/main/resources/tech/pegasys/teku/util/config/configs/prater.yaml b/util/src/main/resources/tech/pegasys/teku/util/config/configs/prater.yaml index 324e515ee9b..661bf769891 100644 --- a/util/src/main/resources/tech/pegasys/teku/util/config/configs/prater.yaml +++ b/util/src/main/resources/tech/pegasys/teku/util/config/configs/prater.yaml @@ -16,6 +16,9 @@ GENESIS_FORK_VERSION: 0x00001020 # Customized for Prater: 1919188 seconds (Mar-23-2021 02:00:00 PM +UTC) GENESIS_DELAY: 1919188 +# Genesis - Merge +GENESIS_GAS_LIMIT: 30000000 +GENESIS_BASE_FEE_PER_GAS: 0x00ca9a3b00000000000000000000000000000000000000000000000000000000 # Forking # --------------------------------------------------------------- diff --git a/util/src/main/resources/tech/pegasys/teku/util/config/configs/pyrmont.yaml b/util/src/main/resources/tech/pegasys/teku/util/config/configs/pyrmont.yaml index 550e0374da0..a6b9e122624 100644 --- a/util/src/main/resources/tech/pegasys/teku/util/config/configs/pyrmont.yaml +++ b/util/src/main/resources/tech/pegasys/teku/util/config/configs/pyrmont.yaml @@ -17,6 +17,9 @@ GENESIS_FORK_VERSION: 0x00002009 # Customized for Pyrmont: 432000 seconds (5 days) GENESIS_DELAY: 432000 +# Genesis - Merge +GENESIS_GAS_LIMIT: 30000000 +GENESIS_BASE_FEE_PER_GAS: 0x00ca9a3b00000000000000000000000000000000000000000000000000000000 # Forking # --------------------------------------------------------------- diff --git a/util/src/test/resources/tech/pegasys/teku/util/config/invalid/invalidPresetType.yaml b/util/src/test/resources/tech/pegasys/teku/util/config/invalid/invalidPresetType.yaml index 8a498dc804b..6184db16673 100644 --- a/util/src/test/resources/tech/pegasys/teku/util/config/invalid/invalidPresetType.yaml +++ b/util/src/test/resources/tech/pegasys/teku/util/config/invalid/invalidPresetType.yaml @@ -14,6 +14,9 @@ GENESIS_FORK_VERSION: 0x00000001 # [customized] Faster to spin up testnets, but does not give validator reasonable warning time for genesis GENESIS_DELAY: 300 +# Genesis - Merge +GENESIS_GAS_LIMIT: 30000000 +GENESIS_BASE_FEE_PER_GAS: 0x00ca9a3b00000000000000000000000000000000000000000000000000000000 # Forking # --------------------------------------------------------------- diff --git a/util/src/test/resources/tech/pegasys/teku/util/config/invalid/unknownPreset.yaml b/util/src/test/resources/tech/pegasys/teku/util/config/invalid/unknownPreset.yaml index f5f4642037a..3953222e2d7 100644 --- a/util/src/test/resources/tech/pegasys/teku/util/config/invalid/unknownPreset.yaml +++ b/util/src/test/resources/tech/pegasys/teku/util/config/invalid/unknownPreset.yaml @@ -14,6 +14,9 @@ GENESIS_FORK_VERSION: 0x00000001 # [customized] Faster to spin up testnets, but does not give validator reasonable warning time for genesis GENESIS_DELAY: 300 +# Genesis - Merge +GENESIS_GAS_LIMIT: 30000000 +GENESIS_BASE_FEE_PER_GAS: 0x00ca9a3b00000000000000000000000000000000000000000000000000000000 # Forking # --------------------------------------------------------------- From 0d543fab93c493e6fe6686d1289645c477fb748c Mon Sep 17 00:00:00 2001 From: tbenr Date: Tue, 28 Sep 2021 11:19:52 +0200 Subject: [PATCH 02/14] fix SpecConfigMerge initialization --- .../java/tech/pegasys/teku/spec/config/SpecConfigMerge.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java index e29e961acce..00baa39bb38 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java @@ -45,6 +45,8 @@ public SpecConfigMerge( this.mergeForkVersion = mergeForkVersion; this.mergeForkEpoch = mergeForkEpoch; this.terminalTotalDifficulty = terminalTotalDifficulty; + this.genesisBaseFeePerGas = genesisBaseFeePerGas; + this.genesisGasLimit = genesisGasLimit; } public static SpecConfigMerge required(final SpecConfig specConfig) { From 1bdb333bbec39a05e991d0a6299c76750d5420d3 Mon Sep 17 00:00:00 2001 From: tbenr Date: Tue, 28 Sep 2021 11:24:24 +0200 Subject: [PATCH 03/14] spotless --- .../java/tech/pegasys/teku/spec/config/SpecConfigMerge.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java index 00baa39bb38..6c27ca88052 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java @@ -114,7 +114,8 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(genesisGasLimit, + return Objects.hash( + genesisGasLimit, genesisBaseFeePerGas, mergeForkVersion, mergeForkEpoch, From 11b90dd0db517101757e974fbc11cc02b7d9008a Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 28 Sep 2021 10:21:10 +0300 Subject: [PATCH 04/14] Update ref tests version to v1.1.0-beta.5 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b61825e9e17..6685202d4d9 100644 --- a/build.gradle +++ b/build.gradle @@ -225,7 +225,7 @@ allprojects { } } -def refTestVersion = 'v1.1.0-beta.4' +def refTestVersion = 'v1.1.0-beta.5' def blsRefTestVersion = 'v0.1.0' def refTestBaseUrl = 'https://github.com/ethereum/eth2.0-spec-tests/releases/download' def blsRefTestBaseUrl = 'https://github.com/ethereum/bls12-381-tests/releases/download' From eebb6f38bfe9aa974a48a2bd18229ce066e17818 Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 28 Sep 2021 10:54:04 +0300 Subject: [PATCH 05/14] Fix `ExecutionPayload[Header].extra_data` field creation with the right schema --- .../spec/datastructures/execution/ExecutionPayload.java | 6 +++++- .../datastructures/execution/ExecutionPayloadHeader.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayload.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayload.java index 209333936ed..52659093fc7 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayload.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayload.java @@ -94,6 +94,10 @@ public ExecutionPayloadSchema() { return (SszListSchema) getFieldSchema13(); } + public SszByteListSchema getExtraDataSchema() { + return (SszByteListSchema) getFieldSchema10(); + } + @Override public ExecutionPayload createFromBackingNode(TreeNode node) { return new ExecutionPayload(this, node); @@ -155,7 +159,7 @@ public ExecutionPayload( SszUInt64.of(gas_limit), SszUInt64.of(gas_used), SszUInt64.of(timestamp), - SszByteList.fromBytes(extra_data), + SSZ_SCHEMA.getExtraDataSchema().fromBytes(extra_data), SszBytes32.of(baseFeePerGas), SszBytes32.of(block_hash), transactions.stream() diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadHeader.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadHeader.java index e00fa4fa1ce..0d79b4f005e 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadHeader.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadHeader.java @@ -86,6 +86,10 @@ public ExecutionPayloadHeaderSchema() { namedSchema("transactions_root", SszPrimitiveSchemas.BYTES32_SCHEMA)); } + public SszByteListSchema getExtraDataSchema() { + return (SszByteListSchema) getFieldSchema10(); + } + @Override public ExecutionPayloadHeader createFromBackingNode(TreeNode node) { return new ExecutionPayloadHeader(this, node); @@ -143,7 +147,7 @@ public ExecutionPayloadHeader( SszUInt64.of(gas_limit), SszUInt64.of(gas_used), SszUInt64.of(timestamp), - SszByteList.fromBytes(extra_data), + SSZ_SCHEMA.getExtraDataSchema().fromBytes(extra_data), SszBytes32.of(baseFeePerGas), SszBytes32.of(block_hash), SszBytes32.of(transactions_root)); From 7b31d067a01e1b6ea2550bb7acf6f2af560b4c73 Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 28 Sep 2021 13:20:19 +0300 Subject: [PATCH 06/14] Fix block processing operations order according to the spec --- .../logic/versions/merge/block/BlockProcessorMerge.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/block/BlockProcessorMerge.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/block/BlockProcessorMerge.java index e2538a33994..e489fd8a50c 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/block/BlockProcessorMerge.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/block/BlockProcessorMerge.java @@ -128,11 +128,16 @@ public void processBlock( final MutableBeaconStateMerge state = MutableBeaconStateMerge.required(genericState); final BeaconBlockBodyMerge blockBody = BeaconBlockBodyMerge.required(block.getBody()); - super.processBlock( - executionEngineChannel, state, block, indexedAttestationCache, signatureVerifier); + processBlockHeader(state, block); + if (miscHelpersMerge.isExecutionEnabled(genericState, block)) { processExecutionPayload(executionEngineChannel, state, blockBody.getExecution_payload()); } + + processRandaoNoValidation(state, block.getBody()); + processEth1Data(state, block.getBody()); + processOperationsNoValidation(state, block.getBody(), indexedAttestationCache); + processSyncAggregate(state, blockBody.getSyncAggregate(), signatureVerifier); } @Override From 2e861771388f4e2722e7e52f12ac0cafbc39d1e7 Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 28 Sep 2021 16:37:37 +0300 Subject: [PATCH 07/14] Pass the target slot to the `BlockFactory.prepareExecutionPayload` to correctly cache by slot and calculate payload timestamp --- .../teku/validator/coordinator/BlockFactory.java | 10 +++++----- .../validator/coordinator/ValidatorApiHandler.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/validator/coordinator/src/main/java/tech/pegasys/teku/validator/coordinator/BlockFactory.java b/validator/coordinator/src/main/java/tech/pegasys/teku/validator/coordinator/BlockFactory.java index ae09c8a261e..7ddfeed9653 100644 --- a/validator/coordinator/src/main/java/tech/pegasys/teku/validator/coordinator/BlockFactory.java +++ b/validator/coordinator/src/main/java/tech/pegasys/teku/validator/coordinator/BlockFactory.java @@ -101,16 +101,16 @@ public BlockFactory( 10); // TODO check if makes sense to remember payloadId for the latest 10 slots } - public void prepareExecutionPayload(final Optional maybeCurrentSlotState) { + public void prepareExecutionPayload(final Optional maybeCurrentSlotState, UInt64 targetSlot) { maybeCurrentSlotState.ifPresent( currentSlotState -> { - Optional maybeRef = prepareExecutionPayloadRef(currentSlotState); - slotToPayloadIdMap.invalidateWithNewValue(currentSlotState.getSlot(), maybeRef); + Optional maybeRef = prepareExecutionPayloadRef(currentSlotState, targetSlot); + slotToPayloadIdMap.invalidateWithNewValue(targetSlot, maybeRef); }); } private Optional prepareExecutionPayloadRef( - final BeaconState currentSlotState) { + final BeaconState currentSlotState, UInt64 targetSlot) { final Optional maybeCurrentMergeState = currentSlotState.toVersionMerge(); if (maybeCurrentMergeState.isEmpty()) { @@ -121,7 +121,7 @@ private Optional prepareExecutionPayloadRef( final UInt64 slot = currentMergeState.getSlot(); final UInt64 epoch = spec.computeEpochAtSlot(slot); - final UInt64 timestamp = spec.computeTimeAtSlot(currentMergeState, slot); + final UInt64 timestamp = spec.computeTimeAtSlot(currentMergeState, targetSlot); final Bytes32 random = spec.atEpoch(epoch).beaconStateAccessors().getRandaoMix(currentMergeState, epoch); diff --git a/validator/coordinator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java b/validator/coordinator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java index e20428e3360..cc3a0e449ea 100644 --- a/validator/coordinator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java +++ b/validator/coordinator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java @@ -268,7 +268,7 @@ public SafeFuture prepareExecutionPayload(UInt64 preparingSlot) { return currentSlotStateFuture.thenApply( preState -> { - blockFactory.prepareExecutionPayload(preState); + blockFactory.prepareExecutionPayload(preState, preparingSlot); return null; }); } From c59fe1d8b1b77ccfbaeb9c92c1ed890e35a6ee8d Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 28 Sep 2021 16:38:42 +0300 Subject: [PATCH 08/14] Support --Xnetwork-altair/merge-fork-epoch CLI options in the `genesis mock` command --- .../options/MinimalEth2NetworkOptions.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/teku/src/main/java/tech/pegasys/teku/cli/options/MinimalEth2NetworkOptions.java b/teku/src/main/java/tech/pegasys/teku/cli/options/MinimalEth2NetworkOptions.java index ba50bd39058..c099d6fe088 100644 --- a/teku/src/main/java/tech/pegasys/teku/cli/options/MinimalEth2NetworkOptions.java +++ b/teku/src/main/java/tech/pegasys/teku/cli/options/MinimalEth2NetworkOptions.java @@ -15,6 +15,7 @@ import picocli.CommandLine.Option; import tech.pegasys.teku.config.TekuConfiguration; +import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.networks.Eth2NetworkConfiguration; import tech.pegasys.teku.spec.Spec; @@ -27,6 +28,20 @@ public class MinimalEth2NetworkOptions { arity = "1") private String network = "mainnet"; + @Option( + names = {"--Xnetwork-altair-fork-epoch"}, + paramLabel = "", + description = "Altair fork first epoch", + arity = "1") + private long altairForkEpoch = -1; + + @Option( + names = {"--Xnetwork-merge-fork-epoch"}, + paramLabel = "", + description = "Merge fork first epoch", + arity = "1") + private long mergeForkEpoch = -1; + public void configure(final TekuConfiguration.Builder builder) { builder.eth2NetworkConfig(b -> b.applyNetworkDefaults(network)); } @@ -36,6 +51,9 @@ public Spec getSpec() { } private Eth2NetworkConfiguration getConfig() { - return Eth2NetworkConfiguration.builder(network).build(); + return Eth2NetworkConfiguration.builder(network) + .mergeForkEpoch(UInt64.fromLongBits(mergeForkEpoch)) + .altairForkEpoch(UInt64.fromLongBits(altairForkEpoch)) + .build(); } } From 016df2d481bba31dec2fa95e04529162cd1a3cfa Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 28 Sep 2021 16:38:59 +0300 Subject: [PATCH 09/14] Fix log string --- .../services/powchain/execution/ExecutionEngineChannelImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/powchain/src/main/java/tech/pegasys/teku/services/powchain/execution/ExecutionEngineChannelImpl.java b/services/powchain/src/main/java/tech/pegasys/teku/services/powchain/execution/ExecutionEngineChannelImpl.java index 1677b4f18a5..71cb98a4637 100644 --- a/services/powchain/src/main/java/tech/pegasys/teku/services/powchain/execution/ExecutionEngineChannelImpl.java +++ b/services/powchain/src/main/java/tech/pegasys/teku/services/powchain/execution/ExecutionEngineChannelImpl.java @@ -110,7 +110,7 @@ public SafeFuture executePayload( .thenPeek( res -> printConsole( - "Failed consensus_newBlock(execution_payload=%s), reason: %s", + "engine_executePayload(execution_payload=%s), result: %s", executionPayload, res)); } From e251e422ae75d34a4f9f981bc402b581cef46180 Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 28 Sep 2021 16:39:21 +0300 Subject: [PATCH 10/14] Fix ExecutePayloadResponse construction --- .../execution/client/schema/ExecutePayloadResponse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/powchain/src/main/java/tech/pegasys/teku/services/powchain/execution/client/schema/ExecutePayloadResponse.java b/services/powchain/src/main/java/tech/pegasys/teku/services/powchain/execution/client/schema/ExecutePayloadResponse.java index 690afbaefee..b8e8e4b4125 100644 --- a/services/powchain/src/main/java/tech/pegasys/teku/services/powchain/execution/client/schema/ExecutePayloadResponse.java +++ b/services/powchain/src/main/java/tech/pegasys/teku/services/powchain/execution/client/schema/ExecutePayloadResponse.java @@ -23,7 +23,7 @@ public class ExecutePayloadResponse { public ExecutePayloadResponse(@JsonProperty("status") String status) { try { - ExecutionPayloadStatus.valueOf(status); + this.status = ExecutionPayloadStatus.valueOf(status); } catch (IllegalArgumentException e) { throw new RuntimeException("Invalid status field received: " + status); } From 4dbc5ea405ff1f1e02b4db2c3c2bdd00b09d93a3 Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 28 Sep 2021 16:40:13 +0300 Subject: [PATCH 11/14] Delegate `SpecLogicMerge.getSyncCommitteeUtil()` to the `SpecLogicAltair` instance --- .../spec/logic/versions/merge/SpecLogicMerge.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/SpecLogicMerge.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/SpecLogicMerge.java index c82a9c66a61..350cf869b90 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/SpecLogicMerge.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/SpecLogicMerge.java @@ -27,6 +27,7 @@ import tech.pegasys.teku.spec.logic.common.util.ForkChoiceUtil; import tech.pegasys.teku.spec.logic.common.util.SyncCommitteeUtil; import tech.pegasys.teku.spec.logic.common.util.ValidatorsUtil; +import tech.pegasys.teku.spec.logic.versions.altair.SpecLogicAltair; import tech.pegasys.teku.spec.logic.versions.altair.helpers.BeaconStateMutatorsAltair; import tech.pegasys.teku.spec.logic.versions.altair.statetransition.epoch.EpochProcessorAltair; import tech.pegasys.teku.spec.logic.versions.altair.statetransition.epoch.ValidatorStatusFactoryAltair; @@ -41,6 +42,8 @@ public class SpecLogicMerge extends AbstractSpecLogic { private final ExecutionPayloadUtil executionPayloadUtil; private final MergeTransitionHelpers mergeTransitionHelpers; + private final SpecLogicAltair specLogicAltair; + private SpecLogicMerge( final Predicates predicates, final MiscHelpersMerge miscHelpers, @@ -58,7 +61,8 @@ private SpecLogicMerge( final BlockProposalUtil blockProposalUtil, final ExecutionPayloadUtil executionPayloadUtil, final MergeTransitionHelpers mergeTransitionHelpers, - final MergeStateUpgrade stateUpgrade) { + final MergeStateUpgrade stateUpgrade, + final SpecLogicAltair specLogicAltair) { super( predicates, miscHelpers, @@ -77,6 +81,7 @@ private SpecLogicMerge( Optional.of(stateUpgrade)); this.executionPayloadUtil = executionPayloadUtil; this.mergeTransitionHelpers = mergeTransitionHelpers; + this.specLogicAltair = specLogicAltair; } public static SpecLogicMerge create( @@ -151,6 +156,8 @@ public static SpecLogicMerge create( final MergeStateUpgrade stateUpgrade = new MergeStateUpgrade(config, schemaDefinitions, beaconStateAccessors); + final SpecLogicAltair specLogicAltair = SpecLogicAltair.create(config, schemaDefinitions); + return new SpecLogicMerge( predicates, miscHelpers, @@ -168,12 +175,13 @@ public static SpecLogicMerge create( blockProposalUtil, executionPayloadUtil, mergeTransitionHelpers, - stateUpgrade); + stateUpgrade, + specLogicAltair); } @Override public Optional getSyncCommitteeUtil() { - return Optional.empty(); + return specLogicAltair.getSyncCommitteeUtil(); } @Override From efb1363140af5785c4affd8cf2b7ceb87c3d3053 Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 28 Sep 2021 16:41:58 +0300 Subject: [PATCH 12/14] Even if the Merge milestone is set to the slot 0 the Spec instance should still contain all the previous milestones --- .../spec/src/main/java/tech/pegasys/teku/spec/SpecFactory.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/SpecFactory.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/SpecFactory.java index 7b76424b055..ca7cbefcc6d 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/SpecFactory.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/SpecFactory.java @@ -65,9 +65,6 @@ public static Spec create(final SpecConfig config) { .filter(epoch -> !epoch.equals(FAR_FUTURE_EPOCH)); // Merge takes precedence in the prototype if (mergeForkEpoch.isPresent()) { - if (mergeForkEpoch.get().equals(UInt64.ZERO)) { - return Spec.createSinceGenesis(config, SpecMilestone.MERGE); - } return Spec.create(config, SpecMilestone.MERGE); } From a3e8f6fd25b56bc600b60d038c41570aee2b7315 Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 28 Sep 2021 16:44:32 +0300 Subject: [PATCH 13/14] Adjust the ExecutionEngineClient.Stub for created `ExecutionPayload` to pass all the validations --- .../powchain/execution/client/ExecutionEngineClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/powchain/src/main/java/tech/pegasys/teku/services/powchain/execution/client/ExecutionEngineClient.java b/services/powchain/src/main/java/tech/pegasys/teku/services/powchain/execution/client/ExecutionEngineClient.java index a898bde2b7a..0428f3a48e9 100644 --- a/services/powchain/src/main/java/tech/pegasys/teku/services/powchain/execution/client/ExecutionEngineClient.java +++ b/services/powchain/src/main/java/tech/pegasys/teku/services/powchain/execution/client/ExecutionEngineClient.java @@ -78,9 +78,9 @@ public SafeFuture> getPayload(UInt64 payloadId) { Bytes32.ZERO, Bytes32.ZERO, ZERO_LOGS_BLOOM, - Bytes32.ZERO, + preparePayloadRequest.random, number, - UInt64.ZERO, + UInt64.valueOf(30_000_000), UInt64.ZERO, preparePayloadRequest.timestamp, ZERO_EXTRA_DATA, From 3364ac2b849b33747d54d2fd38aa5a9ba9d5eb93 Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 28 Sep 2021 17:01:01 +0300 Subject: [PATCH 14/14] Spotless --- .../pegasys/teku/validator/coordinator/BlockFactory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/validator/coordinator/src/main/java/tech/pegasys/teku/validator/coordinator/BlockFactory.java b/validator/coordinator/src/main/java/tech/pegasys/teku/validator/coordinator/BlockFactory.java index 7ddfeed9653..390e8f35708 100644 --- a/validator/coordinator/src/main/java/tech/pegasys/teku/validator/coordinator/BlockFactory.java +++ b/validator/coordinator/src/main/java/tech/pegasys/teku/validator/coordinator/BlockFactory.java @@ -101,10 +101,12 @@ public BlockFactory( 10); // TODO check if makes sense to remember payloadId for the latest 10 slots } - public void prepareExecutionPayload(final Optional maybeCurrentSlotState, UInt64 targetSlot) { + public void prepareExecutionPayload( + final Optional maybeCurrentSlotState, UInt64 targetSlot) { maybeCurrentSlotState.ifPresent( currentSlotState -> { - Optional maybeRef = prepareExecutionPayloadRef(currentSlotState, targetSlot); + Optional maybeRef = + prepareExecutionPayloadRef(currentSlotState, targetSlot); slotToPayloadIdMap.invalidateWithNewValue(targetSlot, maybeRef); }); }