Skip to content

Commit

Permalink
Disable fast sync actions test (#9)
Browse files Browse the repository at this point in the history
* fixes syntax errors (hyperledger#8164)

Signed-off-by: jflo <[email protected]>

* Pectra testnet fork slots (hyperledger#8163)



* adds Prague slot times

Signed-off-by: jflo <[email protected]>

---------

Signed-off-by: jflo <[email protected]>

* Check if discovery service is running before `admin_addPeer` (hyperledger#8160)

Signed-off-by: Gabriel-Trintinalia <[email protected]>

* update eth_call error message (hyperledger#8129)

Signed-off-by: Karim Taam <[email protected]>

* Refactor the methods for getting mutable states in the WorldState provider (hyperledger#8113)

Refactor the methods for retrieving mutable states in the WorldState provider and make additional improvements to clean up the code.

---------

Signed-off-by: Karim Taam <[email protected]>

* Extend simulate transaction on pending block plugin API (hyperledger#8174)

Signed-off-by: Fabio Di Fabio <[email protected]>

* debug_traceBlock use existing block header instead of hash (hyperledger#8184)

This means you don't need to have the block already in the chain when you call debug_traceBlock with a block's RLP (you just need the parent).

Signed-off-by: Simon Dudley <[email protected]>

* fixes warning on sonar analysis (hyperledger#8193)

Signed-off-by: jflo <[email protected]>

* add spotless to PR checklist (hyperledger#8185)

Signed-off-by: Sally MacFarlane <[email protected]>

* Reuse constant INVALID_PARAMS_ERROR_CODE for RpcErrorType.java (hyperledger#8154)

Magic number "-32602" has been defined in the super interface, so reusing that constant value.

Signed-off-by: Andrew Cheng <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>

* Improve BLOCKHASH Short Circuit (hyperledger#8171)

* Improve BLOCKHASH Short Circuit
Signed-off-by: Danno Ferrin <[email protected]>
Co-authored-by: Justin Florentine <[email protected]>

* TransactionResult: add v for blob and pending tx (hyperledger#8196)

* add v for blob and pending tx

Signed-off-by: Sally MacFarlane <[email protected]>

* add v for blob and pending tx in tests

Signed-off-by: Sally MacFarlane <[email protected]>

* add v for blob tx in test

Signed-off-by: Sally MacFarlane <[email protected]>

---------

Signed-off-by: Sally MacFarlane <[email protected]>

* Prague t8n and referenceTests fixes for EEST (hyperledger#8167)

Fix referenceTests bug with fallback EMPTY Address.
T8n support for excessBlobGas for both state tests and blockchain test. State tests should use the given excessBlobGas rather than computing from the parent header.

Signed-off-by: Simon Dudley <[email protected]>

* disable fast sync actions test

Signed-off-by: Sally MacFarlane <[email protected]>

---------

Signed-off-by: jflo <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Fabio Di Fabio <[email protected]>
Signed-off-by: Simon Dudley <[email protected]>
Signed-off-by: Sally MacFarlane <[email protected]>
Signed-off-by: Andrew Cheng <[email protected]>
Co-authored-by: Justin Florentine <[email protected]>
Co-authored-by: Gabriel-Trintinalia <[email protected]>
Co-authored-by: Karim Taam <[email protected]>
Co-authored-by: Fabio Di Fabio <[email protected]>
Co-authored-by: Simon Dudley <[email protected]>
Co-authored-by: Andrew Cheng <[email protected]>
Co-authored-by: Danno Ferrin <[email protected]>
  • Loading branch information
8 people authored Feb 4, 2025
1 parent be33889 commit 954828e
Show file tree
Hide file tree
Showing 154 changed files with 1,241 additions and 635 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

### Locally, you can run these tests to catch failures early:

- [ ] spotless: `./gradlew spotlessApply`
- [ ] unit tests: `./gradlew build`
- [ ] acceptance tests: `./gradlew acceptanceTest`
- [ ] integration tests: `./gradlew integrationTest`
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up Java
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/verify_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def create_artifact_paths(version):
# besu/internal/config
f"{artifacts_base_path}/internal/config/{version}/config-{version}.module",
f"{artifacts_base_path}/internal/config/{version}/config-{version}.pom",
f"{artifacts_base_path}/internal/config/{version}/config-{version}.jar"
f"{artifacts_base_path}/internal/config/{version}/config-{version}.jar",
# bom
f"{artifacts_base_path}/bom/{version}/bom-{version}.module",
f"{artifacts_base_path}/bom/{version}/bom-{version}.pom",
Expand All @@ -42,11 +42,11 @@ def check_url(url):

def main():
parser = argparse.ArgumentParser(description='Check besu artifacts')
parser.add_argument('--besu_{version}', action="store", dest='besu_{version}', default="")
parser.add_argument('--besu_version', action="store", dest='besu_version', default="")
args = parser.parse_args()
print(args.besu_{version})
print(args.besu_version)

artifacts = create_artifact_paths(args.besu_{version})
artifacts = create_artifact_paths(args.besu_version)
print(artifacts)
for url in artifacts:
check_url(url)
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Changelog

## Unreleased
### Breaking Changes
### Upcoming Breaking Changes
### Additions and Improvements
- Adds timestamps to enable Prague hardfork on Sepolia and Holesky test networks. [#8163](https://github.com/hyperledger/besu/pull/8163)
- Extend simulate transaction on pending block plugin API [#8174](https://github.com/hyperledger/besu/pull/8174)

### Bug fixes


## 25.1.0

### Breaking Changes
- `--host-whitelist` has been deprecated since 2020 and this option is removed. Use the equivalent `--host-allowlist` instead.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void startNode(final BesuNode node) {
.vertx(Vertx.vertx())
.besuController(besuController)
.ethNetworkConfig(ethNetworkConfig)
.discovery(node.isDiscoveryEnabled())
.discoveryEnabled(node.isDiscoveryEnabled())
.p2pAdvertisedHost(node.getHostName())
.p2pListenPort(0)
.networkingConfiguration(node.getNetworkingConfiguration())
Expand Down

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public class RunnerBuilder {
private NetworkingConfiguration networkingConfiguration = NetworkingConfiguration.create();
private final Collection<Bytes> bannedNodeIds = new ArrayList<>();
private boolean p2pEnabled = true;
private boolean discovery;
private boolean discoveryEnabled;
private String p2pAdvertisedHost;
private String p2pListenInterface = NetworkUtility.INADDR_ANY;
private int p2pListenPort;
Expand Down Expand Up @@ -237,11 +237,11 @@ public RunnerBuilder p2pEnabled(final boolean p2pEnabled) {
/**
* Enable Discovery.
*
* @param discovery the discovery
* @param discoveryEnabled the discoveryEnabled
* @return the runner builder
*/
public RunnerBuilder discovery(final boolean discovery) {
this.discovery = discovery;
public RunnerBuilder discoveryEnabled(final boolean discoveryEnabled) {
this.discoveryEnabled = discoveryEnabled;
return this;
}

Expand Down Expand Up @@ -618,7 +618,7 @@ public Runner build() {
.setBindHost(p2pListenInterface)
.setBindPort(p2pListenPort)
.setAdvertisedHost(p2pAdvertisedHost);
if (discovery) {
if (discoveryEnabled) {
final List<EnodeURL> bootstrap;
if (ethNetworkConfig.bootNodes() == null) {
bootstrap = EthNetworkConfig.getNetworkConfig(NetworkName.MAINNET).bootNodes();
Expand All @@ -636,7 +636,7 @@ public Runner build() {
discoveryConfiguration.setFilterOnEnrForkId(
networkingConfiguration.getDiscovery().isFilterOnEnrForkIdEnabled());
} else {
discoveryConfiguration.setActive(false);
discoveryConfiguration.setEnabled(false);
}

final NodeKey nodeKey = besuController.getNodeKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2238,7 +2238,7 @@ private Runner synchronize(
.natMethod(natMethod)
.natManagerServiceName(unstableNatOptions.getNatManagerServiceName())
.natMethodFallbackEnabled(unstableNatOptions.getNatMethodFallbackEnabled())
.discovery(peerDiscoveryEnabled)
.discoveryEnabled(peerDiscoveryEnabled)
.ethNetworkConfig(ethNetworkConfig)
.permissioningConfiguration(permissioningConfiguration)
.p2pAdvertisedHost(p2pAdvertisedHost)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ public BesuController build() {
worldStateHealerSupplier::get);

if (maybeStoredGenesisBlockHash.isEmpty()) {
genesisState.writeStateTo(worldStateArchive.getMutable());
genesisState.writeStateTo(worldStateArchive.getWorldState());
}

transactionSimulator =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.hyperledger.besu.ethereum.transaction.BlockStateCall;
import org.hyperledger.besu.ethereum.transaction.CallParameter;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.ethereum.trie.diffbased.common.provider.WorldStateQueryParams;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.plugin.Unstable;
import org.hyperledger.besu.plugin.data.BlockOverrides;
Expand Down Expand Up @@ -135,8 +136,13 @@ private BlockHeader getBlockHeader(final long blockNumber) {
}

private MutableWorldState getWorldState(final BlockHeader header, final boolean isPersisting) {
final WorldStateQueryParams worldStateQueryParams =
WorldStateQueryParams.newBuilder()
.withBlockHeader(header)
.withShouldWorldStateUpdateHead(isPersisting)
.build();
return worldStateArchive
.getMutable(header, isPersisting)
.getWorldState(worldStateQueryParams)
.orElseThrow(
() ->
new IllegalArgumentException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
package org.hyperledger.besu.services;

import static org.hyperledger.besu.ethereum.trie.diffbased.common.provider.WorldStateQueryParams.withBlockHeaderAndUpdateNodeHead;

import org.hyperledger.besu.consensus.merge.MergeContext;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.ProtocolContext;
Expand All @@ -25,7 +27,7 @@
import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.storage.BonsaiWorldStateKeyValueStorage;
import org.hyperledger.besu.ethereum.trie.diffbased.common.DiffBasedWorldStateProvider;
import org.hyperledger.besu.ethereum.trie.diffbased.common.provider.DiffBasedWorldStateProvider;
import org.hyperledger.besu.ethereum.trie.diffbased.common.storage.DiffBasedWorldStateKeyValueStorage;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.plugin.data.BlockBody;
Expand Down Expand Up @@ -109,7 +111,9 @@ public boolean setHeadUnsafe(final BlockHeader blockHeader, final BlockBody bloc

final MutableBlockchain blockchain = protocolContext.getBlockchain();

if (worldStateArchive.flatMap(archive -> archive.getMutable(coreHeader, true)).isPresent()) {
if (worldStateArchive
.flatMap(archive -> archive.getWorldState(withBlockHeaderAndUpdateNodeHead(coreHeader)))
.isPresent()) {
if (coreHeader.getParentHash().equals(blockchain.getChainHeadHash())) {
LOG.atDebug()
.setMessage(
Expand Down Expand Up @@ -142,7 +146,7 @@ public void disableWorldStateTrie() {
// TODO maybe find a best way in the future to delete and disable trie
worldStateArchive.ifPresent(
archive -> {
archive.getDefaultWorldStateConfig().setTrieDisabled(true);
archive.getWorldStateSharedSpec().setTrieDisabled(true);
final DiffBasedWorldStateKeyValueStorage worldStateStorage =
archive.getWorldStateKeyValueStorage();
final Optional<Hash> worldStateBlockHash = worldStateStorage.getWorldStateBlockHash();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,23 @@
*/
package org.hyperledger.besu.services;

import static org.hyperledger.besu.ethereum.mainnet.TransactionValidationParams.transactionSimulator;
import static org.hyperledger.besu.ethereum.mainnet.TransactionValidationParams.transactionSimulatorAllowExceedingBalance;
import static org.hyperledger.besu.ethereum.mainnet.TransactionValidationParams.transactionSimulatorAllowExceedingBalanceAndFutureNonce;
import static org.hyperledger.besu.ethereum.mainnet.TransactionValidationParams.transactionSimulatorAllowFutureNonce;

import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.datatypes.StateOverrideMap;
import org.hyperledger.besu.datatypes.Transaction;
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.mainnet.TransactionValidationParams;
import org.hyperledger.besu.ethereum.mainnet.ValidationResult;
import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult;
import org.hyperledger.besu.ethereum.transaction.CallParameter;
import org.hyperledger.besu.ethereum.transaction.TransactionInvalidReason;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.evm.tracing.OperationTracer;
import org.hyperledger.besu.plugin.Unstable;
import org.hyperledger.besu.plugin.data.ProcessableBlockHeader;
import org.hyperledger.besu.plugin.data.TransactionSimulationResult;
import org.hyperledger.besu.plugin.services.TransactionSimulationService;

Expand All @@ -51,50 +56,67 @@ public void init(final Blockchain blockchain, final TransactionSimulator transac
this.transactionSimulator = transactionSimulator;
}

@Override
public ProcessableBlockHeader simulatePendingBlockHeader() {
return transactionSimulator.simulatePendingBlockHeader();
}

@Override
public Optional<TransactionSimulationResult> simulate(
final Transaction transaction,
final Optional<StateOverrideMap> maybeStateOverrides,
final Optional<Hash> maybeBlockHash,
final Hash blockHash,
final OperationTracer operationTracer,
final boolean isAllowExceedingBalance) {

final CallParameter callParameter = CallParameter.fromTransaction(transaction);

if (maybeBlockHash.isPresent()) {
final Hash blockHash = maybeBlockHash.get();
final var maybeBlockHeader =
blockchain.getBlockHeader(blockHash).or(() -> blockchain.getBlockHeaderSafe(blockHash));

final var maybeBlockHeader =
blockchain.getBlockHeader(blockHash).or(() -> blockchain.getBlockHeaderSafe(blockHash));
if (maybeBlockHeader.isEmpty()) {
return Optional.of(
new TransactionSimulationResult(
transaction,
TransactionProcessingResult.invalid(
ValidationResult.invalid(TransactionInvalidReason.BLOCK_NOT_FOUND))));
}

if (maybeBlockHeader.isEmpty()) {
return Optional.of(
new TransactionSimulationResult(
transaction,
TransactionProcessingResult.invalid(
ValidationResult.invalid(TransactionInvalidReason.BLOCK_NOT_FOUND))));
}
return transactionSimulator
.process(
callParameter,
isAllowExceedingBalance
? transactionSimulatorAllowExceedingBalance()
: transactionSimulator(),
operationTracer,
maybeBlockHeader.get())
.map(res -> new TransactionSimulationResult(transaction, res.result()));
}

return transactionSimulator
.process(
callParameter,
isAllowExceedingBalance
? TransactionValidationParams.transactionSimulatorAllowExceedingBalance()
: TransactionValidationParams.transactionSimulator(),
operationTracer,
maybeBlockHeader.get())
.map(res -> new TransactionSimulationResult(transaction, res.result()));
}
@Override
public Optional<TransactionSimulationResult> simulate(
final Transaction transaction,
final Optional<StateOverrideMap> maybeStateOverrides,
final ProcessableBlockHeader pendingBlockHeader,
final OperationTracer operationTracer,
final boolean isAllowExceedingBalance,
final boolean isAllowFutureNonce) {

final CallParameter callParameter = CallParameter.fromTransaction(transaction);

return transactionSimulator
.processOnPending(
callParameter,
maybeStateOverrides,
isAllowExceedingBalance
? TransactionValidationParams.transactionSimulatorAllowExceedingBalance()
: TransactionValidationParams.transactionSimulator(),
? isAllowFutureNonce
? transactionSimulatorAllowExceedingBalanceAndFutureNonce()
: transactionSimulatorAllowExceedingBalance()
: isAllowFutureNonce
? transactionSimulatorAllowFutureNonce()
: transactionSimulator(),
operationTracer,
transactionSimulator.simulatePendingBlockHeader())
(org.hyperledger.besu.ethereum.core.ProcessableBlockHeader) pendingBlockHeader)
.map(res -> new TransactionSimulationResult(transaction, res.result()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,18 @@ public static Collection<Object[]> parameters() {
new ForkId(Bytes.ofUnsignedInt(0xfe3366e7L), 1735371L),
new ForkId(Bytes.ofUnsignedInt(0xb96cbd13L), 1677557088L),
new ForkId(Bytes.ofUnsignedInt(0xf7f9bc08L), 1706655072L),
new ForkId(Bytes.ofUnsignedInt(0x88cf81d9L), 0L),
new ForkId(Bytes.ofUnsignedInt(0x88cf81d9L), 0L))
new ForkId(Bytes.ofUnsignedInt(0x88cf81d9L), 1739980128L),
new ForkId(Bytes.ofUnsignedInt(0xbafd09c3L), 0L),
new ForkId(Bytes.ofUnsignedInt(0xbafd09c3L), 0L))
},
new Object[] {
NetworkName.HOLESKY,
List.of(
new ForkId(Bytes.ofUnsignedInt(0xc61a6098L), 1696000704L),
new ForkId(Bytes.ofUnsignedInt(0xfd4f016bL), 1707305664L),
new ForkId(Bytes.ofUnsignedInt(0x9b192ad0L), 0L),
new ForkId(Bytes.ofUnsignedInt(0x9b192ad0L), 0L))
new ForkId(Bytes.ofUnsignedInt(0x9b192ad0L), 1739352768L),
new ForkId(Bytes.ofUnsignedInt(0xf818a0d6L), 0L),
new ForkId(Bytes.ofUnsignedInt(0xf818a0d6L), 0L))
},
new Object[] {
NetworkName.MAINNET,
Expand Down
12 changes: 6 additions & 6 deletions besu/src/test/java/org/hyperledger/besu/RunnerBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void enodeUrlShouldHaveAdvertisedHostWhenDiscoveryDisabled() {
.p2pListenPort(p2pListenPort)
.p2pAdvertisedHost(p2pAdvertisedHost)
.p2pEnabled(true)
.discovery(false)
.discoveryEnabled(false)
.besuController(besuController)
.ethNetworkConfig(mock(EthNetworkConfig.class))
.metricsSystem(mock(ObservableMetricsSystem.class))
Expand Down Expand Up @@ -196,7 +196,7 @@ public void movingAcrossProtocolSpecsUpdatesNodeRecord() {
when(protocolContext.getBlockchain()).thenReturn(inMemoryBlockchain);
final Runner runner =
new RunnerBuilder()
.discovery(true)
.discoveryEnabled(true)
.p2pListenInterface("0.0.0.0")
.p2pListenPort(p2pListenPort)
.p2pAdvertisedHost(p2pAdvertisedHost)
Expand Down Expand Up @@ -255,7 +255,7 @@ public void whenEngineApiAddedListensOnDefaultPort() {

final Runner runner =
new RunnerBuilder()
.discovery(true)
.discoveryEnabled(true)
.p2pListenInterface("0.0.0.0")
.p2pListenPort(30303)
.p2pAdvertisedHost("127.0.0.1")
Expand Down Expand Up @@ -299,7 +299,7 @@ public void whenEngineApiAddedWebSocketReadyOnSamePort() {

final Runner runner =
new RunnerBuilder()
.discovery(true)
.discoveryEnabled(true)
.p2pListenInterface("0.0.0.0")
.p2pListenPort(30303)
.p2pAdvertisedHost("127.0.0.1")
Expand Down Expand Up @@ -342,7 +342,7 @@ public void whenEngineApiAddedEthSubscribeAvailable() {

final Runner runner =
new RunnerBuilder()
.discovery(true)
.discoveryEnabled(true)
.p2pListenInterface("0.0.0.0")
.p2pListenPort(30303)
.p2pAdvertisedHost("127.0.0.1")
Expand Down Expand Up @@ -387,7 +387,7 @@ public void noEngineApiNoServiceForMethods() {

final Runner runner =
new RunnerBuilder()
.discovery(true)
.discoveryEnabled(true)
.p2pListenInterface("0.0.0.0")
.p2pListenPort(30303)
.p2pAdvertisedHost("127.0.0.1")
Expand Down
2 changes: 1 addition & 1 deletion besu/src/test/java/org/hyperledger/besu/RunnerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private void syncFromGenesis(
final RunnerBuilder runnerBuilder =
new RunnerBuilder()
.vertx(vertx)
.discovery(true)
.discoveryEnabled(true)
.p2pAdvertisedHost(listenHost)
.p2pListenPort(0)
.metricsSystem(noOpMetricsSystem)
Expand Down
Loading

0 comments on commit 954828e

Please sign in to comment.