diff --git a/hive_integration/nodocker/engine/clmock.nim b/hive_integration/nodocker/engine/clmock.nim index eb969b72d..459368f3f 100644 --- a/hive_integration/nodocker/engine/clmock.nim +++ b/hive_integration/nodocker/engine/clmock.nim @@ -99,6 +99,9 @@ proc pickNextPayloadProducer(cl: CLMocker): bool = let lastBlockNumber = nRes.get if cl.latestHeadNumber != lastBlockNumber: + error "CLMocker: unexpected lastBlockNumber", + get = lastBlockNumber, + expect = cl.latestHeadNumber return false var header: common.BlockHeader diff --git a/hive_integration/nodocker/engine/engine_tests.nim b/hive_integration/nodocker/engine/engine_tests.nim index c2ffdf2f1..1a8fc0789 100644 --- a/hive_integration/nodocker/engine/engine_tests.nim +++ b/hive_integration/nodocker/engine/engine_tests.nim @@ -1215,9 +1215,11 @@ proc reorgBack(t: TestEnv): TestStatus = # It is only expected that the client does not produce an error and the CL Mocker is able to progress after the re-org let r = client.forkchoiceUpdatedV1(forkchoiceUpdatedBack) - r.isOk + if r.isErr: + error "failed to reorg back", msg = r.error + return false + return true )) - testCond r2 # Verify that the client is pointing to the latest payload sent diff --git a/nimbus/db/db_chain.nim b/nimbus/db/db_chain.nim index d9d012e06..a5cf6154f 100644 --- a/nimbus/db/db_chain.nim +++ b/nimbus/db/db_chain.nim @@ -101,6 +101,9 @@ proc getCanonicalHead*(self: BaseChainDB): BlockHeader = raise newException(CanonicalHeadNotFound, "No canonical head set for this chain") +proc getCanonicalHeaderHash*(self: BaseChainDB): Hash256 = + discard self.getHash(canonicalHeadHashKey(), result) + proc populateProgress*(self: BaseChainDB) = try: self.startingBlock = self.getCanonicalHead().blockNumber diff --git a/nimbus/rpc/p2p.nim b/nimbus/rpc/p2p.nim index 7f448a1c1..b9bee7b3f 100644 --- a/nimbus/rpc/p2p.nim +++ b/nimbus/rpc/p2p.nim @@ -108,17 +108,17 @@ proc setupEthRpc*(node: EthereumNode, ctx: EthContext, chain: BaseChainDB, txPoo balance = accDB.getBalance(address) result = encodeQuantity(balance) - server.rpc("eth_getStorageAt") do(data: EthAddressStr, quantity: HexQuantityStr, quantityTag: string) -> HexDataStr: + server.rpc("eth_getStorageAt") do(data: EthAddressStr, slot: HexDataStr, quantityTag: string) -> HexDataStr: ## Returns the value from a storage position at a given address. ## ## data: address of the storage. - ## quantity: integer of the position in the storage. + ## slot: integer of the position in the storage. ## quantityTag: integer block number, or the string "latest", "earliest" or "pending", see the default block parameter. ## Returns: the value at this storage position. let accDB = stateDBFromTag(quantityTag) address = data.toAddress - key = fromHex(UInt256, quantity.string) + key = fromHex(UInt256, slot.string) value = accDB.getStorage(address, key)[0] result = hexDataStr(value) diff --git a/tests/rpcclient/ethcallsigs.nim b/tests/rpcclient/ethcallsigs.nim index f881e7df6..b2271b513 100644 --- a/tests/rpcclient/ethcallsigs.nim +++ b/tests/rpcclient/ethcallsigs.nim @@ -27,7 +27,7 @@ proc eth_gasPrice(): HexQuantityStr proc eth_accounts(): seq[EthAddressStr] proc eth_blockNumber(): HexQuantityStr proc eth_getBalance(data: EthAddressStr, quantityTag: string): HexQuantityStr -proc eth_getStorageAt(data: EthAddressStr, quantity: HexQuantityStr, quantityTag: string): HexDataStr +proc eth_getStorageAt(data: EthAddressStr, slot: HexDataStr, quantityTag: string): HexDataStr proc eth_getTransactionCount(data: EthAddressStr, quantityTag: string): HexQuantityStr proc eth_getBlockTransactionCountByHash(data: Hash256): HexQuantityStr proc eth_getBlockTransactionCountByNumber(quantityTag: string): HexQuantityStr diff --git a/tests/test_rpc.nim b/tests/test_rpc.nim index 5f4d1f17a..c46c5cc8b 100644 --- a/tests/test_rpc.nim +++ b/tests/test_rpc.nim @@ -257,7 +257,7 @@ proc rpcMain*() = check c.string == "0x3635c9adc5dea00000" test "eth_getStorageAt": - let res = await client.eth_getStorageAt(ethAddressStr("0xfff33a3bd36abdbd412707b8e310d6011454a7ae"), hexQuantityStr "0x0", "0x0") + let res = await client.eth_getStorageAt(ethAddressStr("0xfff33a3bd36abdbd412707b8e310d6011454a7ae"), hexDataStr "0x00", "0x0") check hexDataStr(0.u256).string == res.string test "eth_getTransactionCount":