Skip to content

Commit d048798

Browse files
jframesiladugfukushimawcgcyxmacfarla
authored
Release 23.1.1 rc1 (#5106)
* Prepare for version 23.1.1-SNAPSHOT (#5067) Signed-off-by: Simon Dudley <[email protected]> * Add getPayloadBodiesByRangeV1 and getPayloadBodiesByHash engine methods (#4980) * Add engine get payload body methods and test Signed-off-by: Zhenyang Shi <[email protected]> Signed-off-by: Gabriel Fukushima <[email protected]> * Add header Signed-off-by: Zhenyang Shi <[email protected]> * Update result struct & add test Signed-off-by: Zhenyang Shi <[email protected]> * Change constant to use upper case Signed-off-by: Gabriel Fukushima <[email protected]> * Add PayloadBody class and withdrawals to response of methods Signed-off-by: Gabriel Fukushima <[email protected]> * Add unit tests Signed-off-by: Gabriel Fukushima <[email protected]> * Add changelog Signed-off-by: Gabriel Fukushima <[email protected]> * spotless Signed-off-by: Gabriel Fukushima <[email protected]> * Add check to prevent returning trailing null results past the head Signed-off-by: Gabriel Fukushima <[email protected]> * Add test to check trailing null post head scenario Signed-off-by: Gabriel Fukushima <[email protected]> * Split tests into pre and post shanghai Signed-off-by: Gabriel Fukushima <[email protected]> * spotless Signed-off-by: Gabriel Fukushima <[email protected]> * Rename methods Signed-off-by: Gabriel Fukushima <[email protected]> * Use getName() to log method name Signed-off-by: Gabriel Fukushima <[email protected]> * spotless Signed-off-by: Gabriel Fukushima <[email protected]> * Rename variable Signed-off-by: Gabriel Fukushima <[email protected]> * Call constructor directly Signed-off-by: Gabriel Fukushima <[email protected]> * Fix ByHash json parsing Signed-off-by: Simon Dudley <[email protected]> * Fix json parsing again Signed-off-by: Simon Dudley <[email protected]> * Add check to prevent unnecessary queries Signed-off-by: Gabriel Fukushima <[email protected]> * Refactor method Signed-off-by: Gabriel Fukushima <[email protected]> * Add new error code for EngineGetPayloadBodies methods Signed-off-by: Gabriel Fukushima <[email protected]> * Add return error for request above the API limit Signed-off-by: Gabriel Fukushima <[email protected]> * Add constructor for empty response Signed-off-by: Gabriel Fukushima <[email protected]> * add check for number of blocks requested and for requests of post head Signed-off-by: Gabriel Fukushima <[email protected]> * Add test to check error code when request exceeds API limits Signed-off-by: Gabriel Fukushima <[email protected]> * add constant for max blocks allowed per request Signed-off-by: Gabriel Fukushima <[email protected]> * spotless Signed-off-by: Gabriel Fukushima <[email protected]> * Fix some nits Signed-off-by: Gabriel Fukushima <[email protected]> * Add invalid params check Signed-off-by: Gabriel Fukushima <[email protected]> * Add tests for invalid params check Signed-off-by: Gabriel Fukushima <[email protected]> * Fix test and spotless Signed-off-by: Gabriel Fukushima <[email protected]> * Revert "Fix json parsing again" This reverts commit 558d325. Signed-off-by: Gabriel Fukushima <[email protected]> * Revert "Fix ByHash json parsing Signed-off-by: Simon Dudley <[email protected]>" This reverts commit 663e11e Signed-off-by: Gabriel Fukushima <[email protected]> * Use UnsignedLongParameter to cast params of the request Signed-off-by: Gabriel Fukushima <[email protected]> * Add optional withdrawals to the NewPayload log (#5021) Signed-off-by: Simon Dudley <[email protected]> * kubernetes and errorprone - update versions (#5013) * update errorprone and kubernetes versions * fixed errorprone issues in prod cod * fixed errorprone issues in test code --------- Signed-off-by: Sally MacFarlane <[email protected]> * Rename JsonRpcService to EngineJsonRpcService (#5036) * rename JsonRpcService to EngineJsonRpcService Signed-off-by: Daniel Lehrner <[email protected]> * Params should be single item of array type, not outer array of strings (#5037) Signed-off-by: Simon Dudley <[email protected]> * Add EIP-2537 (BLS12-381 curve precompiles) to Cancun (#5017) Add the BLS curve precompiles into the registry for cancun. All of the curve precompiles have been here since berlin, so this is just wiring them in. Signed-off-by: Danno Ferrin <[email protected]> Co-authored-by: Sally MacFarlane <[email protected]> * Use UnsignedLongParameter to cast params of the request Signed-off-by: Gabriel Fukushima <[email protected]> * Add optional withdrawals to the NewPayload log (#5021) Signed-off-by: Simon Dudley <[email protected]> * kubernetes and errorprone - update versions (#5013) * update errorprone and kubernetes versions * fixed errorprone issues in prod cod * fixed errorprone issues in test code --------- Signed-off-by: Sally MacFarlane <[email protected]> * Rename JsonRpcService to EngineJsonRpcService (#5036) * rename JsonRpcService to EngineJsonRpcService Signed-off-by: Daniel Lehrner <[email protected]> * Params should be single item of array type, not outer array of strings (#5037) Signed-off-by: Simon Dudley <[email protected]> * Add EIP-2537 (BLS12-381 curve precompiles) to Cancun (#5017) Add the BLS curve precompiles into the registry for cancun. All of the curve precompiles have been here since berlin, so this is just wiring them in. Signed-off-by: Danno Ferrin <[email protected]> Co-authored-by: Sally MacFarlane <[email protected]> * Convert start and count from hex to match JSON-RPC Spec standard Signed-off-by: Gabriel Fukushima <[email protected]> --------- Signed-off-by: Zhenyang Shi <[email protected]> Signed-off-by: Gabriel Fukushima <[email protected]> Signed-off-by: Simon Dudley <[email protected]> Signed-off-by: Sally MacFarlane <[email protected]> Signed-off-by: Daniel Lehrner <[email protected]> Signed-off-by: Danno Ferrin <[email protected]> Co-authored-by: Zhenyang Shi <[email protected]> Co-authored-by: Simon Dudley <[email protected]> Co-authored-by: Sally MacFarlane <[email protected]> Co-authored-by: Daniel Lehrner <[email protected]> Co-authored-by: Danno Ferrin <[email protected]> * Revert "Keep Worldstate Storage open for Bonsai archive latest layer (#5039)" (#5073) This reverts commit e715010. Signed-off-by: Simon Dudley <[email protected]> * Support post merge forks at genesis for hive tests (#5019) Signed-off-by: Jason Frame <[email protected]> * Fix manifest docker not skipping interim builds for RCs (#5068) Signed-off-by: Jason Frame <[email protected]> * Fix PoS checkpoint validation (#5081) * change validation to lessThan Signed-off-by: Gabriel Fukushima <[email protected]> * Change exception message to PoS instead of Near head Signed-off-by: Gabriel Fukushima <[email protected]> * Add unit test and fix message of existing unit test Signed-off-by: Gabriel Fukushima <[email protected]> --------- Signed-off-by: Gabriel Fukushima <[email protected]> * moves check for init code length before balance check (#5077) Signed-off-by: Justin Florentine <[email protected]> * bump revision for 23.1.x release branch Signed-off-by: garyschulte <[email protected]> * Burn in build of 23.1.0 (#5093) * rebase off of burn-in release, remove unreleased 23.1.0-RC2 from CHANGELOG Signed-off-by: garyschulte <[email protected]> Signed-off-by: Simon Dudley <[email protected]> Signed-off-by: Ameziane H <[email protected]> Signed-off-by: Karim TAAM <[email protected]> * re-default global max rpc batch size to 1k (#5104) (#5105) * default global max rpc batch size to 1000 for now Signed-off-by: garyschulte <[email protected]> * Fix Layered World State issue (#5076) * Use the copy during prepareTrieLog instead of saveTrieLog * add final flag on BonsaiWorldStateUpdater * Use a copy of BonsaiInMemoryWorldState inside prepareTrieLog * add link to persisted worldstate storage * fix tests * Make a copy of the worldstate after committing changes to the trielog * spotless + remove maybeUnSubscribe in setNextWorldView * subscribe storage on layered worldstate * fix null issue * not close layered worldstate during getAccount * clean code * Add changelog entry --------- Signed-off-by: ahamlat <[email protected]> Signed-off-by: Karim TAAM <[email protected]> Co-authored-by: Karim TAAM <[email protected]> * Add shanghaiTime to sepolia (#5088) Update and fix forkId tests Move timestamp forks from getForkBlockNumbers to getForkBlockTimestamps in JsonGenesisConfigOptions - this ultimately gets used to popoulate the ForkIdManager which handles lists of blocks and timestamps the same way so this hasn't changed any actual behaviour, but rather supports the test fixes. Implement TransitionProtocolSchedule.streamMilestoneBlocks as a concatenation of blockNumbers++blockTimestamps. This may have been a latent bug since it's used to update the node record when a fork transition occurs. Signed-off-by: Simon Dudley <[email protected]> * If a PoS block creation repetition takes less than a configurable dur… (#5048) * If a PoS block creation repetition takes less than a configurable duration, then waits before next repetition Signed-off-by: Fabio Di Fabio <[email protected]> * Update CHANGELOG Signed-off-by: Fabio Di Fabio <[email protected]> * Add unit test Signed-off-by: Fabio Di Fabio <[email protected]> * Update besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java Co-authored-by: Sally MacFarlane <[email protected]> Signed-off-by: Fabio Di Fabio <[email protected]> * Update besu/src/main/java/org/hyperledger/besu/cli/options/unstable/MiningOptions.java Co-authored-by: Sally MacFarlane <[email protected]> Signed-off-by: Fabio Di Fabio <[email protected]> --------- Signed-off-by: Fabio Di Fabio <[email protected]> Co-authored-by: Sally MacFarlane <[email protected]> * Allow dashes in ethstats password (#5090) Signed-off-by: Simon Dudley <[email protected]> * reintroduce checking of block height for certain tasks when we are not PoS (Revert PR#3911) (#5083) * reintroduce checking of block height for certain tasks when we are not PoS (Revert PR#3911) Signed-off-by: Stefan Pingel <[email protected]> * Allow other users to read the /opt/besu dir when using docker (#5092) Signed-off-by: Rafael Matias <[email protected]> Co-authored-by: Sally MacFarlane <[email protected]> * Only use MAINNET version of KZG (#5095) Signed-off-by: Fabio Di Fabio <[email protected]> * add more context to exception messages and debug logging (#5066) Signed-off-by: Sally MacFarlane <[email protected]> * Fix block value calculation (#5100) * Add gasUsed calculation Signed-off-by: Gabriel Fukushima <[email protected]> * Fix unit test Signed-off-by: Gabriel Fukushima <[email protected]> * Fix typo Signed-off-by: Gabriel Fukushima <[email protected]> --------- Signed-off-by: Gabriel Fukushima <[email protected]> * Add 23.1.1-RC1 changelog Signed-off-by: Jason Frame <[email protected]> * Change version to 23.1.1-RC1 Signed-off-by: Jason Frame <[email protected]> --------- Signed-off-by: Simon Dudley <[email protected]> Signed-off-by: Zhenyang Shi <[email protected]> Signed-off-by: Gabriel Fukushima <[email protected]> Signed-off-by: Sally MacFarlane <[email protected]> Signed-off-by: Daniel Lehrner <[email protected]> Signed-off-by: Danno Ferrin <[email protected]> Signed-off-by: Jason Frame <[email protected]> Signed-off-by: Justin Florentine <[email protected]> Signed-off-by: garyschulte <[email protected]> Signed-off-by: Ameziane H <[email protected]> Signed-off-by: Karim TAAM <[email protected]> Signed-off-by: ahamlat <[email protected]> Signed-off-by: Fabio Di Fabio <[email protected]> Signed-off-by: Stefan Pingel <[email protected]> Signed-off-by: Rafael Matias <[email protected]> Co-authored-by: Simon Dudley <[email protected]> Co-authored-by: Gabriel Fukushima <[email protected]> Co-authored-by: Zhenyang Shi <[email protected]> Co-authored-by: Sally MacFarlane <[email protected]> Co-authored-by: Daniel Lehrner <[email protected]> Co-authored-by: Danno Ferrin <[email protected]> Co-authored-by: Justin Florentine <[email protected]> Co-authored-by: garyschulte <[email protected]> Co-authored-by: ahamlat <[email protected]> Co-authored-by: Karim TAAM <[email protected]> Co-authored-by: Fabio Di Fabio <[email protected]> Co-authored-by: Stefan Pingel <[email protected]> Co-authored-by: Rafael Matias <[email protected]>
1 parent 79c1a97 commit d048798

File tree

101 files changed

+5983
-5914
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+5983
-5914
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 23.1.1-RC1
4+
Besu 23.1.1-RC is a required update only for users who want to test Shanghai on Sepolia.
5+
6+
### Additions and Improvements
7+
- Add implementation for engine_exchangeCapabilities [#4997](https://github.com/hyperledger/besu/pull/4997)
8+
- Add implementation for engine_getPayloadBodiesByRangeV1 and engine_getPayloadBodiesByHashV1 [#4980](https://github.com/hyperledger/besu/pull/4980)
9+
- If a PoS block creation repetition takes less than a configurable duration, then waits before next repetition [#5048](https://github.com/hyperledger/besu/pull/5048)
10+
- Fix engine_getPayloadV2 block value calculation [#5040](https://github.com/hyperledger/besu/issues/5040)
11+
- Add support for Shanghai in Sepolia [#5088](https://github.com/hyperledger/besu/pull/5088)
12+
313
## 23.1.0
414
Besu 23.1.0 is a recommended update for Mainnet users. Thank you all for your patience as we crafted this quarterly release.
515

acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/jsonrpc/EthSendRawTransactionTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ public void shouldFailToSendToToStrictNodeWithoutChainId() {
6565
strictNode.verify(eth.expectEthSendRawTransactionException(rawTx, "ChainId is required"));
6666
}
6767

68+
@Test
69+
public void shouldFailToSendWithInvalidRlp() {
70+
final String invalidRawTx = "0x5555";
71+
strictNode.verify(eth.expectEthSendRawTransactionException(invalidRawTx, "Invalid params"));
72+
}
73+
6874
@Test
6975
public void shouldSendSuccessfullyWithChainId_lenientNode() {
7076
final TransferTransaction tx = createTransactionWithChainId();

besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,6 +1891,13 @@ private void validateMiningParams() {
18911891
throw new ParameterException(
18921892
this.commandLine, "--Xpos-block-creation-max-time must be positive and ≤ 12000");
18931893
}
1894+
1895+
if (unstableMiningOptions.getPosBlockCreationRepetitionMinDuration() <= 0
1896+
|| unstableMiningOptions.getPosBlockCreationRepetitionMinDuration() > 2000) {
1897+
throw new ParameterException(
1898+
this.commandLine,
1899+
"--Xpos-block-creation-repetition-min-duration must be positive and ≤ 2000");
1900+
}
18941901
}
18951902

18961903
/**
@@ -2271,6 +2278,8 @@ public BesuControllerBuilder getControllerBuilder() {
22712278
.powJobTimeToLive(unstableMiningOptions.getPowJobTimeToLive())
22722279
.maxOmmerDepth(unstableMiningOptions.getMaxOmmersDepth())
22732280
.posBlockCreationMaxTime(unstableMiningOptions.getPosBlockCreationMaxTime())
2281+
.posBlockCreationRepetitionMinDuration(
2282+
unstableMiningOptions.getPosBlockCreationRepetitionMinDuration())
22742283
.build())
22752284
.transactionPoolConfiguration(buildTransactionPoolConfiguration())
22762285
.nodeKey(new NodeKey(securityModule()))
@@ -3510,7 +3519,7 @@ private void validatePostMergeCheckpointBlockRequirements() {
35103519
if (synchronizerConfiguration.isCheckpointPostMergeEnabled()) {
35113520
if (!checkpointConfigOptions.isValid()) {
35123521
throw new InvalidConfigurationException(
3513-
"Near head checkpoint sync requires a checkpoint block configured in the genesis file");
3522+
"PoS checkpoint sync requires a checkpoint block configured in the genesis file");
35143523
}
35153524
terminalTotalDifficulty.ifPresentOrElse(
35163525
ttd -> {
@@ -3519,18 +3528,18 @@ private void validatePostMergeCheckpointBlockRequirements() {
35193528
.equals(UInt256.ZERO)
35203529
&& ttd.equals(UInt256.ZERO)) {
35213530
throw new InvalidConfigurationException(
3522-
"Post Merge checkpoint sync can't be used with TTD = 0 and checkpoint totalDifficulty = 0");
3531+
"PoS checkpoint sync can't be used with TTD = 0 and checkpoint totalDifficulty = 0");
35233532
}
35243533
if (UInt256.fromHexString(
35253534
genesisOptions.getCheckpointOptions().getTotalDifficulty().get())
3526-
.lessOrEqualThan(ttd)) {
3535+
.lessThan(ttd)) {
35273536
throw new InvalidConfigurationException(
3528-
"Near head checkpoint sync requires a block with total difficulty greater than the TTD");
3537+
"PoS checkpoint sync requires a block with total difficulty greater or equal than the TTD");
35293538
}
35303539
},
35313540
() -> {
35323541
throw new InvalidConfigurationException(
3533-
"Near head checkpoint sync requires TTD in the genesis file");
3542+
"PoS checkpoint sync requires TTD in the genesis file");
35343543
});
35353544
}
35363545
}

besu/src/main/java/org/hyperledger/besu/cli/options/unstable/MiningOptions.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_MAX_OMMERS_DEPTH;
1818
import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_POS_BLOCK_CREATION_MAX_TIME;
19+
import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_POS_BLOCK_CREATION_REPETITION_MIN_DURATION;
1920
import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_POW_JOB_TTL;
2021
import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_REMOTE_SEALERS_LIMIT;
2122
import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_REMOTE_SEALERS_TTL;
@@ -67,6 +68,15 @@ public class MiningOptions {
6768
"Specifies the maximum time, in milliseconds, a PoS block creation jobs is allowed to run. Must be positive and ≤ 12000 (default: ${DEFAULT-VALUE} milliseconds)")
6869
private final Long posBlockCreationMaxTime = DEFAULT_POS_BLOCK_CREATION_MAX_TIME;
6970

71+
@CommandLine.Option(
72+
hidden = true,
73+
names = {"--Xpos-block-creation-repetition-min-duration"},
74+
description =
75+
"If a PoS block creation repetition takes less than this duration, in milliseconds,"
76+
+ " then it waits before next repetition. Must be positive and ≤ 2000 (default: ${DEFAULT-VALUE} milliseconds)")
77+
private final Long posBlockCreationRepetitionMinDuration =
78+
DEFAULT_POS_BLOCK_CREATION_REPETITION_MIN_DURATION;
79+
7080
/**
7181
* Create mining options.
7282
*
@@ -129,4 +139,13 @@ public int getMaxOmmersDepth() {
129139
public Long getPosBlockCreationMaxTime() {
130140
return posBlockCreationMaxTime;
131141
}
142+
143+
/**
144+
* Gets pos block creation repetition min duration.
145+
*
146+
* @return the pos block creation repetition min duration.
147+
*/
148+
public Long getPosBlockCreationRepetitionMinDuration() {
149+
return posBlockCreationRepetitionMinDuration;
150+
}
132151
}

besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
7676
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolFactory;
7777
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
78+
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
7879
import org.hyperledger.besu.ethereum.p2p.config.SubProtocolConfiguration;
7980
import org.hyperledger.besu.ethereum.storage.StorageProvider;
8081
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier;
@@ -548,9 +549,12 @@ public BesuController build() {
548549
}
549550
}
550551
final int maxMessageSize = ethereumWireProtocolConfiguration.getMaxMessageSize();
552+
final Supplier<ProtocolSpec> currentProtocolSpecSupplier =
553+
() -> protocolSchedule.getByBlockHeader(blockchain.getChainHeadHeader());
551554
final EthPeers ethPeers =
552555
new EthPeers(
553556
getSupportedProtocol(),
557+
currentProtocolSpecSupplier,
554558
clock,
555559
metricsSystem,
556560
maxPeers,

besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515
package org.hyperledger.besu.controller;
1616

17+
import org.hyperledger.besu.config.GenesisConfigOptions;
1718
import org.hyperledger.besu.consensus.merge.MergeContext;
1819
import org.hyperledger.besu.consensus.merge.MergeProtocolSchedule;
1920
import org.hyperledger.besu.consensus.merge.PostMergeContext;
@@ -186,19 +187,24 @@ protected MergeContext createConsensusContext(
186187
final WorldStateArchive worldStateArchive,
187188
final ProtocolSchedule protocolSchedule) {
188189

189-
OptionalLong terminalBlockNumber = configOptionsSupplier.get().getTerminalBlockNumber();
190-
Optional<Hash> terminalBlockHash = configOptionsSupplier.get().getTerminalBlockHash();
190+
final GenesisConfigOptions genesisConfigOptions = configOptionsSupplier.get();
191+
final OptionalLong terminalBlockNumber = genesisConfigOptions.getTerminalBlockNumber();
192+
final Optional<Hash> terminalBlockHash = genesisConfigOptions.getTerminalBlockHash();
193+
final boolean isPostMergeAtGenesis =
194+
genesisConfigOptions.getTerminalTotalDifficulty().isPresent()
195+
&& genesisConfigOptions.getTerminalTotalDifficulty().get().isZero()
196+
&& blockchain.getGenesisBlockHeader().getDifficulty().isZero();
191197

192198
final MergeContext mergeContext =
193199
PostMergeContext.get()
194200
.setSyncState(syncState.get())
195201
.setTerminalTotalDifficulty(
196-
configOptionsSupplier
197-
.get()
202+
genesisConfigOptions
198203
.getTerminalTotalDifficulty()
199204
.map(Difficulty::of)
200205
.orElse(Difficulty.ZERO))
201-
.setCheckpointPostMergeSync(syncConfig.isCheckpointPostMergeEnabled());
206+
.setCheckpointPostMergeSync(syncConfig.isCheckpointPostMergeEnabled())
207+
.setPostMergeAtGenesis(isPostMergeAtGenesis);
202208

203209
blockchain
204210
.getFinalized()

besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@
2424
import org.hyperledger.besu.cli.config.NetworkName;
2525
import org.hyperledger.besu.config.GenesisConfigFile;
2626
import org.hyperledger.besu.config.GenesisConfigOptions;
27+
import org.hyperledger.besu.consensus.merge.TransitionProtocolSchedule;
2728
import org.hyperledger.besu.ethereum.chain.Blockchain;
2829
import org.hyperledger.besu.ethereum.chain.GenesisState;
2930
import org.hyperledger.besu.ethereum.core.BlockHeader;
3031
import org.hyperledger.besu.ethereum.forkid.ForkId;
3132
import org.hyperledger.besu.ethereum.forkid.ForkIdManager;
32-
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
3333
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
34-
import org.hyperledger.besu.evm.internal.EvmConfiguration;
3534

3635
import java.util.Collection;
3736
import java.util.List;
@@ -73,8 +72,9 @@ public static Collection<Object[]> parameters() {
7372
NetworkName.SEPOLIA,
7473
List.of(
7574
new ForkId(Bytes.ofUnsignedInt(0xfe3366e7L), 1735371L),
76-
new ForkId(Bytes.ofUnsignedInt(0xb96cbd13L), 0L),
77-
new ForkId(Bytes.ofUnsignedInt(0xb96cbd13L), 0L))
75+
new ForkId(Bytes.ofUnsignedInt(0xb96cbd13L), 1677557088L),
76+
new ForkId(Bytes.ofUnsignedInt(0xf7f9bc08L), 0L),
77+
new ForkId(Bytes.ofUnsignedInt(0xf7f9bc08L), 0L))
7878
},
7979
new Object[] {
8080
NetworkName.RINKEBY,
@@ -168,8 +168,7 @@ public void testForkId() {
168168
final GenesisConfigFile genesisConfigFile =
169169
GenesisConfigFile.fromConfig(EthNetworkConfig.jsonConfig(chainName));
170170
final GenesisConfigOptions configOptions = genesisConfigFile.getConfigOptions();
171-
final ProtocolSchedule schedule =
172-
MainnetProtocolSchedule.fromConfig(configOptions, EvmConfiguration.DEFAULT);
171+
final ProtocolSchedule schedule = TransitionProtocolSchedule.fromConfig(configOptions);
173172
final GenesisState genesisState = GenesisState.fromConfig(genesisConfigFile, schedule);
174173
final Blockchain mockBlockchain = mock(Blockchain.class);
175174
final BlockHeader mockBlockHeader = mock(BlockHeader.class);
@@ -179,6 +178,7 @@ public void testForkId() {
179178
final AtomicLong blockNumber = new AtomicLong();
180179
when(mockBlockchain.getChainHeadHeader()).thenReturn(mockBlockHeader);
181180
when(mockBlockHeader.getNumber()).thenAnswer(o -> blockNumber.get());
181+
when(mockBlockHeader.getTimestamp()).thenAnswer(o -> blockNumber.get());
182182

183183
final ForkIdManager forkIdManager =
184184
new ForkIdManager(
@@ -187,7 +187,7 @@ public void testForkId() {
187187
genesisConfigFile.getForkTimestamps(),
188188
false);
189189

190-
final var actualForkIds =
190+
final List<ForkId> actualForkIds =
191191
Streams.concat(schedule.streamMilestoneBlocks(), Stream.of(Long.MAX_VALUE))
192192
.map(
193193
block -> {

besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5518,7 +5518,7 @@ public void checkpointPostMergeShouldFailWhenGenesisHasNoTTD() throws IOExceptio
55185518

55195519
assertThat(commandOutput.toString(UTF_8)).isEmpty();
55205520
assertThat(commandErrorOutput.toString(UTF_8))
5521-
.contains("Near head checkpoint sync requires TTD in the genesis file");
5521+
.contains("PoS checkpoint sync requires TTD in the genesis file");
55225522
}
55235523

55245524
@Test
@@ -5529,7 +5529,7 @@ public void checkpointPostMergeShouldFailWhenGenesisUsesCheckpointFromPreMerge()
55295529
assertThat(commandOutput.toString(UTF_8)).isEmpty();
55305530
assertThat(commandErrorOutput.toString(UTF_8))
55315531
.contains(
5532-
"Near head checkpoint sync requires a block with total difficulty greater than the TTD");
5532+
"PoS checkpoint sync requires a block with total difficulty greater or equal than the TTD");
55335533
}
55345534

55355535
@Test
@@ -5559,6 +5559,25 @@ public void checkpointPostMergeWithPostMergeBlockSucceeds() throws IOException {
55595559
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
55605560
}
55615561

5562+
@Test
5563+
public void checkpointPostMergeWithPostMergeBlockTDEqualsTTDSucceeds() throws IOException {
5564+
final String configText =
5565+
Resources.toString(
5566+
Resources.getResource("valid_pos_checkpoint_pos_TD_equals_TTD.json"),
5567+
StandardCharsets.UTF_8);
5568+
final Path genesisFile = createFakeGenesisFile(new JsonObject(configText));
5569+
5570+
parseCommand(
5571+
"--genesis-file",
5572+
genesisFile.toString(),
5573+
"--sync-mode",
5574+
"X_CHECKPOINT",
5575+
"--Xcheckpoint-post-merge-enabled");
5576+
5577+
assertThat(commandOutput.toString(UTF_8)).isEmpty();
5578+
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
5579+
}
5580+
55625581
@Test
55635582
public void checkpointMergeAtGenesisWithGenesisBlockDifficultyZeroFails() throws IOException {
55645583
final String configText =
@@ -5577,6 +5596,6 @@ public void checkpointMergeAtGenesisWithGenesisBlockDifficultyZeroFails() throws
55775596
assertThat(commandOutput.toString(UTF_8)).isEmpty();
55785597
assertThat(commandErrorOutput.toString(UTF_8))
55795598
.contains(
5580-
"Post Merge checkpoint sync can't be used with TTD = 0 and checkpoint totalDifficulty = 0");
5599+
"PoS checkpoint sync can't be used with TTD = 0 and checkpoint totalDifficulty = 0");
55815600
}
55825601
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"config": {
3+
"chainId": 1337,
4+
"homesteadBlock": 0,
5+
"daoForkBlock": 0,
6+
"eip150Block": 0,
7+
"eip158Block": 0,
8+
"byzantiumBlock": 0,
9+
"petersburgBlock": 0,
10+
"istanbulBlock": 0,
11+
"muirGlacierBlock": 0,
12+
"berlinBlock": 0,
13+
"londonBlock": 0,
14+
"arrowGlacierBlock": 0,
15+
"grayGlacierBlock": 0,
16+
"terminalTotalDifficulty": 10,
17+
"ethash": {
18+
},
19+
"discovery": {
20+
"dns": "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.mainnet.ethdisco.net",
21+
"bootnodes": [
22+
"enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@18.138.108.67:30303",
23+
"enode://22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de@3.209.45.79:30303",
24+
"enode://8499da03c47d637b20eee24eec3c356c9a2e6148d6fe25ca195c7949ab8ec2c03e3556126b0d7ed644675e78c4318b08691b7b57de10e5f0d40d05b09238fa0a@52.187.207.27:30303",
25+
"enode://103858bdb88756c71f15e9b5e09b56dc1be52f0a5021d46301dbbfb7e130029cc9d0d6f73f693bc29b665770fff7da4d34f3c6379fe12721b5d7a0bcb5ca1fc1@191.234.162.198:30303",
26+
"enode://715171f50508aba88aecd1250af392a45a330af91d7b90701c436b618c86aaa1589c9184561907bebbb56439b8f8787bc01f49a7c77276c58c1b09822d75e8e8@52.231.165.108:30303",
27+
"enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303",
28+
"enode://2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc@65.108.70.101:30303",
29+
"enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303",
30+
"enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303",
31+
"enode://3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99@13.93.211.84:30303",
32+
"enode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303",
33+
"enode://158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6@13.75.154.138:30303",
34+
"enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303",
35+
"enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303"
36+
]
37+
},
38+
"checkpoint": {
39+
"hash": "0x186642d6084eb7799cb01c7eb69c1a7f3b2c32cd141e62d309f30081a1ea3c91",
40+
"number": 3,
41+
"totalDifficulty": "0x0a"
42+
}
43+
},
44+
"nonce": "0x42",
45+
"timestamp": "0x0",
46+
"extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
47+
"gasLimit": "0x1388",
48+
"difficulty": "0x400000000",
49+
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
50+
"coinbase": "0x0000000000000000000000000000000000000000",
51+
"alloc": {
52+
"000d836201318ec6899a67540690382780743280": {
53+
"balance": "0xad78ebc5ac6200000"
54+
}
55+
}
56+
}

build.gradle

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -715,10 +715,7 @@ task dockerUpload {
715715
additionalTags.add('develop')
716716
}
717717

718-
def isInterimBuild = (dockerBuildVersion ==~ /.*-SNAPSHOT/) || (dockerBuildVersion ==~ /.*-alpha/)
719-
|| (dockerBuildVersion ==~ /.*-beta/) || (dockerBuildVersion ==~ /.*-RC.*/)
720-
721-
if (!isInterimBuild) {
718+
if (!isInterimBuild(dockerBuildVersion)) {
722719
additionalTags.add(dockerBuildVersion.split(/\./)[0..1].join('.'))
723720
}
724721

@@ -778,7 +775,7 @@ task manifestDocker {
778775
tags.add("${dockerImageName}:develop")
779776
}
780777

781-
if (!(dockerBuildVersion ==~ /.*-SNAPSHOT/)) {
778+
if (!isInterimBuild(dockerBuildVersion)) {
782779
tags.add("${dockerImageName}:" + dockerBuildVersion.split(/\./)[0..1].join('.'))
783780
}
784781

@@ -929,6 +926,12 @@ def getCheckedOutGitCommitHash(length = 8) {
929926
}
930927
}
931928

929+
// Takes the version and if it contains SNAPSHOT, alpha, beta or RC in version then return true indicating an interim build
930+
def isInterimBuild(dockerBuildVersion) {
931+
return (dockerBuildVersion ==~ /.*-SNAPSHOT/) || (dockerBuildVersion ==~ /.*-alpha/)
932+
|| (dockerBuildVersion ==~ /.*-beta/) || (dockerBuildVersion ==~ /.*-RC.*/)
933+
}
934+
932935
tasks.register("verifyDistributions") {
933936
dependsOn distTar
934937
dependsOn distZip

0 commit comments

Comments
 (0)