Skip to content

Commit 36d4325

Browse files
committed
Fixes EIP-150 1/64 estimation math
1 parent d11334d commit 36d4325

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

packages/airnode-node/src/evm/fulfillments/api-calls.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,8 @@ describe('submitApiCall', () => {
656656
{
657657
level: 'INFO',
658658
message: `Gas limit is set to ${
659-
73804 + 290001 + 5684
660-
} (AirnodeRrp: ${73804} + Fulfillment Call: ${290001} + EIP150: ${5684}) for Request:${apiCall.id}.`,
659+
73804 + 290001 + 5774
660+
} (AirnodeRrp: ${73804} + Fulfillment Call: ${290001} + EIP150: ${5774}) for Request:${apiCall.id}.`,
661661
},
662662
{ level: 'INFO', message: `Submitting API call fulfillment for Request:${apiCall.id}...` },
663663
]);
@@ -686,7 +686,7 @@ describe('submitApiCall', () => {
686686
apiCall.fulfillFunctionId,
687687
'0x448b8ad3a330cf8f269f487881b59efff721b3dfa8e61f7c8fd2480389459ed3',
688688
'0xda6d5aa27f48aa951ba401c8a779645f7d1fa4a46a5e99eb7da04b4e059449a834ca1058c85dfe8117305265228f8cf7ae64c3ef3c4d1cc191f77807227dac461b',
689-
{ ...txOpts, gasLimit: ethers.BigNumber.from(73804 + 290001 + 5684) }
689+
{ ...txOpts, gasLimit: ethers.BigNumber.from(73804 + 290001 + 5774) }
690690
);
691691
expect(failMock).not.toHaveBeenCalled();
692692
}
@@ -735,8 +735,8 @@ describe('submitApiCall', () => {
735735
{
736736
level: 'INFO',
737737
message: `Gas limit is set to ${
738-
73804 + 290001 + 5684
739-
} (AirnodeRrp: ${73804} + Fulfillment Call: ${290001} + EIP150: ${5684}) for Request:${apiCall.id}.`,
738+
73804 + 290001 + 5774
739+
} (AirnodeRrp: ${73804} + Fulfillment Call: ${290001} + EIP150: ${5774}) for Request:${apiCall.id}.`,
740740
},
741741
{ level: 'INFO', message: `Submitting API call fulfillment for Request:${apiCall.id}...` },
742742
{
@@ -768,7 +768,7 @@ describe('submitApiCall', () => {
768768
apiCall.fulfillFunctionId,
769769
'0x448b8ad3a330cf8f269f487881b59efff721b3dfa8e61f7c8fd2480389459ed3',
770770
'0xda6d5aa27f48aa951ba401c8a779645f7d1fa4a46a5e99eb7da04b4e059449a834ca1058c85dfe8117305265228f8cf7ae64c3ef3c4d1cc191f77807227dac461b',
771-
{ ...txOpts, gasLimit: ethers.BigNumber.from(73804 + 290001 + 5684) }
771+
{ ...txOpts, gasLimit: ethers.BigNumber.from(73804 + 290001 + 5774) }
772772
);
773773
expect(failMock).not.toHaveBeenCalled();
774774
}

packages/airnode-node/src/evm/fulfillments/api-calls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ export async function estimateGasAndSubmitFulfill(
319319
const subTotalCost = airnodeRrpGasCost.add(fulfillmentCallGasCost);
320320
// https://github.com/ethereum/EIPs/issues/114
321321
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-150.md
322-
const eip150GasReserve = subTotalCost.div(64);
322+
const eip150GasReserve = subTotalCost.div(63);
323323
const totalGasCost = subTotalCost.add(eip150GasReserve);
324324

325325
// If gas estimation is success, submit fulfillment without making static test call

0 commit comments

Comments
 (0)