Skip to content

Commit

Permalink
Merge branch 'main' into zkbesu
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/draft-release.yml
  • Loading branch information
fab-10 committed Jan 15, 2025
2 parents 1be83c5 + 5cc309a commit 1bb7624
Show file tree
Hide file tree
Showing 103 changed files with 5,423 additions and 7,602 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
### Breaking Changes
- `--host-whitelist` has been deprecated since 2020 and this option is removed. Use the equivalent `--host-allowlist` instead.
- Changed tracer API to include the mining beneficiary in BlockAwareOperationTracer::traceStartBlock [#8096](https://github.com/hyperledger/besu/pull/8096)
- Change the input defaults on debug_trace* calls to not trace memory by default ("disableMemory": true, "disableStack": false, "disableStorage": false)
- Change the output format of debug_trace* and trace_* calls to match Geth behaviour

### Upcoming Breaking Changes
- `MetricSystem::createLabelledGauge` is deprecated and will be removed in a future release, replace it with `MetricSystem::createLabelledSuppliedGauge`
Expand All @@ -20,7 +22,9 @@
- Retrieve all transaction receipts for a block in one request [#6646](https://github.com/hyperledger/besu/pull/6646)
- Implement EIP-7840: Add blob schedule to config files [#8042](https://github.com/hyperledger/besu/pull/8042)
- Allow gasPrice (legacy) and 1559 gasPrice params to be specified simultaneously for `eth_call`, `eth_createAccessList`, and `eth_estimateGas` [#8059](https://github.com/hyperledger/besu/pull/8059)
- Improve debug_traceBlock calls performance and reduce output size [#8076](https://github.com/hyperledger/besu/pull/8076)
- Add support for EIP-7702 transaction in the txpool [#8018](https://github.com/hyperledger/besu/pull/8018) [#7984](https://github.com/hyperledger/besu/pull/7984)
- Add support for `movePrecompileToAddress` in `StateOverrides` (`eth_call`)[8115](https://github.com/hyperledger/besu/pull/8115)

### Bug fixes
- Fix serialization of state overrides when `movePrecompileToAddress` is present [#8204](https://github.com/hyperledger/besu/pull/8024)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public void shouldTransferAllEthOfAuthorizerToSponsor() throws IOException {
*/
@Test
public void shouldCheckNonceAfterNonceIncreaseOfSender() throws IOException {
final long GAS_LIMIT = 1000000L;
cluster.verify(authorizer.balanceEquals(Amount.ether(90000)));
final long GAS_LIMIT = 1_000_000L;
cluster.verify(authorizer.balanceEquals(Amount.ether(90_000)));

final CodeDelegation authorization =
org.hyperledger.besu.ethereum.core.CodeDelegation.builder()
Expand All @@ -159,7 +159,7 @@ public void shouldCheckNonceAfterNonceIncreaseOfSender() throws IOException {
.type(TransactionType.DELEGATE_CODE)
.chainId(BigInteger.valueOf(20211))
.nonce(0)
.maxPriorityFeePerGas(Wei.of(1000000000))
.maxPriorityFeePerGas(Wei.of(1_000_000_000))
.maxFeePerGas(Wei.fromHexString("0x02540BE400"))
.gasLimit(GAS_LIMIT)
.to(Address.fromHexStringStrict(authorizer.getAddress()))
Expand Down Expand Up @@ -209,7 +209,7 @@ public void shouldCheckNonceAfterNonceIncreaseOfSender() throws IOException {
.nonce(2)
.maxPriorityFeePerGas(Wei.of(10))
.maxFeePerGas(Wei.of(100))
.gasLimit(21000)
.gasLimit(21_000)
.to(Address.fromHexStringStrict(otherAccount.getAddress()))
.value(Wei.ONE)
.payload(Bytes.EMPTY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ public void buildNewBlock() throws IOException {
executionPayload.toString(), parentBeaconBlockRoot, executionRequests.toString()));
try (final Response newPayloadResponse = newPayloadRequest.execute()) {
assertThat(newPayloadResponse.code()).isEqualTo(200);

final String responseStatus =
mapper.readTree(newPayloadResponse.body().string()).get("result").get("status").asText();
assertThat(responseStatus).isEqualTo("VALID");
}

final Call moveChainAheadRequest = createEngineCall(createForkChoiceRequest(newBlockHash));
Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/tests/src/test/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" monitorInterval="30">
<Configuration level="WARN" monitorInterval="30">
<Properties>
<Property name="root.log.level">INFO</Property>
</Properties>
Expand Down
24 changes: 16 additions & 8 deletions besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright ConsenSys AG.
* Copyright contributors to Besu.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -74,6 +74,7 @@
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Synchronizer;
import org.hyperledger.besu.ethereum.eth.manager.EthPeers;
import org.hyperledger.besu.ethereum.eth.manager.EthScheduler;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.FlexiblePrivacyPrecompiledContract;
Expand Down Expand Up @@ -836,7 +837,8 @@ public Runner build() {
besuPluginContext.getNamedPlugins(),
dataDir,
rpcEndpointServiceImpl,
transactionSimulator);
transactionSimulator,
besuController.getProtocolManager().ethContext().getScheduler());

jsonRpcHttpService =
Optional.of(
Expand Down Expand Up @@ -882,7 +884,8 @@ public Runner build() {
besuPluginContext.getNamedPlugins(),
dataDir,
rpcEndpointServiceImpl,
transactionSimulator);
transactionSimulator,
besuController.getProtocolManager().ethContext().getScheduler());

final Optional<AuthenticationService> authToUse =
engineJsonRpcConfiguration.get().isAuthenticationEnabled()
Expand Down Expand Up @@ -978,7 +981,8 @@ public Runner build() {
besuPluginContext.getNamedPlugins(),
dataDir,
rpcEndpointServiceImpl,
transactionSimulator);
transactionSimulator,
besuController.getProtocolManager().ethContext().getScheduler());

createLogsSubscriptionService(
context.getBlockchain(), subscriptionManager, privacyParameters, blockchainQueries);
Expand Down Expand Up @@ -1059,7 +1063,8 @@ public Runner build() {
besuPluginContext.getNamedPlugins(),
dataDir,
rpcEndpointServiceImpl,
transactionSimulator);
transactionSimulator,
besuController.getProtocolManager().ethContext().getScheduler());

jsonRpcIpcService =
Optional.of(
Expand Down Expand Up @@ -1099,7 +1104,8 @@ public Runner build() {
besuPluginContext.getNamedPlugins(),
dataDir,
rpcEndpointServiceImpl,
transactionSimulator);
transactionSimulator,
besuController.getProtocolManager().ethContext().getScheduler());
} else {
inProcessRpcMethods = Map.of();
}
Expand Down Expand Up @@ -1262,7 +1268,8 @@ private Map<String, JsonRpcMethod> jsonRpcMethods(
final Map<String, BesuPlugin> namedPlugins,
final Path dataDir,
final RpcEndpointServiceImpl rpcEndpointServiceImpl,
final TransactionSimulator transactionSimulator) {
final TransactionSimulator transactionSimulator,
final EthScheduler ethScheduler) {
// sync vertx for engine consensus API, to process requests in FIFO order;
final Vertx consensusEngineServer = Vertx.vertx(new VertxOptions().setWorkerPoolSize(1));

Expand Down Expand Up @@ -1300,7 +1307,8 @@ private Map<String, JsonRpcMethod> jsonRpcMethods(
consensusEngineServer,
apiConfiguration,
enodeDnsConfiguration,
transactionSimulator);
transactionSimulator,
ethScheduler);
methods.putAll(besuController.getAdditionalJsonRpcMethods(jsonRpcApis));

final var pluginMethods =
Expand Down
2 changes: 1 addition & 1 deletion besu/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Configuration level="WARN">
<Properties>
<Property name="root.log.level">${env:LOG_LEVEL:-INFO}</Property>
<Property name="root.log.logger">${env:LOGGER:-Console}</Property>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Configuration level="WARN">
<Properties>
<Property name="root.log.level">DEBUG</Property>
</Properties>
Expand Down
10 changes: 2 additions & 8 deletions datatypes/src/main/java/org/hyperledger/besu/datatypes/Hash.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,9 @@ public class Hash extends DelegatingBytes32 {
public static final Hash EMPTY = hash(Bytes.EMPTY);

/**
* Hash of empty requests or "0x6036c41849da9c076ed79654d434017387a88fb833c2856b32e18218b3341c5f"
* Hash of empty requests or "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
*/
public static final Hash EMPTY_REQUESTS_HASH =
Hash.wrap(
sha256(
Bytes.concatenate(
sha256(Bytes.of(RequestType.DEPOSIT.getSerializedType())),
sha256(Bytes.of(RequestType.WITHDRAWAL.getSerializedType())),
sha256(Bytes.of(RequestType.CONSOLIDATION.getSerializedType())))));
public static final Hash EMPTY_REQUESTS_HASH = Hash.wrap(sha256(Bytes.EMPTY));

/**
* Instantiates a new Hash.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,19 @@ public class StateOverride {
private final Optional<Long> nonce;
private final Optional<String> code;
private final Optional<Map<String, String>> stateDiff;
private final Optional<Address> movePrecompileToAddress;

private StateOverride(
final Optional<Wei> balance,
final Optional<Long> nonce,
final Optional<String> code,
final Optional<Map<String, String>> stateDiff) {
final Optional<Map<String, String>> stateDiff,
final Optional<Address> movePrecompileToAddress) {
this.balance = balance;
this.nonce = nonce;
this.code = code;
this.stateDiff = stateDiff;
this.movePrecompileToAddress = movePrecompileToAddress;
}

/**
Expand Down Expand Up @@ -84,13 +87,23 @@ public Optional<Map<String, String>> getStateDiff() {
return stateDiff;
}

/**
* Gets the new address for the pre-compiled contract
*
* @return the new address for the pre-compiled contract if present
*/
public Optional<Address> getMovePrecompileToAddress() {
return movePrecompileToAddress;
}

/** Builder class for Account overrides */
@JsonIgnoreProperties(ignoreUnknown = true)
public static class Builder {
private Optional<Wei> balance = Optional.empty();
private Optional<Long> nonce = Optional.empty();
private Optional<String> code = Optional.empty();
private Optional<Map<String, String>> stateDiff = Optional.empty();
private Optional<Address> movePrecompileToAddress = Optional.empty();

/** Default constructor. */
public Builder() {}
Expand Down Expand Up @@ -139,13 +152,24 @@ public Builder withStateDiff(final Map<String, String> stateDiff) {
return this;
}

/**
* Sets the new address for the pre-compiled contract
*
* @param newPrecompileAddress the new address for the pre-compile contract
* @return the builder
*/
public Builder withMovePrecompileToAddress(final Address newPrecompileAddress) {
this.movePrecompileToAddress = Optional.ofNullable(newPrecompileAddress);
return this;
}

/**
* build the account override from the builder
*
* @return account override
*/
public StateOverride build() {
return new StateOverride(balance, nonce, code, stateDiff);
return new StateOverride(balance, nonce, code, stateDiff, movePrecompileToAddress);
}
}

Expand Down Expand Up @@ -195,6 +219,8 @@ public String toString() {
+ code
+ ", stateDiff="
+ stateDiff
+ ", movePrecompileToAddress="
+ movePrecompileToAddress
+ '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public void shouldGetExpectedValueForEmptyHash() {
public void shouldGetExpectedValueForEmptyRequestsHash() {
assertThat(Hash.EMPTY_REQUESTS_HASH)
.isEqualTo(
Hash.fromHexString(
"0x6036c41849da9c076ed79654d434017387a88fb833c2856b32e18218b3341c5f"));
Hash.fromHexString("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright ConsenSys AG.
* Copyright contributors to Besu.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -51,6 +51,7 @@
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatService;
import org.hyperledger.besu.testutil.DeterministicEthScheduler;

import java.math.BigInteger;
import java.nio.file.Path;
Expand Down Expand Up @@ -228,6 +229,7 @@ public Map<String, JsonRpcMethod> methods() {
Vertx.vertx(new VertxOptions().setWorkerPoolSize(1)),
ImmutableApiConfiguration.builder().build(),
Optional.empty(),
transactionSimulator);
transactionSimulator,
new DeterministicEthScheduler());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright ConsenSys AG.
* Copyright contributors to Besu.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
Expand Down
Loading

0 comments on commit 1bb7624

Please sign in to comment.