Skip to content

Commit

Permalink
Merge branch 'main' into eth_getLogs_fix
Browse files Browse the repository at this point in the history
Signed-off-by: mark-terry <36909937+mark-terry@users.noreply.github.com>
  • Loading branch information
mark-terry authored Oct 13, 2022
2 parents 4355733 + 7cab18e commit aa6a0c4
Show file tree
Hide file tree
Showing 23 changed files with 371 additions and 215 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
# Changelog
## 22.10.0
### Breaking Changes
- Version 22.10.0 will require Java 17 to build and run.

## 22.10.0-RC2

### Breaking Changes
- Flexible Privacy Groups (early access) support to Tessera's EC encryptor (contracts modified) [#4282](https://github.com/hyperledger/besu/pull/4282)
* Before this change, the `bytes32` type was used for the enclave public keys, just supporting encryptors with public keys of that length (like the default NaCl)
* For the EC encryptor, the encoded public key length is 91
- `--tx-pool-hashes-max-size` option removed (deprecated in 22.1.3).
- `--tx-pool-hashes-max-size` option removed (deprecated in 22.1.3)
- `--Xmerge-support` option remove (deprecated in 22.4.2) [#4518](https://github.com/hyperledger/besu/pull/4518)

### Additions and Improvements
- Improved RLP processing of zero-length string as 0x80 [#4283](https://github.com/hyperledger/besu/pull/4283) [#4388](https://github.com/hyperledger/besu/issues/4388)
- Increased level of detail in JSON-RPC parameter error log messages [#4510](https://github.com/hyperledger/besu/pull/4510)
- New unstable configuration options to set the maximum time, in milliseconds, a PoS block creation jobs is allowed to run [#4519](https://github.com/hyperledger/besu/pull/4519)

### Bug Fixes
- Corrects emission of blockadded events when rewinding during a re-org. Fix for [#4495](https://github.com/hyperledger/besu/issues/4495)
- Always return a transaction type for pending transactions [#4364](https://github.com/hyperledger/besu/pull/4364)
- Fixed default fromBlock value in eth_getLogs RPC handler [#4513](https://github.com/hyperledger/besu/pull/4513)
- Avoid a cyclic reference while printing EngineExchangeTransitionConfigurationParameter [#4357](https://github.com/hyperledger/besu/pull/4357)
- In GraphQL update scalar parsing to be variable friendly [#4522](https://github.com/hyperledger/besu/pull/4522)
- Fixed default fromBlock value and improved parameter interpetation in eth_getLogs RPC handler [#4513](https://github.com/hyperledger/besu/pull/4513)

### Download Links

Expand Down
10 changes: 7 additions & 3 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import org.hyperledger.besu.cli.options.unstable.EvmOptions;
import org.hyperledger.besu.cli.options.unstable.IpcOptions;
import org.hyperledger.besu.cli.options.unstable.LauncherOptions;
import org.hyperledger.besu.cli.options.unstable.MergeOptions;
import org.hyperledger.besu.cli.options.unstable.MetricsCLIOptions;
import org.hyperledger.besu.cli.options.unstable.MiningOptions;
import org.hyperledger.besu.cli.options.unstable.NatOptions;
Expand Down Expand Up @@ -282,7 +281,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
private final NatOptions unstableNatOptions = NatOptions.create();
private final NativeLibraryOptions unstableNativeLibraryOptions = NativeLibraryOptions.create();
private final RPCOptions unstableRPCOptions = RPCOptions.create();
private final MergeOptions mergeOptions = MergeOptions.create();
final LauncherOptions unstableLauncherOptions = LauncherOptions.create();
private final PrivacyPluginOptions unstablePrivacyPluginOptions = PrivacyPluginOptions.create();
private final EvmOptions unstableEvmOptions = EvmOptions.create();
Expand Down Expand Up @@ -1521,7 +1519,6 @@ private void handleUnstableOptions() {
.put("Mining", unstableMiningOptions)
.put("Native Library", unstableNativeLibraryOptions)
.put("Launcher", unstableLauncherOptions)
.put("Merge", mergeOptions)
.put("EVM Options", unstableEvmOptions)
.put("IPC Options", unstableIpcOptions)
.build();
Expand Down Expand Up @@ -1762,6 +1759,12 @@ private void validateMiningParams() {
"Unable to mine with Stratum if mining is disabled. Either disable Stratum mining (remove --miner-stratum-enabled) "
+ "or specify mining is enabled (--miner-enabled)");
}
if (unstableMiningOptions.getPosBlockCreationMaxTime() <= 0
|| unstableMiningOptions.getPosBlockCreationMaxTime()
> MiningParameters.DEFAULT_POS_BLOCK_CREATION_MAX_TIME) {
throw new ParameterException(
this.commandLine, "--Xpos-block-creation-max-time must be positive and ≤ 12000");
}
}

protected void validateP2PInterface(final String p2pInterface) {
Expand Down Expand Up @@ -2096,6 +2099,7 @@ public BesuControllerBuilder getControllerBuilder() {
.remoteSealersTimeToLive(unstableMiningOptions.getRemoteSealersTimeToLive())
.powJobTimeToLive(unstableMiningOptions.getPowJobTimeToLive())
.maxOmmerDepth(unstableMiningOptions.getMaxOmmersDepth())
.posBlockCreationMaxTime(unstableMiningOptions.getPosBlockCreationMaxTime())
.build())
.transactionPoolConfiguration(buildTransactionPoolConfiguration())
.nodeKey(new NodeKey(securityModule()))
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package org.hyperledger.besu.cli.options.unstable;

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_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 @@ -58,6 +59,13 @@ public class MiningOptions {
description = "Extranonce for Stratum network miners (default: ${DEFAULT-VALUE})")
private String stratumExtranonce = "080c";

@CommandLine.Option(
hidden = true,
names = {"--Xpos-block-creation-max-time"},
description =
"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;

public static MiningOptions create() {
return new MiningOptions();
}
Expand All @@ -81,4 +89,8 @@ public Long getPowJobTimeToLive() {
public int getMaxOmmersDepth() {
return maxOmmersDepth;
}

public Long getPosBlockCreationMaxTime() {
return posBlockCreationMaxTime;
}
}
34 changes: 33 additions & 1 deletion besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import static org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis.NET;
import static org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis.PERM;
import static org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis.WEB3;
import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_POS_BLOCK_CREATION_MAX_TIME;
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.GOERLI_BOOTSTRAP_NODES;
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.GOERLI_DISCOVERY_URL;
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.MAINNET_BOOTSTRAP_NODES;
Expand Down Expand Up @@ -226,7 +227,7 @@ public void callingVersionDisplayBesuInfoVersion() {

// Testing default values
@Test
public void callingBesuCommandWithoutOptionsMustSyncWithDefaultValues() throws Exception {
public void callingBesuCommandWithoutOptionsMustSyncWithDefaultValues() {
parseCommand();

final int maxPeers = 25;
Expand Down Expand Up @@ -5327,4 +5328,35 @@ public void logWarnIfFastSyncMinPeersUsedWithFullSync() {
assertThat(commandErrorOutput.toString(UTF_8))
.contains("--fast-sync-min-peers can't be used with FULL sync-mode");
}

@Test
public void posBlockCreationMaxTimeDefaultValue() {
parseCommand();
assertThat(getPosBlockCreationMaxTimeValue()).isEqualTo(DEFAULT_POS_BLOCK_CREATION_MAX_TIME);
}

@Test
public void posBlockCreationMaxTimeOption() {
parseCommand("--Xpos-block-creation-max-time", "7000");
assertThat(getPosBlockCreationMaxTimeValue()).isEqualTo(7000L);
}

private long getPosBlockCreationMaxTimeValue() {
final ArgumentCaptor<MiningParameters> miningArg =
ArgumentCaptor.forClass(MiningParameters.class);

verify(mockControllerBuilder).miningParameters(miningArg.capture());
verify(mockControllerBuilder).build();

assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
return miningArg.getValue().getPosBlockCreationMaxTime();
}

@Test
public void posBlockCreationMaxTimeOutOfAllowedRange() {
parseCommand("--Xpos-block-creation-max-time", "17000");
assertThat(commandErrorOutput.toString(UTF_8))
.contains("--Xpos-block-creation-max-time must be positive and ≤ 12000");
}
}
2 changes: 2 additions & 0 deletions besu/src/test/resources/everything_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ miner-stratum-host="0.0.0.0"
miner-stratum-port=8008
Xminer-remote-sealers-limit=1000
Xminer-remote-sealers-hashrate-ttl=10
Xpos-block-creation-max-time=5

# Pruning
pruning-enabled=true
pruning-blocks-retained=1024
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private void tryToBuildBetterBlock(
final PayloadIdentifier payloadIdentifier,
final MergeBlockCreator mergeBlockCreator) {

long remainingTime = miningParameters.getPosBlockCreationTimeout();
long remainingTime = miningParameters.getPosBlockCreationMaxTime();
final Supplier<Block> blockCreator =
() -> mergeBlockCreator.createBlock(Optional.empty(), random, timestamp);
// start working on a full block and update the payload value and candidate when it's ready
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public void shouldRetryBlockCreationIfStillHaveTime() {
@Test
public void shouldStopRetryBlockCreationIfTimeExpired() {
when(mergeContext.getFinalized()).thenReturn(Optional.empty());
doReturn(1L).when(miningParameters).getPosBlockCreationTimeout();
doReturn(1L).when(miningParameters).getPosBlockCreationMaxTime();
reset(ethContext, ethScheduler);
when(ethContext.getScheduler()).thenReturn(ethScheduler);
when(ethScheduler.scheduleComputationTask(any()))
Expand Down
Loading

0 comments on commit aa6a0c4

Please sign in to comment.