Skip to content

Commit 0dc6105

Browse files
authored
feat: remove ETH_CALL_CONSENSUS_SELECTORS env (#3902)
Signed-off-by: nikolay <[email protected]>
1 parent 642df65 commit 0dc6105

File tree

8 files changed

+3
-120
lines changed

8 files changed

+3
-120
lines changed

.env.http.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ OPERATOR_KEY_MAIN= # Operator private key used to sign transaction
3434
# ETH_CALL_CACHE_TTL=200 # Maximum time in ms to cache an eth_call response
3535
# ETH_CALL_DEFAULT_TO_CONSENSUS_NODE=false # If true, eth_call first queries consensus node instead of mirror
3636
# ETH_CALL_ACCEPTED_ERRORS=[] # List of acceptable error codes for eth_call requests for retry
37-
# ETH_CALL_CONSENSUS_SELECTORS=[] # Special transaction selectors always routed to Consensus node
3837

3938
# ========== FEE & GAS CONFIGURATION ==========
4039
# GAS_PRICE_TINY_BAR_BUFFER=10000000000 # Additional buffer for gas price fluctuations

charts/hedera-json-rpc-relay/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ config:
4444
# ETH_CALL_CACHE_TTL:
4545
# ETH_CALL_DEFAULT_TO_CONSENSUS_NODE:
4646
# ETH_CALL_ACCEPTED_ERRORS:
47-
# ETH_CALL_CONSENSUS_SELECTORS:
4847

4948
# ========== FEE & GAS CONFIGURATION ==========
5049
# GAS_PRICE_TINY_BAR_BUFFER:

docs/configuration.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ Unless you need to set a non-default value, it is recommended to only populate o
4141
| `ETH_BLOCK_NUMBER_CACHE_TTL_MS` | "1000" | Time in ms to cache response from mirror node |
4242
| `ETH_CALL_ACCEPTED_ERRORS` | "[]" | A list of acceptable error codes for eth_call requests. If an error code in this list is returned, the request will be retried. |
4343
| `ETH_CALL_CACHE_TTL` | "200" | Maximum time in ms to cache an eth_call response. |
44-
| `ETH_CALL_CONSENSUS_SELECTORS` | "[]" | A comma-separated list of special transaction selectors that should always be routed to the Consensus node. |
4544
| `ETH_CALL_DEFAULT_TO_CONSENSUS_NODE` | "false" | Flag to set if eth_call logic should first query the mirror node. |
4645
| `ETH_FEE_HISTORY_FIXED` | "true" | Flag to set if eth_feeHistory should return a fixed fee for the set of results. |
4746
| `ETH_GET_BALANCE_CACHE_TTL_MS` | "1000" | Time in ms to cache balance returned |

docs/rpc-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Below is a comprehensive table of all Ethereum JSON-RPC methods from the [Ethere
6868
| [eth_accounts](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts) | **Implemented** - Returns `[]` | N/A | Always returns empty array per Infura behavior |
6969
| [eth_blobBaseFee](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blobBaseFee) | **Implemented** - Returns `-32601` (Method not supported) | N/A | EIP-4844 blob transactions not supported |
7070
| [eth_blockNumber](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) | **Implemented** | Mirror Node | |
71-
| [eth_call](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_call) | **Implemented** | Mirror Node, Consensus Node (conditional) | Falls back to Consensus Node only if `ETH_CALL_DEFAULT_TO_CONSENSUS_NODE=true` or for special selectors in `ETH_CALL_CONSENSUS_SELECTORS` |
71+
| [eth_call](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_call) | **Implemented** | Mirror Node, Consensus Node (conditional) | Falls back to Consensus Node only if `ETH_CALL_DEFAULT_TO_CONSENSUS_NODE=true` |
7272
| [eth_chainId](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid) | **Implemented** | N/A | Returns configured chain ID from environment |
7373
| [eth_coinbase](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_coinbase) | **Implemented** - Returns `-32601` (Method not supported) | N/A | Fixed zero address as Hedera has no traditional coinbase |
7474
| [eth_createAccessList](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_createaccesslist) | **Not Implemented** - Returns `-32601` (Method not found) | N/A | |

packages/config-service/src/services/globalConfig.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,6 @@ const _CONFIG = {
214214
required: false,
215215
defaultValue: 200,
216216
},
217-
ETH_CALL_CONSENSUS_SELECTORS: {
218-
envName: 'ETH_CALL_CONSENSUS_SELECTORS',
219-
type: 'strArray',
220-
required: false,
221-
defaultValue: [],
222-
},
223217
ETH_CALL_DEFAULT_TO_CONSENSUS_NODE: {
224218
envName: 'ETH_CALL_DEFAULT_TO_CONSENSUS_NODE',
225219
type: 'boolean',

packages/relay/src/lib/services/ethService/contractService/ContractService.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ export class ContractService implements IContractService {
806806
}
807807

808808
/**
809-
* Routes the call to either consensus or mirror node based on configuration and selector.
809+
* Routes the call to either consensus or mirror node based on configuration.
810810
*
811811
* @param {IContractCallRequest} call - The call request
812812
* @param {number | null} gas - The gas limit
@@ -821,17 +821,10 @@ export class ContractService implements IContractService {
821821
blockNumberOrTag: string | null,
822822
requestDetails: RequestDetails,
823823
): Promise<string | JsonRpcError> {
824-
const selector = getFunctionSelector(call.data || '0x');
825-
826-
// When eth_call is invoked with a selector listed in specialSelectors, it will be routed through the consensus node, regardless of ETH_CALL_DEFAULT_TO_CONSENSUS_NODE.
827-
// note: this feature is a workaround for when a feature is supported by consensus node but not yet by mirror node.
828-
const specialSelectors = ConfigService.get('ETH_CALL_CONSENSUS_SELECTORS');
829-
const shouldForceToConsensus = selector !== '' && specialSelectors.includes(selector);
830-
831824
// ETH_CALL_DEFAULT_TO_CONSENSUS_NODE = false enables the use of Mirror node
832825
const shouldDefaultToConsensus = ConfigService.get('ETH_CALL_DEFAULT_TO_CONSENSUS_NODE');
833826

834-
if (shouldForceToConsensus || shouldDefaultToConsensus) {
827+
if (shouldDefaultToConsensus) {
835828
return await this.callConsensusNode(call, gas, requestDetails);
836829
}
837830

packages/relay/tests/lib/eth/eth_call.spec.ts

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -898,56 +898,4 @@ describe('@ethCall Eth Call spec', async function () {
898898
expect(transaction.from).to.equal(operatorEvmAddress);
899899
});
900900
});
901-
902-
describe('eth_call using consensus node because of redirect by selector', async function () {
903-
const REDIRECTED_SELECTOR = '0x4d8fdd6d';
904-
const NON_REDIRECTED_SELECTOR = '0xaaaaaaaa';
905-
let callConsensusNodeSpy: sinon.SinonSpy;
906-
let callMirrorNodeSpy: sinon.SinonSpy;
907-
let sandbox: sinon.SinonSandbox;
908-
909-
overrideEnvsInMochaDescribe({
910-
ETH_CALL_DEFAULT_TO_CONSENSUS_NODE: false,
911-
ETH_CALL_CONSENSUS_SELECTORS: [REDIRECTED_SELECTOR.slice(2)],
912-
});
913-
914-
beforeEach(() => {
915-
sandbox = sinon.createSandbox();
916-
callConsensusNodeSpy = sandbox.spy(contractService, 'callConsensusNode');
917-
callMirrorNodeSpy = sandbox.spy(contractService, 'callMirrorNode');
918-
});
919-
920-
afterEach(() => {
921-
sandbox.restore();
922-
});
923-
924-
it('eth_call with matched selector redirects to consensus', async function () {
925-
await contractService.call(
926-
{
927-
to: ACCOUNT_ADDRESS_1,
928-
data: REDIRECTED_SELECTOR,
929-
},
930-
'latest',
931-
requestDetails,
932-
);
933-
934-
assert(callConsensusNodeSpy.calledOnce);
935-
assert(callMirrorNodeSpy.notCalled);
936-
});
937-
938-
it('eth_call with non-matched selector redirects to consensus', async function () {
939-
web3Mock.onPost('contracts/call').reply(200);
940-
await ethImpl.call(
941-
{
942-
to: ACCOUNT_ADDRESS_1,
943-
data: NON_REDIRECTED_SELECTOR,
944-
},
945-
'latest',
946-
requestDetails,
947-
);
948-
949-
assert(callConsensusNodeSpy.notCalled);
950-
assert(callMirrorNodeSpy.calledOnce);
951-
});
952-
});
953901
});

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

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -768,55 +768,6 @@ describe('@api-batch-3 RPC Server Acceptance Tests', function () {
768768
const res = await Utils.ethCallWRetries(relay, callData, 'latest', requestId);
769769
expect(res).to.eq(RESULT_TRUE);
770770
});
771-
772-
describe('eth_call with force-to-consensus-by-selector logic', () => {
773-
// context: The `IHRC719.isAssociated()` function is a new feature which is, at the moment, fully supported only by the Consensus node and not yet by the Mirror node.
774-
// Since `IHRC719.isAssociated()` is a view function, requests for this function are typically directed to the Mirror node by default.
775-
// This acceptance test ensures that the new force-to-consensus-by-selector logic correctly routes requests for `IHRC719.isAssociated()`
776-
// through the Consensus node rather than the Mirror node when using the `eth_call` endpoint.
777-
778-
let initialEthCallSelectorsAlwaysToConsensus: any, hrc719Contract: ethers.Contract;
779-
780-
before(async () => {
781-
initialEthCallSelectorsAlwaysToConsensus = ConfigService.get('ETH_CALL_CONSENSUS_SELECTORS');
782-
783-
hrc719Contract = await Utils.deployContract(
784-
HRC719ContractJson.abi,
785-
HRC719ContractJson.bytecode,
786-
accounts[0].wallet,
787-
);
788-
});
789-
790-
after(() => {
791-
ConfigServiceTestHelper.dynamicOverride(
792-
'ETH_CALL_CONSENSUS_SELECTORS',
793-
initialEthCallSelectorsAlwaysToConsensus,
794-
);
795-
});
796-
797-
it('should NOT allow eth_call to process IHRC719.isAssociated() method', async () => {
798-
const selectorsList = ConfigService.get('ETH_CALL_CONSENSUS_SELECTORS');
799-
expect(selectorsList.length).to.eq(0);
800-
801-
// If the selector for `isAssociated` is not included in `ETH_CALL_CONSENSUS_SELECTORS`, the request will fail with a `CALL_EXCEPTION` error code.
802-
await expect(hrc719Contract.isAssociated(tokenAddress)).to.eventually.be.rejected.and.have.property(
803-
'code',
804-
'CALL_EXCEPTION',
805-
);
806-
});
807-
808-
it('should allow eth_call to successfully process IHRC719.isAssociated() method', async () => {
809-
const isAssociatedSelector = (await hrc719Contract.isAssociated.populateTransaction(tokenAddress)).data.slice(
810-
2,
811-
10,
812-
);
813-
814-
// Add the selector for isAssociated to ETH_CALL_CONSENSUS_SELECTORS to ensure isAssociated() passes
815-
ConfigServiceTestHelper.dynamicOverride('ETH_CALL_CONSENSUS_SELECTORS', [isAssociatedSelector]);
816-
const isAssociatedResult = await hrc719Contract.isAssociated(tokenAddress);
817-
expect(isAssociatedResult).to.be.false; // associate status of the token with the caller
818-
});
819-
});
820771
});
821772

822773
describe('eth_getTransactionCount', async function () {

0 commit comments

Comments
 (0)