Skip to content

Commit a6949d9

Browse files
committed
Revert "fix: throw COULD_NOT_SIMULATE_TRANSACTION for eth_gasPrice"
This reverts commit 2542efb.
1 parent 2542efb commit a6949d9

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import constants from '../../../constants';
1616
import { JsonRpcError, predefined } from '../../../errors/JsonRpcError';
1717
import { MirrorNodeClientError } from '../../../errors/MirrorNodeClientError';
1818
import { Log } from '../../../model';
19+
import { Precheck } from '../../../precheck';
1920
import { IContractCallRequest, IContractCallResponse, IGetLogsParams, RequestDetails } from '../../../types';
2021
import { CacheService } from '../../cacheService/cacheService';
2122
import { CommonService } from '../../ethService/ethCommonService/CommonService';
@@ -524,12 +525,14 @@ export class ContractService implements IContractService {
524525
}
525526

526527
if (e.isContractRevert()) {
527-
throw predefined.CONTRACT_REVERT(e.detail || e.message, e.data);
528-
} else if (e.statusCode === 400) {
529-
throw predefined.COULD_NOT_SIMULATE_TRANSACTION(e.detail || e.message);
528+
if (this.logger.isLevelEnabled('trace')) {
529+
this.logger.trace(
530+
`mirror node eth_call request encountered contract revert. message: ${e.message}, details: ${e.detail}, data: ${e.data}`,
531+
);
532+
}
533+
return predefined.CONTRACT_REVERT(e.detail || e.message, e.data);
530534
}
531-
532-
// for any other Mirror Node upstream server errors (429, 500, 502, 503, 504, etc.), preserve the original error and re-throw to the upper layer for further handling logic
535+
// for any other Mirror Node upstream server errors (429, 500, 502, 503, 504, etc.), preserve the original error and re-throw to the upper layer
533536
throw e;
534537
}
535538

packages/relay/src/lib/services/ethService/ethCommonService/CommonService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ export class CommonService implements ICommonService {
458458
}
459459
}
460460

461-
throw predefined.INTERNAL_ERROR('Failed to retrieve gas price from network fees');
461+
throw predefined.COULD_NOT_ESTIMATE_GAS_PRICE('Failed to retrieve gas price from network fees');
462462
}
463463

464464
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('@ethGasPrice Gas Price spec', async function () {
8484

8585
restMock.onGet(`network/fees`).reply(200, JSON.stringify(partialNetworkFees));
8686
await RelayAssertions.assertRejection(
87-
predefined.INTERNAL_ERROR('Failed to retrieve gas price from network fees'),
87+
predefined.COULD_NOT_ESTIMATE_GAS_PRICE('Failed to retrieve gas price from network fees'),
8888
ethImpl.gasPrice,
8989
true,
9090
ethImpl,
@@ -140,7 +140,7 @@ describe('@ethGasPrice Gas Price spec', async function () {
140140

141141
it('eth_gasPrice with no network fees records found', async function () {
142142
await RelayAssertions.assertRejection(
143-
predefined.INTERNAL_ERROR('Failed to retrieve gas price from network fees'),
143+
predefined.COULD_NOT_ESTIMATE_GAS_PRICE('Failed to retrieve gas price from network fees'),
144144
ethImpl.gasPrice,
145145
true,
146146
ethImpl,

packages/server/tests/acceptance/htsPrecompile/precompileCalls.spec.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -741,11 +741,7 @@ describe('@precompile-calls Tests for eth_call with HTS', async function () {
741741
data: CALLDATA_BALANCE_OF + NON_EXISTING_ACCOUNT.padStart(64, '0'),
742742
};
743743

744-
await relay.callFailing(
745-
Constants.ETH_ENDPOINTS.ETH_CALL,
746-
[callData, 'latest'],
747-
predefined.COULD_NOT_SIMULATE_TRANSACTION('Sender account not found.'),
748-
);
744+
await relay.callFailing(Constants.ETH_ENDPOINTS.ETH_CALL, [callData, 'latest'], predefined.CONTRACT_REVERT());
749745
});
750746

751747
it('Call to allowance method of an HTS token with non-existing owner account in call data returns error', async () => {

0 commit comments

Comments
 (0)