From 42cb251ada90f8a80e57c4577ce2a8510c661c65 Mon Sep 17 00:00:00 2001 From: Clayton Neal Date: Wed, 20 Nov 2024 08:09:49 +0000 Subject: [PATCH] issue: 1518 - rpc proxy return value for get uncles by block hash/number by index (#1522) * chore: 1518 * chore: 1518 update * fix: fix failing tests --------- Co-authored-by: Fabio Rigamonti <73019897+fabiorigam@users.noreply.github.com> --- .../eth_getUncleByBlockHashAndIndex.ts | 4 ++-- .../eth_getUncleByBlockNumberAndIndex.ts | 4 ++-- packages/network/src/provider/utils/rpc-mapper/rpc-mapper.ts | 4 ++-- .../eth_getUncleByBlockHashAndIndex.testnet.test.ts | 2 +- .../eth_getUncleByBlockNumberAndIndex.testnet.test.ts | 2 +- packages/rpc-proxy/tests/e2e_rpc_proxy.solo.test.ts | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.ts index 2c43f9629..e64cefef1 100644 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.ts +++ b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.ts @@ -19,7 +19,7 @@ import { ThorId } from '@vechain/sdk-core'; */ const ethGetUncleByBlockHashAndIndex = async ( params: unknown[] -): Promise => { +): Promise => { // Input validation if ( params.length !== 2 || @@ -33,7 +33,7 @@ const ethGetUncleByBlockHashAndIndex = async ( { params } ); - return await Promise.resolve({}); + return await Promise.resolve(null); }; export { ethGetUncleByBlockHashAndIndex }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.ts index 73c6599ea..32adfdd31 100644 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.ts +++ b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.ts @@ -19,7 +19,7 @@ import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; */ const ethGetUncleByBlockNumberAndIndex = async ( params: unknown[] -): Promise => { +): Promise => { // Input validation if ( params.length !== 2 || @@ -32,7 +32,7 @@ const ethGetUncleByBlockNumberAndIndex = async ( { params } ); - return await Promise.resolve({}); + return await Promise.resolve(null); }; export { ethGetUncleByBlockNumberAndIndex }; diff --git a/packages/network/src/provider/utils/rpc-mapper/rpc-mapper.ts b/packages/network/src/provider/utils/rpc-mapper/rpc-mapper.ts index 1a8acb8ab..209c0e3b2 100644 --- a/packages/network/src/provider/utils/rpc-mapper/rpc-mapper.ts +++ b/packages/network/src/provider/utils/rpc-mapper/rpc-mapper.ts @@ -281,13 +281,13 @@ const RPCMethodsMap = ( [RPC_METHODS.eth_getUncleByBlockHashAndIndex]: async ( params - ): Promise => { + ): Promise => { return await ethGetUncleByBlockHashAndIndex(params); }, [RPC_METHODS.eth_getUncleByBlockNumberAndIndex]: async ( params - ): Promise => { + ): Promise => { return await ethGetUncleByBlockNumberAndIndex(params); }, diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.testnet.test.ts index 2f7fef7f8..09cce02f2 100644 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.testnet.test.ts +++ b/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.testnet.test.ts @@ -41,7 +41,7 @@ describe('RPC Mapper - eth_getUncleByBlockHashAndIndex method tests', () => { '0x0' ]); - expect(uncleBlock).toStrictEqual({}); + expect(uncleBlock).toStrictEqual(null); }); }); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.testnet.test.ts index 9baf25fbe..4c33050b6 100644 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.testnet.test.ts +++ b/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.testnet.test.ts @@ -38,7 +38,7 @@ describe('RPC Mapper - eth_getUncleByBlockNumberAndIndex method tests', () => { RPC_METHODS.eth_getUncleByBlockNumberAndIndex ](['latest', '0x0']); - expect(uncleBlock).toStrictEqual({}); + expect(uncleBlock).toStrictEqual(null); }); }); diff --git a/packages/rpc-proxy/tests/e2e_rpc_proxy.solo.test.ts b/packages/rpc-proxy/tests/e2e_rpc_proxy.solo.test.ts index f64fab0a1..4ec540ee4 100644 --- a/packages/rpc-proxy/tests/e2e_rpc_proxy.solo.test.ts +++ b/packages/rpc-proxy/tests/e2e_rpc_proxy.solo.test.ts @@ -516,7 +516,7 @@ describe('RPC Proxy endpoints', () => { console.log(response.data); expect(response.data).toHaveProperty('result'); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toStrictEqual({}); + expect(response.data.result).toBeNull(); }); it('eth_getUncleByBlockNumberAndIndex method call', async () => { @@ -532,7 +532,7 @@ describe('RPC Proxy endpoints', () => { console.log(response.data); expect(response.data).toHaveProperty('result'); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toStrictEqual({}); + expect(response.data.result).toBeNull(); }); it('eth_requestAccounts method call', async () => {