Skip to content

Commit

Permalink
Merge branch 'main' into zkbesu
Browse files Browse the repository at this point in the history
  • Loading branch information
fab-10 committed Apr 9, 2024
2 parents 200246d + b6a26c4 commit 03dc8f5
Show file tree
Hide file tree
Showing 120 changed files with 552 additions and 187 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- Update Web3j dependencies [#6811](https://github.com/hyperledger/besu/pull/6811)
- Add `tx-pool-blob-price-bump` option to configure the price bump percentage required to replace blob transactions (by default 100%) [#6874](https://github.com/hyperledger/besu/pull/6874)
- Log detailed timing of block creation steps [#6880](https://github.com/hyperledger/besu/pull/6880)
- Expose transaction count by type metrics for the layered txpool [#6903](https://github.com/hyperledger/besu/pull/6903)

### Bug fixes
- Fix txpool dump/restore race condition [#6665](https://github.com/hyperledger/besu/pull/6665)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@ public class JsonRpcTestCase {
private final JsonNode request;
private final JsonNode response;
private final int statusCode;
private final long waitTime;

@JsonCreator
public JsonRpcTestCase(
@JsonProperty("request") final JsonNode request,
@JsonProperty("response") final JsonNode response,
@JsonProperty("statusCode") final int statusCode) {
@JsonProperty("statusCode") final int statusCode,
@JsonProperty(value = "waitTime", defaultValue = "0") final long waitTime) {
this.request = request;
this.response = response;
this.statusCode = statusCode;
this.waitTime = waitTime;
}

public JsonNode getRequest() {
Expand All @@ -44,4 +47,8 @@ public JsonNode getResponse() {
public int getStatusCode() {
return statusCode;
}

public long getWaitTime() {
return waitTime;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public void test(final URI testCaseFileURI) throws IOException {
.readTimeout(900, java.util.concurrent.TimeUnit.SECONDS)
.build();
}

if (testCase.getWaitTime() > 0L) {
waitForMillis(testCase.getWaitTime());
}

final Call testRequest =
client.newCall(
new Request.Builder()
Expand All @@ -112,6 +117,14 @@ public void test(final URI testCaseFileURI) throws IOException {
.isEqualTo(expectedBody);
}

private static void waitForMillis(final long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}

protected void evaluateResponse(
final ObjectNode responseBody,
final Call testRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ protected void evaluateResponse(
final Call testRequest,
final JsonRpcTestCase testCase,
final URL url) {
if (url.toString().endsWith("10_cancun_build_on_genesis.json")) {
// if we just asked the node to build, give it some time to build
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
if (url.toString().endsWith("12_cancun_get_built_block.json")) {

// final ObjectNode rpcResponse = JsonUtil.objectNodeFromString(response.body().string());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

public class BadCLIOptionsPluginTest extends AcceptanceTestBaseJunit5 {
private BesuNode node;
Expand All @@ -52,13 +54,15 @@ public void tearDown() {
}

@Test
@DisabledOnOs(OS.MAC)
public void shouldNotRegister() {
final Path registrationFile = node.homeDirectory().resolve("plugins/badCLIOptions.init");
waitForFile(registrationFile);
assertThat(node.homeDirectory().resolve("plugins/badCliOptions.register")).doesNotExist();
}

@Test
@DisabledOnOs(OS.MAC)
public void shouldNotStart() {
// depend on the good PicoCLIOptions to tell us when it should be up
final Path registrationFile = node.homeDirectory().resolve("plugins/pluginLifecycle.started");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.vertx.core.Vertx;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

public class NewPendingTransactionAcceptanceTest extends AcceptanceTestBase {
Expand Down Expand Up @@ -157,6 +158,7 @@ public void subscriptionToArchiveNodeMustReceiveEveryPublishEvent() {
}

@Test
@Disabled("This test is flaky and needs to be fixed")
public void everySubscriptionMustReceiveEveryPublishEvent() {
final Subscription minerSubscriptionOne = minerWebSocket.subscribe();
final Subscription minerSubscriptionTwo = minerWebSocket.subscribe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"remoteCount": 0
}
},
"statusCode": 200
"statusCode": 200,
"waitTime": 2000
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,63 +36,92 @@ public interface DefaultCommandValues {

/** The constant MANDATORY_PATH_FORMAT_HELP. */
String MANDATORY_PATH_FORMAT_HELP = "<PATH>";

/** The constant MANDATORY_FILE_FORMAT_HELP. */
String MANDATORY_FILE_FORMAT_HELP = "<FILE>";

/** The constant MANDATORY_DIRECTORY_FORMAT_HELP. */
String MANDATORY_DIRECTORY_FORMAT_HELP = "<DIRECTORY>";

/** The constant BESU_HOME_PROPERTY_NAME. */
String BESU_HOME_PROPERTY_NAME = "besu.home";

/** The constant DEFAULT_DATA_DIR_PATH. */
String DEFAULT_DATA_DIR_PATH = "./build/data";

/** The constant MANDATORY_INTEGER_FORMAT_HELP. */
String MANDATORY_INTEGER_FORMAT_HELP = "<INTEGER>";

/** The constant MANDATORY_DOUBLE_FORMAT_HELP. */
String MANDATORY_DOUBLE_FORMAT_HELP = "<DOUBLE>";

/** The constant MANDATORY_LONG_FORMAT_HELP. */
String MANDATORY_LONG_FORMAT_HELP = "<LONG>";

/** The constant MANDATORY_MODE_FORMAT_HELP. */
String MANDATORY_MODE_FORMAT_HELP = "<MODE>";

/** The constant MANDATORY_NETWORK_FORMAT_HELP. */
String MANDATORY_NETWORK_FORMAT_HELP = "<NETWORK>";

/** The constant PROFILE_OPTION_NAME. */
String PROFILE_OPTION_NAME = "--profile";

/** The constant PROFILE_FORMAT_HELP. */
String PROFILE_FORMAT_HELP = "<PROFILE>";

/** The constant MANDATORY_NODE_ID_FORMAT_HELP. */
String MANDATORY_NODE_ID_FORMAT_HELP = "<NODEID>";

/** The constant PERMISSIONING_CONFIG_LOCATION. */
String PERMISSIONING_CONFIG_LOCATION = "permissions_config.toml";

/** The constant MANDATORY_HOST_FORMAT_HELP. */
String MANDATORY_HOST_FORMAT_HELP = "<HOST>";

/** The constant MANDATORY_PORT_FORMAT_HELP. */
String MANDATORY_PORT_FORMAT_HELP = "<PORT>";

/** The constant DEFAULT_NAT_METHOD. */
NatMethod DEFAULT_NAT_METHOD = NatMethod.AUTO;

/** The constant DEFAULT_JWT_ALGORITHM. */
JwtAlgorithm DEFAULT_JWT_ALGORITHM = JwtAlgorithm.RS256;

/** The constant SYNC_MIN_PEER_COUNT. */
int SYNC_MIN_PEER_COUNT = 5;

/** The constant DEFAULT_MAX_PEERS. */
int DEFAULT_MAX_PEERS = 25;

/** The constant DEFAULT_HTTP_MAX_CONNECTIONS. */
int DEFAULT_HTTP_MAX_CONNECTIONS = 80;

/** The constant DEFAULT_HTTP_MAX_BATCH_SIZE. */
int DEFAULT_HTTP_MAX_BATCH_SIZE = 1024;

/** The constant DEFAULT_MAX_REQUEST_CONTENT_LENGTH. */
long DEFAULT_MAX_REQUEST_CONTENT_LENGTH = 5 * 1024 * 1024; // 5MB

/** The constant DEFAULT_WS_MAX_CONNECTIONS. */
int DEFAULT_WS_MAX_CONNECTIONS = 80;

/** The constant DEFAULT_WS_MAX_FRAME_SIZE. */
int DEFAULT_WS_MAX_FRAME_SIZE = 1024 * 1024;

/** The constant DEFAULT_FRACTION_REMOTE_WIRE_CONNECTIONS_ALLOWED. */
float DEFAULT_FRACTION_REMOTE_WIRE_CONNECTIONS_ALLOWED =
RlpxConfiguration.DEFAULT_FRACTION_REMOTE_CONNECTIONS_ALLOWED;

/** The constant DEFAULT_KEY_VALUE_STORAGE_NAME. */
String DEFAULT_KEY_VALUE_STORAGE_NAME = "rocksdb";

/** The constant DEFAULT_SECURITY_MODULE. */
String DEFAULT_SECURITY_MODULE = "localfile";

/** The constant DEFAULT_KEYSTORE_TYPE. */
String DEFAULT_KEYSTORE_TYPE = "JKS";

/** The Default tls protocols. */
List<String> DEFAULT_TLS_PROTOCOLS = List.of("TLSv1.3", "TLSv1.2");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
/** The Transaction pool Cli stable options. */
public class TransactionPoolOptions implements CLIOptions<TransactionPoolConfiguration> {
private static final String TX_POOL_IMPLEMENTATION = "--tx-pool";

/** Use TX_POOL_NO_LOCAL_PRIORITY instead */
@Deprecated(forRemoval = true)
private static final String TX_POOL_DISABLE_LOCALS = "--tx-pool-disable-locals";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public static class Unstable {
"Enables code storage using code hash instead of by account hash. (default: ${DEFAULT-VALUE})")
private boolean bonsaiCodeUsingCodeHashEnabled = DEFAULT_BONSAI_CODE_USING_CODE_HASH_ENABLED;
}

/**
* Create data storage options.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static LoggingLevelOption create() {

private static final Set<String> ACCEPTED_VALUES =
Set.of("OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE", "ALL");

/** The Picocli CommandSpec. Visible for testing. Injected by Picocli framework at runtime. */
@Spec CommandSpec spec;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ public class ChainPruningOptions implements CLIOptions<ChainPrunerConfiguration>
private static final String CHAIN_PRUNING_BLOCKS_RETAINED_FLAG =
"--Xchain-pruning-blocks-retained";
private static final String CHAIN_PRUNING_FREQUENCY_FLAG = "--Xchain-pruning-frequency";

/** The constant DEFAULT_CHAIN_DATA_PRUNING_MIN_BLOCKS_RETAINED. */
public static final long DEFAULT_CHAIN_DATA_PRUNING_MIN_BLOCKS_RETAINED = 7200;

/** The constant DEFAULT_CHAIN_DATA_PRUNING_FREQUENCY. */
public static final int DEFAULT_CHAIN_DATA_PRUNING_FREQUENCY = 256;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class NetworkingOptions implements CLIOptions<NetworkingConfiguration> {
"--Xp2p-check-maintained-connections-frequency";
private final String DNS_DISCOVERY_SERVER_OVERRIDE_FLAG = "--Xp2p-dns-discovery-server";
private final String DISCOVERY_PROTOCOL_V5_ENABLED = "--Xv5-discovery-enabled";

/** The constant FILTER_ON_ENR_FORK_ID. */
public static final String FILTER_ON_ENR_FORK_ID = "--filter-on-enr-fork-id";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class OperatorSubCommand implements Runnable {

/** The constant COMMAND_NAME. */
public static final String COMMAND_NAME = "operator";

/** The constant GENERATE_BLOCKCHAIN_CONFIG_SUBCOMMAND_NAME. */
public static final String GENERATE_BLOCKCHAIN_CONFIG_SUBCOMMAND_NAME =
"generate-blockchain-config";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ public class CommandLineUtils {
/** The constant DEPENDENCY_WARNING_MSG. */
public static final String DEPENDENCY_WARNING_MSG =
"{} has been ignored because {} was not defined on the command line.";

/** The constant MULTI_DEPENDENCY_WARNING_MSG. */
public static final String MULTI_DEPENDENCY_WARNING_MSG =
"{} ignored because none of {} was defined.";

/** The constant DEPRECATION_WARNING_MSG. */
public static final String DEPRECATION_WARNING_MSG = "{} has been deprecated, use {} instead.";

/** The constant DEPRECATED_AND_USELESS_WARNING_MSG. */
public static final String DEPRECATED_AND_USELESS_WARNING_MSG =
"{} has been deprecated and is now useless, remove it.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class BesuController implements java.io.Closeable {

/** The constant DATABASE_PATH. */
public static final String DATABASE_PATH = "database";

/** The constant CACHE_PATH. */
public static final String CACHE_PATH = "caches";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,56 +129,78 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides

/** The Sync config. */
protected SynchronizerConfiguration syncConfig;

/** The Ethereum wire protocol configuration. */
protected EthProtocolConfiguration ethereumWireProtocolConfiguration;

/** The Transaction pool configuration. */
protected TransactionPoolConfiguration transactionPoolConfiguration;

/** The Network id. */
protected BigInteger networkId;

/** The Mining parameters. */
protected MiningParameters miningParameters;

/** The Metrics system. */
protected ObservableMetricsSystem metricsSystem;

/** The Privacy parameters. */
protected PrivacyParameters privacyParameters;

/** The Pki block creation configuration. */
protected Optional<PkiBlockCreationConfiguration> pkiBlockCreationConfiguration =
Optional.empty();

/** The Data directory. */
protected Path dataDirectory;

/** The Clock. */
protected Clock clock;

/** The Node key. */
protected NodeKey nodeKey;

/** The Is revert reason enabled. */
protected boolean isRevertReasonEnabled;

/** The Gas limit calculator. */
GasLimitCalculator gasLimitCalculator;

/** The Storage provider. */
protected StorageProvider storageProvider;

/** The Required blocks. */
protected Map<Long, Hash> requiredBlocks = Collections.emptyMap();

/** The Reorg logging threshold. */
protected long reorgLoggingThreshold;

/** The Data storage configuration. */
protected DataStorageConfiguration dataStorageConfiguration =
DataStorageConfiguration.DEFAULT_CONFIG;

/** The Message permissioning providers. */
protected List<NodeMessagePermissioningProvider> messagePermissioningProviders =
Collections.emptyList();

/** The Evm configuration. */
protected EvmConfiguration evmConfiguration;

/** The Max peers. */
protected int maxPeers;

/** Manages a cache of bad blocks globally */
protected final BadBlockManager badBlockManager = new BadBlockManager();

private int maxRemotelyInitiatedPeers;

/** The Chain pruner configuration. */
protected ChainPrunerConfiguration chainPrunerConfiguration = ChainPrunerConfiguration.DEFAULT;

private NetworkingConfiguration networkingConfiguration;
private Boolean randomPeerPriority;

/** the Dagger configured context that can provide dependencies */
protected Optional<BesuComponent> besuComponent = Optional.empty();

Expand Down Expand Up @@ -1022,8 +1044,9 @@ yield new BonsaiWorldStateProvider(
yield new ForestWorldStateArchive(
worldStateStorageCoordinator, preimageStorage, evmConfiguration);
}
default -> throw new IllegalStateException(
"Unexpected value: " + dataStorageConfiguration.getDataStorageFormat());
default ->
throw new IllegalStateException(
"Unexpected value: " + dataStorageConfiguration.getDataStorageFormat());
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ protected void verifyOptionsConstraintLoggerCall(

assertThat(stringArgumentCaptor.getAllValues().get(2)).isEqualTo(mainOption);
}

/**
* Check logger calls
*
Expand Down
Loading

0 comments on commit 03dc8f5

Please sign in to comment.