Skip to content

Commit 559d975

Browse files
committed
chore: throw unsupport for eth_simulatev1
Signed-off-by: nikolay <[email protected]>
1 parent 3efdcad commit 559d975

File tree

7 files changed

+43
-0
lines changed

7 files changed

+43
-0
lines changed

packages/relay/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export interface Eth {
5656

5757
coinbase(): JsonRpcError;
5858

59+
simulateV1(): JsonRpcError;
60+
5961
blobBaseFee(): JsonRpcError;
6062

6163
estimateGas(

packages/relay/src/lib/config/methodConfiguration.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ export const methodConfiguration: MethodRateLimitConfiguration = {
3737
eth_coinbase: {
3838
total: tier2rateLimit,
3939
},
40+
eth_simulateV1: {
41+
total: tier2rateLimit,
42+
},
4043
eth_blobBaseFee: {
4144
total: tier2rateLimit,
4245
},

packages/relay/src/lib/eth.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,23 @@ export class EthImpl implements Eth {
641641
return predefined.UNSUPPORTED_METHOD;
642642
}
643643

644+
/**
645+
* Always returns UNSUPPORTED_METHOD error.
646+
*
647+
* @rpcMethod Exposed as eth_coinbase RPC endpoint
648+
* @rpcParamLayoutConfig decorated method parameter layout
649+
*
650+
* @returns An error indicating the method is not supported
651+
*/
652+
@rpcMethod
653+
@rpcParamLayoutConfig(RPC_LAYOUT.REQUEST_DETAILS_ONLY)
654+
simulateV1(): JsonRpcError {
655+
if (this.logger.isLevelEnabled('trace')) {
656+
this.logger.trace('simulateV1()');
657+
}
658+
return predefined.UNSUPPORTED_METHOD;
659+
}
660+
644661
/**
645662
* Always returns UNSUPPORTED_METHOD error.
646663
*

packages/relay/tests/lib/openrpc.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ describe('Open RPC Specification', function () {
506506

507507
const unsupportedMethods = {
508508
eth_coinbase: () => ns.eth.coinbase(),
509+
eth_simulateV1: () => ns.eth.simulateV1(),
509510
eth_blobBaseFee: () => ns.eth.blobBaseFee(),
510511
eth_getWork: () => ns.eth.getWork(),
511512
eth_newPendingTransactionFilter: () => ns.eth.newPendingTransactionFilter(),

packages/server/tests/acceptance/rpc_batch2.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,10 @@ describe('@api-batch-2 RPC Server Acceptance Tests', function () {
705705
await relay.callUnsupported(RelayCalls.ETH_ENDPOINTS.ETH_COINBASE, []);
706706
});
707707

708+
it('should not support "eth_simulateV1"', async function () {
709+
await relay.callUnsupported(RelayCalls.ETH_ENDPOINTS.ETH_SIMULATEV1, []);
710+
});
711+
708712
it('should not support "eth_blobBaseFee"', async function () {
709713
await relay.callUnsupported(RelayCalls.ETH_ENDPOINTS.ETH_BLOB_BASE_FEE, []);
710714
});

packages/server/tests/helpers/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const ETH_ENDPOINTS = {
1616
ETH_PROTOCOL_VERSION: 'eth_protocolVersion',
1717
ETH_SEND_TRANSACTION: 'eth_sendTransaction',
1818
ETH_COINBASE: 'eth_coinbase',
19+
ETH_SIMULATEV1: 'eth_simulateV1',
1920
ETH_BLOB_BASE_FEE: 'eth_blobBaseFee',
2021
ETH_GET_WORK: 'eth_getWork',
2122
ETH_SUBMIT_HASH_RATE: 'eth_submitHashrate',

packages/server/tests/integration/server.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,21 @@ describe('RPC Server', function () {
584584
}
585585
});
586586

587+
it('should execute "eth_simulateV1"', async function () {
588+
try {
589+
await testClient.post('/', {
590+
id: '2',
591+
jsonrpc: '2.0',
592+
method: RelayCalls.ETH_ENDPOINTS.ETH_SIMULATEV1,
593+
params: [null],
594+
});
595+
596+
Assertions.expectedError();
597+
} catch (error: any) {
598+
BaseTest.unsupportedJsonRpcMethodChecks(error.response);
599+
}
600+
});
601+
587602
it('should execute "eth_blobBaseFee"', async function () {
588603
try {
589604
await testClient.post('/', {

0 commit comments

Comments
 (0)