You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cherry Pick Switch eth_call to Mirror-node (#1019)
Switch eth_call to Mirror Node (#1005)
- Refactor of eth_call with added condition for using only consensus node for calls or mirror node and fallback to consensus node.
- Helm charts set for different env.
- Fixes erc20 tests as some of the tests actions need more time propagated to the mirror node.
---------
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>
Co-authored-by: Ivo Yankov <[email protected]>
Copy file name to clipboardExpand all lines: docs/configuration.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ Unless you need to set a non-default value, it is recommended to only populate o
48
48
|`CONSENSUS_MAX_EXECUTION_TIME`| "15000" | Maximum time in ms the SDK will wait when submitting a transaction/query before throwing a TIMEOUT error. |
49
49
|`DEFAULT_RATE_LIMIT`| "200" | default fallback rate limit, if no other is configured. |
50
50
|`ETH_CALL_CACHE_TTL`| "200" | Maximum time in ms to cache an eth_call response. |
51
-
|`ETH_CALL_CONSENSUS`| "false" | Flag to set if eth_call logic should first query the mirror node. |
51
+
|`ETH_CALL_DEFAULT_TO_CONSENSUS_NODE `| "false" | Flag to set if eth_call logic should first query the mirror node. |
52
52
|`ETH_GET_LOGS_BLOCK_RANGE_LIMIT`| "1000" | The maximum block number range to consider during an eth_getLogs call. |
53
53
|`FEE_HISTORY_MAX_RESULTS`| "10" | The maximum number of results to returns as part of `eth_feeHistory`. |
54
54
|`GAS_PRICE_TINY_BAR_BUFFER`| "10000000000" | The additional buffer range to allow during a relay precheck of gas price. This supports slight fluctuations in network gasprice calculations. |
// Get a reasonable value for "gas" if it is not specified.
980
+
letgas=Number(call.gas)||400_000;
981
+
982
+
letvalue: string|null=null;
983
+
if(typeofcall.value==='string'){
984
+
value=(newBN(call.value)).toString();
993
985
}
994
986
987
+
// Gas limit for `eth_call` is 50_000_000, but the current Hedera network limit is 15_000_000
988
+
// With values over the gas limit, the call will fail with BUSY error so we cap it at 15_000_000
989
+
if(gas>constants.BLOCK_GAS_LIMIT){
990
+
this.logger.trace(`${requestIdPrefix} eth_call gas amount (${gas}) exceeds network limit, capping gas to ${constants.BLOCK_GAS_LIMIT}`);
991
+
gas=constants.BLOCK_GAS_LIMIT;
992
+
}
993
+
995
994
try{
996
-
// Get a reasonable value for "gas" if it is not specified.
997
-
letgas=Number(call.gas)||400_000;
998
-
999
-
letvalue: string|null=null;
1000
-
if(typeofcall.value==='string'){
1001
-
value=(newBN(call.value)).toString();
1002
-
}
1003
-
1004
-
// Gas limit for `eth_call` is 50_000_000, but the current Hedera network limit is 15_000_000
1005
-
// With values over the gas limit, the call will fail with BUSY error so we cap it at 15_000_000
1006
-
if(gas>constants.BLOCK_GAS_LIMIT){
1007
-
this.logger.trace(`${requestIdPrefix} eth_call gas amount (${gas}) exceeds network limit, capping gas to ${constants.BLOCK_GAS_LIMIT}`);
1008
-
gas=constants.BLOCK_GAS_LIMIT;
1009
-
}
1010
-
1011
-
// Execute the call and get the response
1012
-
this.logger.debug(`${requestIdPrefix} Making eth_call on contract ${call.to} with gas ${gas} and call data "${call.data}" from "${call.from}"`,call.to,gas,call.data,call.from);
1013
-
1014
-
// ETH_CALL_CONSENSUS = false enables the use of Mirror node
1015
-
if(process.env.ETH_CALL_CONSENSUS=='false'){
995
+
// ETH_CALL_DEFAULT_TO_CONSENSUS_NODE = false enables the use of Mirror node
this.logger.debug(`${requestIdPrefix} Making eth_call on contract ${call.to} with gas ${gas} and call data "${call.data}" from "${call.from}" using mirror-node.`,call.to,gas,call.data,call.from);
1019
1002
constcallData={
1020
1003
...call,
1021
1004
gas,
@@ -1029,7 +1012,36 @@ export class EthImpl implements Eth {
this.logger.debug(`${requestIdPrefix} Making eth_call on contract ${call.to} with gas ${gas} and call data "${call.data}" from "${call.from}" using consensus-node.`,call.to,gas,call.data,call.from);
0 commit comments