diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java index 2d3390e7f30..8eafb35f730 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java @@ -82,9 +82,9 @@ public void setUp() { 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)); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/BlockParameterTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/BlockParameterTest.java index 3e8d534e70f..015a217bc28 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/BlockParameterTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/BlockParameterTest.java @@ -114,6 +114,34 @@ public void longShouldReturnLongNumberValue() { 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");