Merge branch 'main' of github.com:hyperledger/besu into TransactionValidatorService

TransactionValidatorService
Stefan 1 year ago
commit 8dd80a781a
  1. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java
  2. 28
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/BlockParameterTest.java
  3. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ParentBeaconBlockRootHelper.java

@ -82,9 +82,9 @@ public class EthGetBlockByNumberTest {
blockchain.appendBlock(block, receipts);
}
BlockHeader lastestHeader = blockchain.getChainHeadBlock().getHeader();
BlockHeader latestHeader = blockchain.getChainHeadBlock().getHeader();
when(worldStateArchive.isWorldStateAvailable(
lastestHeader.getStateRoot(), lastestHeader.getHash()))
latestHeader.getStateRoot(), latestHeader.getHash()))
.thenReturn(Boolean.TRUE);
blockchainQueries = spy(new BlockchainQueries(blockchain, worldStateArchive));

@ -114,6 +114,34 @@ public class BlockParameterTest {
assertThat(blockParameter.isSafe()).isFalse();
}
@Test
public void numberStringShouldReturnLongNumberValue() {
final BlockParameter blockParameter = new BlockParameter("55");
assertThat(blockParameter.getNumber()).isPresent();
assertThat(blockParameter.getNumber().get()).isEqualTo(55L);
assertThat(blockParameter.isNumeric()).isTrue();
assertThat(blockParameter.isEarliest()).isFalse();
assertThat(blockParameter.isFinalized()).isFalse();
assertThat(blockParameter.isLatest()).isFalse();
assertThat(blockParameter.isPending()).isFalse();
assertThat(blockParameter.isSafe()).isFalse();
}
@Test
public void hexShouldReturnLongNumberValue() {
final BlockParameter blockParameter = new BlockParameter("0x55");
assertThat(blockParameter.getNumber()).isPresent();
assertThat(blockParameter.getNumber().get()).isEqualTo(85L);
assertThat(blockParameter.isNumeric()).isTrue();
assertThat(blockParameter.isEarliest()).isFalse();
assertThat(blockParameter.isFinalized()).isFalse();
assertThat(blockParameter.isLatest()).isFalse();
assertThat(blockParameter.isPending()).isFalse();
assertThat(blockParameter.isSafe()).isFalse();
}
@Test
public void upperCaseStringShouldBeHandled() {
final BlockParameter blockParameter = new BlockParameter("LATEST");

@ -24,10 +24,10 @@ import org.apache.tuweni.units.bigints.UInt256;
/** A helper class to store the parent beacon block root. */
public interface ParentBeaconBlockRootHelper {
// Modulus use to for the timestamp to store the root
// Modulus to use for the timestamp to store the root
public static final long HISTORICAL_ROOTS_MODULUS = 8191;
public static final Address BEACON_ROOTS_ADDRESS =
Address.fromHexString("0xBEaC020001c6C8B69E5257f4754e46e25f5dc9cB");
Address.fromHexString("0xbEAC020008aFF7331c0A389CB2AAb67597567d7a");
static void storeParentBeaconBlockRoot(
final WorldUpdater worldUpdater, final long timestamp, final Bytes32 root) {

Loading…
Cancel
Save