Skip to content

feat: change eth_maxPriorityFeePerGas to return UNSUPPORTED_METHOD #3697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions docs/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -653,17 +653,11 @@
},
{
"name": "eth_maxPriorityFeePerGas",
"summary": "Returns a fee per gas that is an estimate of how much you can pay as a priority fee, or 'tip', to get a transaction included in the current block.",
"summary": "Always returns UNSUPPORTED_METHOD error. Hedera doesn't have a concept of tipping nodes to promote any behavior",
"description": "![](https://raw.githubusercontent.com/hiero-ledger/hiero-json-rpc-relay/main/docs/images/http_label.png) ![](https://raw.githubusercontent.com/hiero-ledger/hiero-json-rpc-relay/main/docs/images/ws_label.png)",
"params": [],
"result": {
"name": "eth_maxPriorityFeePerGas result",
"schema": {
"description": "Always returns '0x0'. Hedera doesn't have a concept of tipping nodes to promote any behavior",
"title": "hex encoded unsigned integer",
"type": "string",
"pattern": "0x0"
}
"$ref": "#/components/schemas/unsupportedError"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/rpc-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Below is a table of provided methods.
| [eth_getUncleCountByBlockNumber](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getunclecountbyblocknumber) | `0x0` | N/A |
| [eth_getWork](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getwork) | `-32601` (Method not found) | N/A |
| [eth_hashrate](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_hashrate) | `0x0` | N/A |
| [eth_maxPriorityFeePerGas](https://docs.alchemy.com/reference/eth-maxpriorityfeepergas) | `0x0` | N/A |
| [eth_maxPriorityFeePerGas](https://docs.alchemy.com/reference/eth-maxpriorityfeepergas) | `-32601` (Method not found) | N/A |
| [eth_mining](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_mining) | `false` | N/A |
| [eth_newBlockFilter](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newblockfilter) | N/A | N/A |
| [eth_newFilter](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter) | N/A | N/A |
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export interface Eth {

hashrate(requestDetails: RequestDetails): Promise<string>;

maxPriorityFeePerGas(requestDetails: RequestDetails): Promise<string>;
maxPriorityFeePerGas(requestDetails: RequestDetails): JsonRpcError;

mining(requestDetails: RequestDetails): Promise<boolean>;

Expand Down
4 changes: 2 additions & 2 deletions packages/relay/src/lib/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3240,11 +3240,11 @@ export class EthImpl implements Eth {
*/
@rpcMethod
@rpcParamLayoutConfig(RPC_LAYOUT.REQUEST_DETAILS_ONLY)
async maxPriorityFeePerGas(requestDetails: RequestDetails): Promise<string> {
maxPriorityFeePerGas(requestDetails: RequestDetails): JsonRpcError {
if (this.logger.isLevelEnabled('trace')) {
this.logger.trace(`${requestDetails.formattedRequestId} maxPriorityFeePerGas()`);
}
return EthImpl.zeroHex;
return predefined.UNSUPPORTED_METHOD;
}

static isArrayNonEmpty(input: any): boolean {
Expand Down
5 changes: 4 additions & 1 deletion packages/relay/tests/lib/eth/eth_common.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ describe('@ethCommon', async function () {

it('should execute "eth_maxPriorityFeePerGas"', async function () {
const result = await relay.eth().maxPriorityFeePerGas(requestDetails);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like the await can be dropped

expect(result).to.eq('0x0');
expect(result).to.have.property('code');
expect(result.code).to.be.equal(-32601);
expect(result).to.have.property('message');
expect(result.message).to.be.equal('Unsupported JSON-RPC method');
});
});
});
6 changes: 6 additions & 0 deletions packages/relay/tests/lib/openrpc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,12 @@ describe('Open RPC Specification', function () {
validateResponseSchema(methodsResponseSchema.eth_hashrate, response);
});

it('should execute "eth_maxPriorityFeePerGas"', function () {
const response = ethImpl.maxPriorityFeePerGas(requestDetails);

validateResponseSchema(methodsResponseSchema.eth_maxPriorityFeePerGas, response);
});

it('should execute "eth_mining"', async function () {
const response = await ethImpl.mining(requestDetails);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
"response": "{\"result\":\"0x0\",\"jsonrpc\":\"2.0\",\"id\":\"test_id\"}"
},
"eth_maxPriorityFeePerGas": {
"request": "{\"id\":\"test_id\",\"jsonrpc\":\"2.0\",\"method\":\"eth_maxPriorityFeePerGas\"}",
"response": "{\"result\":\"0x0\",\"jsonrpc\":\"2.0\",\"id\":\"test_id\"}"
"status": 400,
"request": "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_maxPriorityFeePerGas\"}",
"response": "{\"jsonrpc\":\"2.0\",\"id\":1,\"error\":{\"code\":-32601}}"
},
"eth_mining": {
"request": "{\"id\":\"test_id\",\"jsonrpc\":\"2.0\",\"method\":\"eth_mining\",\"params\":[]}",
Expand Down
9 changes: 4 additions & 5 deletions packages/server/tests/acceptance/rpc_batch2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,6 @@ describe('@api-batch-2 RPC Server Acceptance Tests', function () {
const res = await relay.call(RelayCalls.ETH_ENDPOINTS.ETH_SYNCING, [], requestId);
expect(res).to.be.equal(false);
});

it('should execute "eth_maxPriorityFeePerGas"', async function () {
const res = await relay.call(RelayCalls.ETH_ENDPOINTS.ETH_MAX_PRIORITY_FEE_PER_GAS, [], requestId);
expect(res).to.be.equal('0x0');
});
});

describe('@release Unsupported RPC Endpoints', () => {
Expand Down Expand Up @@ -724,6 +719,10 @@ describe('@api-batch-2 RPC Server Acceptance Tests', function () {
await relay.callUnsupported(method, [], requestId);
}
});

it('should not support "eth_maxPriorityFeePerGas"', async function () {
await relay.callUnsupported(RelayCalls.ETH_ENDPOINTS.ETH_MAX_PRIORITY_FEE_PER_GAS, [], requestId);
});
});

describe('eth_getCode', () => {
Expand Down
19 changes: 11 additions & 8 deletions packages/server/tests/integration/server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,15 +475,18 @@ describe('RPC Server', function () {
});

it('should execute "eth_maxPriorityFeePerGas"', async function () {
const res = await testClient.post('/', {
id: '2',
jsonrpc: '2.0',
method: RelayCalls.ETH_ENDPOINTS.ETH_MAX_PRIORITY_FEE_PER_GAS,
params: [null],
});
try {
await testClient.post('/', {
id: '2',
jsonrpc: '2.0',
method: RelayCalls.ETH_ENDPOINTS.ETH_MAX_PRIORITY_FEE_PER_GAS,
params: [null],
});

BaseTest.defaultResponseChecks(res);
expect(res.data.result).to.be.equal('0x0');
Assertions.expectedError();
} catch (error: any) {
BaseTest.unsupportedJsonRpcMethodChecks(error.response);
}
});

// Test all engine methods
Expand Down
Loading