Skip to content

Commit

Permalink
Merge branch 'hyperledger:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
MASDXI authored Mar 13, 2024
2 parents bc0c540 + e56a37d commit 9fa54e4
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 21 deletions.
13 changes: 8 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Breaking Changes
- RocksDB database metadata format has changed to be more expressive, the migration of an existing metadata file to the new format is automatic at startup. Before performing a downgrade to a previous version it is mandatory to revert to the original format using the subcommand `besu --data-path=/path/to/besu/datadir storage revert-metadata v2-to-v1`.
- PoA networks won't start with SNAP or CHECKPOINT sync (previously Besu would start with this config but quietly fail to sync, so it's now more obvious that it won't work) [#6625](https://github.com/hyperledger/besu/pull/6625)
- BFT networks won't start with SNAP or CHECKPOINT sync (previously Besu would start with this config but quietly fail to sync, so it's now more obvious that it won't work) [#6625](https://github.com/hyperledger/besu/pull/6625), [#6667](https://github.com/hyperledger/besu/pull/6667)

### Upcoming Breaking Changes

Expand All @@ -19,8 +19,6 @@
- Make layered txpool aware of minGasPrice and minPriorityFeePerGas dynamic options [#6611](https://github.com/hyperledger/besu/pull/6611)
- Update commons-compress to 1.26.0 [#6648](https://github.com/hyperledger/besu/pull/6648)
- Update Vert.x to 4.5.4 [#6666](https://github.com/hyperledger/besu/pull/6666)
- Add blob transaction support to `eth_call` [#6661](https://github.com/hyperledger/besu/pull/6661)
- Add blobs to `eth_feeHistory` [#6679](https://github.com/hyperledger/besu/pull/6679)
- Refactor and extend `TransactionPoolValidatorService` [#6636](https://github.com/hyperledger/besu/pull/6636)
- Transaction call object to accept both `input` and `data` field simultaneously if they are set to equal values [#6702](https://github.com/hyperledger/besu/pull/6702)

Expand All @@ -30,7 +28,7 @@

### Download Links

## 24.2.0-SNAPSHOT
## 24.3.0

### Breaking Changes
- SNAP - Snap sync is now the default for named networks [#6530](https://github.com/hyperledger/besu/pull/6530)
Expand All @@ -47,7 +45,7 @@
- Release docker images now provided at ghcr.io instead of dockerhub

### Deprecations
- X_SNAP and X_CHECKPOINT are marked for deprecation and will be removed in 24.4.0 in favor of SNAP and CHECKPOINT [#6405](https://github.com/hyperledger/besu/pull/6405)
- X_SNAP and X_CHECKPOINT are marked for deprecation and will be removed in 24.6.0 in favor of SNAP and CHECKPOINT [#6405](https://github.com/hyperledger/besu/pull/6405)
- `--Xp2p-peer-lower-bound` is deprecated. [#6501](https://github.com/hyperledger/besu/pull/6501)

### Upcoming Breaking Changes
Expand All @@ -74,6 +72,8 @@
- More accurate column size `storage rocksdb usage` subcommand [#6540](https://github.com/hyperledger/besu/pull/6540)
- Adds `storage rocksdb x-stats` subcommand [#6540](https://github.com/hyperledger/besu/pull/6540)
- New `eth_blobBaseFee`JSON-RPC method [#6581](https://github.com/hyperledger/besu/pull/6581)
- Add blob transaction support to `eth_call` [#6661](https://github.com/hyperledger/besu/pull/6661)
- Add blobs to `eth_feeHistory` [#6679](https://github.com/hyperledger/besu/pull/6679)
- Upgrade reference tests to version 13.1 [#6574](https://github.com/hyperledger/besu/pull/6574)
- Extend `BesuConfiguration` service [#6584](https://github.com/hyperledger/besu/pull/6584)
- Add `ethereum_min_gas_price` and `ethereum_min_priority_fee` metrics to track runtime values of `min-gas-price` and `min-priority-fee` [#6587](https://github.com/hyperledger/besu/pull/6587)
Expand All @@ -87,6 +87,9 @@
- Fix traces so that call gas costing in traces matches other clients traces [#6525](https://github.com/hyperledger/besu/pull/6525)

### Download Links
https://github.com/hyperledger/besu/releases/tag/24.3.0
https://github.com/hyperledger/besu/releases/download/24.3.0/besu-24.3.0.tar.gz / sha256 8037ce51bb5bb396d29717a812ea7ff577b0d6aa341d67d1e5b77cbc55b15f84
https://github.com/hyperledger/besu/releases/download/24.3.0/besu-24.3.0.zip / sha256 41ea2ca734a3b377f43ee178166b5b809827084789378dbbe4e5b52bbd8e0674

## 24.1.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public void setUp() throws Exception {
strictNode = besu.createArchiveNode("strictNode", configureNode((true)));
miningNode = besu.createMinerNode("strictMiningNode", configureNode((true)));
cluster.start(lenientNode, strictNode, miningNode);
// verify all nodes are done syncing so the tx pool will be enabled
lenientNode.verify(eth.syncingStatus(false));
strictNode.verify(eth.syncingStatus(false));
miningNode.verify(eth.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public void setUp() throws Exception {
accountOne = accounts.createAccount("account-one");
minerWebSocket = new WebSocket(vertx, minerNode.getConfiguration());
archiveWebSocket = new WebSocket(vertx, archiveNode.getConfiguration());
// verify all nodes are done syncing so the tx pool will be enabled
archiveNode.verify(eth.syncingStatus(false));
minerNode.verify(eth.syncingStatus(false));
}

@AfterEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,26 @@
*/
package org.hyperledger.besu.ethereum.chain;

import static org.hyperledger.besu.ethereum.chain.BadBlockReason.DESCENDS_FROM_BAD_BLOCK;
import static org.hyperledger.besu.ethereum.chain.BadBlockReason.SPEC_VALIDATION_FAILURE;

import org.hyperledger.besu.ethereum.core.Block;

import com.google.common.base.MoreObjects;

public class BadBlockCause {
public enum BadBlockReason {
// Standard spec-related validation failures
SPEC_VALIDATION_FAILURE,
// When an unexpected exception occurs during block processing
EXCEPTIONAL_BLOCK_PROCESSING,
// This block is bad because it descends from a bad block
DESCENDS_FROM_BAD_BLOCK,
}

private final BadBlockReason reason;
private final String description;

public static BadBlockCause fromBadAncestorBlock(final Block badAncestor) {
final String description =
String.format("Descends from bad block %s", badAncestor.toLogString());
return new BadBlockCause(BadBlockReason.DESCENDS_FROM_BAD_BLOCK, description);
return new BadBlockCause(DESCENDS_FROM_BAD_BLOCK, description);
}

public static BadBlockCause fromValidationFailure(final String failureMessage) {
return new BadBlockCause(BadBlockReason.SPEC_VALIDATION_FAILURE, failureMessage);
return new BadBlockCause(SPEC_VALIDATION_FAILURE, failureMessage);
}

private BadBlockCause(final BadBlockReason reason, final String description) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright Hyperledger Besu Contributors.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.chain;

public enum BadBlockReason {
// Standard spec-related validation failures
SPEC_VALIDATION_FAILURE,
// This block is bad because it descends from a bad block
DESCENDS_FROM_BAD_BLOCK,
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,20 @@ public CompletableFuture<Boolean> validatePeer(
}
final List<BlockHeader> headers = res.getResult();
if (headers.size() == 0) {
// If no headers are returned, fail
LOG.debug(
"Peer {} is invalid because required block ({}) is unavailable.",
ethPeer,
blockNumber);
return false;
if (blockIsRequired()) {
// If no headers are returned, fail
LOG.debug(
"Peer {} is invalid because required block ({}) is unavailable.",
ethPeer,
blockNumber);
return false;
} else {
LOG.debug(
"Peer {} deemed valid because unavailable block ({}) is not required.",
ethPeer,
blockNumber);
return true;
}
}
final BlockHeader header = headers.get(0);
return validateBlockHeader(ethPeer, header);
Expand All @@ -105,6 +113,10 @@ public boolean canBeValidated(final EthPeer ethPeer) {
return ethPeer.chainState().getEstimatedHeight() >= (blockNumber + chainHeightEstimationBuffer);
}

protected boolean blockIsRequired() {
return true;
}

@Override
public Duration nextValidationCheckTimeout(final EthPeer ethPeer) {
if (!ethPeer.chainState().hasEstimatedHeight()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,13 @@ boolean validateBlockHeader(final EthPeer ethPeer, final BlockHeader header) {
}
return validDaoBlock;
}

/**
* In order to support chain history pruning, clients do not need to have the dao fork block to be
* deemed valid.
*/
@Override
protected boolean blockIsRequired() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,28 @@ public void validatePeer_responsivePeerOnWrongSideOfFork() {
assertThat(result).isDone();
assertThat(result).isCompletedWithValue(false);
}

@Test
public void validatePeer_responsivePeerDoesNotHaveBlockWhenPastForkHeight() {
final EthProtocolManager ethProtocolManager = EthProtocolManagerTestUtil.create();
final long daoBlockNumber = 500;

final PeerValidator validator =
new DaoForkPeerValidator(
ProtocolScheduleFixture.MAINNET, new NoOpMetricsSystem(), daoBlockNumber, 0);

final RespondingEthPeer peer =
EthProtocolManagerTestUtil.createPeer(ethProtocolManager, daoBlockNumber);

final CompletableFuture<Boolean> result =
validator.validatePeer(ethProtocolManager.ethContext(), peer.getEthPeer());

assertThat(result).isNotDone();

// Respond to block header request with empty
peer.respond(RespondingEthPeer.emptyResponder());

assertThat(result).isDone();
assertThat(result).isCompletedWithValue(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,26 @@ public void validatePeer_responsivePeerWithBadRequiredBlock() {
assertThat(result).isDone();
assertThat(result).isCompletedWithValue(false);
}

@Test
public void validatePeer_responsivePeerDoesNotHaveBlockWhenPastForkHeight() {
final EthProtocolManager ethProtocolManager = EthProtocolManagerTestUtil.create();

final PeerValidator validator =
new RequiredBlocksPeerValidator(
ProtocolScheduleFixture.MAINNET, new NoOpMetricsSystem(), 1, Hash.ZERO);

final RespondingEthPeer peer = EthProtocolManagerTestUtil.createPeer(ethProtocolManager, 1);

final CompletableFuture<Boolean> result =
validator.validatePeer(ethProtocolManager.ethContext(), peer.getEthPeer());

assertThat(result).isNotDone();

// Respond to block header request with empty
peer.respond(RespondingEthPeer.emptyResponder());

assertThat(result).isDone();
assertThat(result).isCompletedWithValue(false);
}
}

0 comments on commit 9fa54e4

Please sign in to comment.