Skip to content

Commit 0583332

Browse files
authored
Fix: eth_estimateGas Errors when providing gas field (#1740)
Adding 'gas' field to formatting before relaying the call data to the mirror node Signed-off-by: Alfredo Gutierrez <[email protected]>
1 parent a69b179 commit 0583332

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/relay/src/lib/eth.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,9 @@ export class EthImpl implements Eth {
611611
if (transaction.gasPrice) {
612612
transaction.gasPrice = parseInt(transaction.gasPrice);
613613
}
614-
614+
if (transaction.gas) {
615+
transaction.gas = parseInt(transaction.gas);
616+
}
615617
// Support either data or input. https://ethereum.github.io/execution-apis/api-documentation/ lists input but many EVM tools still use data.
616618
if (transaction.input && transaction.data === undefined) {
617619
transaction.data = transaction.input;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3782,11 +3782,13 @@ describe('Eth calls using MirrorNode', async function () {
37823782
data: '0x',
37833783
value: '0xA186B8E9800',
37843784
gasPrice: '0xF4240',
3785+
gas: '0xd97010',
37853786
};
37863787

37873788
ethImpl.contractCallFormat(transaction);
37883789
expect(transaction.value).to.eq(1110);
37893790
expect(transaction.gasPrice).to.eq(1000000);
3791+
expect(transaction.gas).to.eq(14250000);
37903792
});
37913793

37923794
describe('eth_gasPrice', async function () {

0 commit comments

Comments
 (0)