Skip to content

Commit

Permalink
Release 23.1.1 rc1 (#5106)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
14 people authored Feb 17, 2023
1 parent 79c1a97 commit d048798
Show file tree
Hide file tree
Showing 101 changed files with 5,983 additions and 5,914 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 23.1.1-RC1
Besu 23.1.1-RC is a required update only for users who want to test Shanghai on Sepolia.

### Additions and Improvements
- Add implementation for engine_exchangeCapabilities [#4997](https://github.com/hyperledger/besu/pull/4997)
- Add implementation for engine_getPayloadBodiesByRangeV1 and engine_getPayloadBodiesByHashV1 [#4980](https://github.com/hyperledger/besu/pull/4980)
- 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)
- Fix engine_getPayloadV2 block value calculation [#5040](https://github.com/hyperledger/besu/issues/5040)
- Add support for Shanghai in Sepolia [#5088](https://github.com/hyperledger/besu/pull/5088)

## 23.1.0
Besu 23.1.0 is a recommended update for Mainnet users. Thank you all for your patience as we crafted this quarterly release.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ public void shouldFailToSendToToStrictNodeWithoutChainId() {
strictNode.verify(eth.expectEthSendRawTransactionException(rawTx, "ChainId is required"));
}

@Test
public void shouldFailToSendWithInvalidRlp() {
final String invalidRawTx = "0x5555";
strictNode.verify(eth.expectEthSendRawTransactionException(invalidRawTx, "Invalid params"));
}

@Test
public void shouldSendSuccessfullyWithChainId_lenientNode() {
final TransferTransaction tx = createTransactionWithChainId();
Expand Down
19 changes: 14 additions & 5 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -1891,6 +1891,13 @@ private void validateMiningParams() {
throw new ParameterException(
this.commandLine, "--Xpos-block-creation-max-time must be positive and ≤ 12000");
}

if (unstableMiningOptions.getPosBlockCreationRepetitionMinDuration() <= 0
|| unstableMiningOptions.getPosBlockCreationRepetitionMinDuration() > 2000) {
throw new ParameterException(
this.commandLine,
"--Xpos-block-creation-repetition-min-duration must be positive and ≤ 2000");
}
}

/**
Expand Down Expand Up @@ -2271,6 +2278,8 @@ public BesuControllerBuilder getControllerBuilder() {
.powJobTimeToLive(unstableMiningOptions.getPowJobTimeToLive())
.maxOmmerDepth(unstableMiningOptions.getMaxOmmersDepth())
.posBlockCreationMaxTime(unstableMiningOptions.getPosBlockCreationMaxTime())
.posBlockCreationRepetitionMinDuration(
unstableMiningOptions.getPosBlockCreationRepetitionMinDuration())
.build())
.transactionPoolConfiguration(buildTransactionPoolConfiguration())
.nodeKey(new NodeKey(securityModule()))
Expand Down Expand Up @@ -3510,7 +3519,7 @@ private void validatePostMergeCheckpointBlockRequirements() {
if (synchronizerConfiguration.isCheckpointPostMergeEnabled()) {
if (!checkpointConfigOptions.isValid()) {
throw new InvalidConfigurationException(
"Near head checkpoint sync requires a checkpoint block configured in the genesis file");
"PoS checkpoint sync requires a checkpoint block configured in the genesis file");
}
terminalTotalDifficulty.ifPresentOrElse(
ttd -> {
Expand All @@ -3519,18 +3528,18 @@ private void validatePostMergeCheckpointBlockRequirements() {
.equals(UInt256.ZERO)
&& ttd.equals(UInt256.ZERO)) {
throw new InvalidConfigurationException(
"Post Merge checkpoint sync can't be used with TTD = 0 and checkpoint totalDifficulty = 0");
"PoS checkpoint sync can't be used with TTD = 0 and checkpoint totalDifficulty = 0");
}
if (UInt256.fromHexString(
genesisOptions.getCheckpointOptions().getTotalDifficulty().get())
.lessOrEqualThan(ttd)) {
.lessThan(ttd)) {
throw new InvalidConfigurationException(
"Near head checkpoint sync requires a block with total difficulty greater than the TTD");
"PoS checkpoint sync requires a block with total difficulty greater or equal than the TTD");
}
},
() -> {
throw new InvalidConfigurationException(
"Near head checkpoint sync requires TTD in the genesis file");
"PoS checkpoint sync requires TTD in the genesis file");
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

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

@CommandLine.Option(
hidden = true,
names = {"--Xpos-block-creation-repetition-min-duration"},
description =
"If a PoS block creation repetition takes less than this duration, in milliseconds,"
+ " then it waits before next repetition. Must be positive and ≤ 2000 (default: ${DEFAULT-VALUE} milliseconds)")
private final Long posBlockCreationRepetitionMinDuration =
DEFAULT_POS_BLOCK_CREATION_REPETITION_MIN_DURATION;

/**
* Create mining options.
*
Expand Down Expand Up @@ -129,4 +139,13 @@ public int getMaxOmmersDepth() {
public Long getPosBlockCreationMaxTime() {
return posBlockCreationMaxTime;
}

/**
* Gets pos block creation repetition min duration.
*
* @return the pos block creation repetition min duration.
*/
public Long getPosBlockCreationRepetitionMinDuration() {
return posBlockCreationRepetitionMinDuration;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolFactory;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
import org.hyperledger.besu.ethereum.p2p.config.SubProtocolConfiguration;
import org.hyperledger.besu.ethereum.storage.StorageProvider;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier;
Expand Down Expand Up @@ -548,9 +549,12 @@ public BesuController build() {
}
}
final int maxMessageSize = ethereumWireProtocolConfiguration.getMaxMessageSize();
final Supplier<ProtocolSpec> currentProtocolSpecSupplier =
() -> protocolSchedule.getByBlockHeader(blockchain.getChainHeadHeader());
final EthPeers ethPeers =
new EthPeers(
getSupportedProtocol(),
currentProtocolSpecSupplier,
clock,
metricsSystem,
maxPeers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
package org.hyperledger.besu.controller;

import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.consensus.merge.MergeContext;
import org.hyperledger.besu.consensus.merge.MergeProtocolSchedule;
import org.hyperledger.besu.consensus.merge.PostMergeContext;
Expand Down Expand Up @@ -186,19 +187,24 @@ protected MergeContext createConsensusContext(
final WorldStateArchive worldStateArchive,
final ProtocolSchedule protocolSchedule) {

OptionalLong terminalBlockNumber = configOptionsSupplier.get().getTerminalBlockNumber();
Optional<Hash> terminalBlockHash = configOptionsSupplier.get().getTerminalBlockHash();
final GenesisConfigOptions genesisConfigOptions = configOptionsSupplier.get();
final OptionalLong terminalBlockNumber = genesisConfigOptions.getTerminalBlockNumber();
final Optional<Hash> terminalBlockHash = genesisConfigOptions.getTerminalBlockHash();
final boolean isPostMergeAtGenesis =
genesisConfigOptions.getTerminalTotalDifficulty().isPresent()
&& genesisConfigOptions.getTerminalTotalDifficulty().get().isZero()
&& blockchain.getGenesisBlockHeader().getDifficulty().isZero();

final MergeContext mergeContext =
PostMergeContext.get()
.setSyncState(syncState.get())
.setTerminalTotalDifficulty(
configOptionsSupplier
.get()
genesisConfigOptions
.getTerminalTotalDifficulty()
.map(Difficulty::of)
.orElse(Difficulty.ZERO))
.setCheckpointPostMergeSync(syncConfig.isCheckpointPostMergeEnabled());
.setCheckpointPostMergeSync(syncConfig.isCheckpointPostMergeEnabled())
.setPostMergeAtGenesis(isPostMergeAtGenesis);

blockchain
.getFinalized()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@
import org.hyperledger.besu.cli.config.NetworkName;
import org.hyperledger.besu.config.GenesisConfigFile;
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.consensus.merge.TransitionProtocolSchedule;
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.chain.GenesisState;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.forkid.ForkId;
import org.hyperledger.besu.ethereum.forkid.ForkIdManager;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.evm.internal.EvmConfiguration;

import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -73,8 +72,9 @@ public static Collection<Object[]> parameters() {
NetworkName.SEPOLIA,
List.of(
new ForkId(Bytes.ofUnsignedInt(0xfe3366e7L), 1735371L),
new ForkId(Bytes.ofUnsignedInt(0xb96cbd13L), 0L),
new ForkId(Bytes.ofUnsignedInt(0xb96cbd13L), 0L))
new ForkId(Bytes.ofUnsignedInt(0xb96cbd13L), 1677557088L),
new ForkId(Bytes.ofUnsignedInt(0xf7f9bc08L), 0L),
new ForkId(Bytes.ofUnsignedInt(0xf7f9bc08L), 0L))
},
new Object[] {
NetworkName.RINKEBY,
Expand Down Expand Up @@ -168,8 +168,7 @@ public void testForkId() {
final GenesisConfigFile genesisConfigFile =
GenesisConfigFile.fromConfig(EthNetworkConfig.jsonConfig(chainName));
final GenesisConfigOptions configOptions = genesisConfigFile.getConfigOptions();
final ProtocolSchedule schedule =
MainnetProtocolSchedule.fromConfig(configOptions, EvmConfiguration.DEFAULT);
final ProtocolSchedule schedule = TransitionProtocolSchedule.fromConfig(configOptions);
final GenesisState genesisState = GenesisState.fromConfig(genesisConfigFile, schedule);
final Blockchain mockBlockchain = mock(Blockchain.class);
final BlockHeader mockBlockHeader = mock(BlockHeader.class);
Expand All @@ -179,6 +178,7 @@ public void testForkId() {
final AtomicLong blockNumber = new AtomicLong();
when(mockBlockchain.getChainHeadHeader()).thenReturn(mockBlockHeader);
when(mockBlockHeader.getNumber()).thenAnswer(o -> blockNumber.get());
when(mockBlockHeader.getTimestamp()).thenAnswer(o -> blockNumber.get());

final ForkIdManager forkIdManager =
new ForkIdManager(
Expand All @@ -187,7 +187,7 @@ public void testForkId() {
genesisConfigFile.getForkTimestamps(),
false);

final var actualForkIds =
final List<ForkId> actualForkIds =
Streams.concat(schedule.streamMilestoneBlocks(), Stream.of(Long.MAX_VALUE))
.map(
block -> {
Expand Down
25 changes: 22 additions & 3 deletions besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5518,7 +5518,7 @@ public void checkpointPostMergeShouldFailWhenGenesisHasNoTTD() throws IOExceptio

assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8))
.contains("Near head checkpoint sync requires TTD in the genesis file");
.contains("PoS checkpoint sync requires TTD in the genesis file");
}

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

@Test
Expand Down Expand Up @@ -5559,6 +5559,25 @@ public void checkpointPostMergeWithPostMergeBlockSucceeds() throws IOException {
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}

@Test
public void checkpointPostMergeWithPostMergeBlockTDEqualsTTDSucceeds() throws IOException {
final String configText =
Resources.toString(
Resources.getResource("valid_pos_checkpoint_pos_TD_equals_TTD.json"),
StandardCharsets.UTF_8);
final Path genesisFile = createFakeGenesisFile(new JsonObject(configText));

parseCommand(
"--genesis-file",
genesisFile.toString(),
"--sync-mode",
"X_CHECKPOINT",
"--Xcheckpoint-post-merge-enabled");

assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}

@Test
public void checkpointMergeAtGenesisWithGenesisBlockDifficultyZeroFails() throws IOException {
final String configText =
Expand All @@ -5577,6 +5596,6 @@ public void checkpointMergeAtGenesisWithGenesisBlockDifficultyZeroFails() throws
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8))
.contains(
"Post Merge checkpoint sync can't be used with TTD = 0 and checkpoint totalDifficulty = 0");
"PoS checkpoint sync can't be used with TTD = 0 and checkpoint totalDifficulty = 0");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"config": {
"chainId": 1337,
"homesteadBlock": 0,
"daoForkBlock": 0,
"eip150Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"arrowGlacierBlock": 0,
"grayGlacierBlock": 0,
"terminalTotalDifficulty": 10,
"ethash": {
},
"discovery": {
"dns": "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.mainnet.ethdisco.net",
"bootnodes": [
"enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@18.138.108.67:30303",
"enode://22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de@3.209.45.79:30303",
"enode://8499da03c47d637b20eee24eec3c356c9a2e6148d6fe25ca195c7949ab8ec2c03e3556126b0d7ed644675e78c4318b08691b7b57de10e5f0d40d05b09238fa0a@52.187.207.27:30303",
"enode://103858bdb88756c71f15e9b5e09b56dc1be52f0a5021d46301dbbfb7e130029cc9d0d6f73f693bc29b665770fff7da4d34f3c6379fe12721b5d7a0bcb5ca1fc1@191.234.162.198:30303",
"enode://715171f50508aba88aecd1250af392a45a330af91d7b90701c436b618c86aaa1589c9184561907bebbb56439b8f8787bc01f49a7c77276c58c1b09822d75e8e8@52.231.165.108:30303",
"enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303",
"enode://2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc@65.108.70.101:30303",
"enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303",
"enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303",
"enode://3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99@13.93.211.84:30303",
"enode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303",
"enode://158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6@13.75.154.138:30303",
"enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303",
"enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303"
]
},
"checkpoint": {
"hash": "0x186642d6084eb7799cb01c7eb69c1a7f3b2c32cd141e62d309f30081a1ea3c91",
"number": 3,
"totalDifficulty": "0x0a"
}
},
"nonce": "0x42",
"timestamp": "0x0",
"extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
"gasLimit": "0x1388",
"difficulty": "0x400000000",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"000d836201318ec6899a67540690382780743280": {
"balance": "0xad78ebc5ac6200000"
}
}
}
13 changes: 8 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -715,10 +715,7 @@ task dockerUpload {
additionalTags.add('develop')
}

def isInterimBuild = (dockerBuildVersion ==~ /.*-SNAPSHOT/) || (dockerBuildVersion ==~ /.*-alpha/)
|| (dockerBuildVersion ==~ /.*-beta/) || (dockerBuildVersion ==~ /.*-RC.*/)

if (!isInterimBuild) {
if (!isInterimBuild(dockerBuildVersion)) {
additionalTags.add(dockerBuildVersion.split(/\./)[0..1].join('.'))
}

Expand Down Expand Up @@ -778,7 +775,7 @@ task manifestDocker {
tags.add("${dockerImageName}:develop")
}

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

Expand Down Expand Up @@ -929,6 +926,12 @@ def getCheckedOutGitCommitHash(length = 8) {
}
}

// Takes the version and if it contains SNAPSHOT, alpha, beta or RC in version then return true indicating an interim build
def isInterimBuild(dockerBuildVersion) {
return (dockerBuildVersion ==~ /.*-SNAPSHOT/) || (dockerBuildVersion ==~ /.*-alpha/)
|| (dockerBuildVersion ==~ /.*-beta/) || (dockerBuildVersion ==~ /.*-RC.*/)
}

tasks.register("verifyDistributions") {
dependsOn distTar
dependsOn distZip
Expand Down
Loading

0 comments on commit d048798

Please sign in to comment.