Skip to content

Commit

Permalink
Fix: eth_estimateGas error when providing gas field (#1741)
Browse files Browse the repository at this point in the history
Adding 'gas' field to formatting before relaying the call data to the mirror node
Signed-off-by: Alfredo Gutierrez <alfredo@swirldslabs.com>
Signed-off-by: ebadiere <ebadiere@gmail.com>
  • Loading branch information
AlfredoG87 authored and ebadiere committed Sep 20, 2023
1 parent 45043dc commit e1308dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/relay/src/lib/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,9 @@ export class EthImpl implements Eth {
if (transaction.gasPrice) {
transaction.gasPrice = parseInt(transaction.gasPrice);
}

if (transaction.gas) {
transaction.gas = parseInt(transaction.gas);
}
// Support either data or input. https://ethereum.github.io/execution-apis/api-documentation/ lists input but many EVM tools still use data.
if (transaction.input && transaction.data === undefined) {
transaction.data = transaction.input;
Expand Down
2 changes: 2 additions & 0 deletions packages/relay/tests/lib/eth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3782,11 +3782,13 @@ describe('Eth calls using MirrorNode', async function () {
data: '0x',
value: '0xA186B8E9800',
gasPrice: '0xF4240',
gas: '0xd97010',
};

ethImpl.contractCallFormat(transaction);
expect(transaction.value).to.eq(1110);
expect(transaction.gasPrice).to.eq(1000000);
expect(transaction.gas).to.eq(14250000);
});

describe('eth_gasPrice', async function () {
Expand Down

0 comments on commit e1308dd

Please sign in to comment.