diff --git a/packages/network/src/provider/providers/hardhat-provider/hardhat-provider.ts b/packages/network/src/provider/providers/hardhat-provider/hardhat-provider.ts index 8b004aee4..d1296d5b1 100644 --- a/packages/network/src/provider/providers/hardhat-provider/hardhat-provider.ts +++ b/packages/network/src/provider/providers/hardhat-provider/hardhat-provider.ts @@ -172,12 +172,6 @@ class HardhatVeChainProvider extends VeChainProvider { error ); } - - // Throw the error - throw this.buildHardhatErrorFunctionCallback( - `Error on request ${args.method}`, - error as Error - ); } } } diff --git a/packages/network/src/provider/utils/rpc-mapper/methods-map/methods/eth_getTransactionByBlockNumberAndIndex/eth_getTransactionByBlockNumberAndIndex.ts b/packages/network/src/provider/utils/rpc-mapper/methods-map/methods/eth_getTransactionByBlockNumberAndIndex/eth_getTransactionByBlockNumberAndIndex.ts index f866d4419..1ca70fe99 100644 --- a/packages/network/src/provider/utils/rpc-mapper/methods-map/methods/eth_getTransactionByBlockNumberAndIndex/eth_getTransactionByBlockNumberAndIndex.ts +++ b/packages/network/src/provider/utils/rpc-mapper/methods-map/methods/eth_getTransactionByBlockNumberAndIndex/eth_getTransactionByBlockNumberAndIndex.ts @@ -29,9 +29,9 @@ const ethGetTransactionByBlockNumberAndIndex = async ( typeof params[1] !== 'string' ) throw new JSONRPCInvalidParams( - 'eth_getTransactionByBlockHashAndIndex', + 'eth_getTransactionByBlockNumberAndIndex', -32602, - `Invalid input params for "eth_getTransactionByBlockHashAndIndex" method. See ${RPC_DOCUMENTATION_URL} for details.`, + `Invalid input params for "eth_getTransactionByBlockNumberAndIndex" method. See ${RPC_DOCUMENTATION_URL} for details.`, { params } ); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/fixture.ts index b4c724806..a9f3d178b 100644 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/fixture.ts +++ b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/fixture.ts @@ -67,6 +67,15 @@ const ethGetTransactionByBlockHashAndIndexTestCases = [ value: '0x0', yParity: '0x0' } + }, + { + description: + "eth_getTransactionByBlockHashAndIndex with a hash that doesn't exist", + params: [ + '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', + '0x0' + ], + expected: null } ]; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/fixture.ts index e02b5f0f1..666d32464 100644 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/fixture.ts +++ b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/fixture.ts @@ -1,5 +1,8 @@ import { HexInt } from '@vechain/sdk-core'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; +import { + JSONRPCInternalError, + JSONRPCInvalidParams +} from '@vechain/sdk-errors'; /** * Positive test cases for eth_getTransactionByBlockNumberAndIndex @@ -59,6 +62,11 @@ const ethGetTransactionByBlockNumberAndIndexTestCases = [ value: '0x0', yParity: '0x0' } + }, + { + description: 'eth_getTransactionByBlockHashAndIndex should return null', + params: [HexInt.of(0).toString(), '0x0'], + expected: null } ]; @@ -77,6 +85,14 @@ const invalidEthGetTransactionByBlockNumberAndIndexTestCases = [ description: 'Should throw an error when second param is not a strin', params: ['0x0', 0], expectedError: JSONRPCInvalidParams + }, + { + description: 'Should throw an error when first param is invalid', + params: [ + '0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35', + '0x0' + ], + expectedError: JSONRPCInternalError } ]; diff --git a/sonar-project.properties b/sonar-project.properties index 75f307101..4854e563f 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -7,7 +7,8 @@ sonar.test.inclusions=packages/**/tests/**/* sonar.javascript.lcov.reportPaths=coverage/**/lcov.info sonar.coverage.exclusions= \ packages/**/index.ts, \ - packages/**/jest*.js, + packages/**/jest*.js, \ + packages/network/tests/utils/subscriptions/fixture.ts sonar.cpd.exclusions= \ packages/core/**/const/abi.ts, \ packages/network/src/utils/const/thor-solo/thor-solo.ts, \