Skip to content

Commit

Permalink
Fixes EIP-150 1/64 estimation math
Browse files Browse the repository at this point in the history
  • Loading branch information
acenolaza committed Jun 24, 2024
1 parent d11334d commit 36d4325
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions packages/airnode-node/src/evm/fulfillments/api-calls.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,8 @@ describe('submitApiCall', () => {
{
level: 'INFO',
message: `Gas limit is set to ${
73804 + 290001 + 5684
} (AirnodeRrp: ${73804} + Fulfillment Call: ${290001} + EIP150: ${5684}) for Request:${apiCall.id}.`,
73804 + 290001 + 5774
} (AirnodeRrp: ${73804} + Fulfillment Call: ${290001} + EIP150: ${5774}) for Request:${apiCall.id}.`,
},
{ level: 'INFO', message: `Submitting API call fulfillment for Request:${apiCall.id}...` },
]);
Expand Down Expand Up @@ -686,7 +686,7 @@ describe('submitApiCall', () => {
apiCall.fulfillFunctionId,
'0x448b8ad3a330cf8f269f487881b59efff721b3dfa8e61f7c8fd2480389459ed3',
'0xda6d5aa27f48aa951ba401c8a779645f7d1fa4a46a5e99eb7da04b4e059449a834ca1058c85dfe8117305265228f8cf7ae64c3ef3c4d1cc191f77807227dac461b',
{ ...txOpts, gasLimit: ethers.BigNumber.from(73804 + 290001 + 5684) }
{ ...txOpts, gasLimit: ethers.BigNumber.from(73804 + 290001 + 5774) }
);
expect(failMock).not.toHaveBeenCalled();
}
Expand Down Expand Up @@ -735,8 +735,8 @@ describe('submitApiCall', () => {
{
level: 'INFO',
message: `Gas limit is set to ${
73804 + 290001 + 5684
} (AirnodeRrp: ${73804} + Fulfillment Call: ${290001} + EIP150: ${5684}) for Request:${apiCall.id}.`,
73804 + 290001 + 5774
} (AirnodeRrp: ${73804} + Fulfillment Call: ${290001} + EIP150: ${5774}) for Request:${apiCall.id}.`,
},
{ level: 'INFO', message: `Submitting API call fulfillment for Request:${apiCall.id}...` },
{
Expand Down Expand Up @@ -768,7 +768,7 @@ describe('submitApiCall', () => {
apiCall.fulfillFunctionId,
'0x448b8ad3a330cf8f269f487881b59efff721b3dfa8e61f7c8fd2480389459ed3',
'0xda6d5aa27f48aa951ba401c8a779645f7d1fa4a46a5e99eb7da04b4e059449a834ca1058c85dfe8117305265228f8cf7ae64c3ef3c4d1cc191f77807227dac461b',
{ ...txOpts, gasLimit: ethers.BigNumber.from(73804 + 290001 + 5684) }
{ ...txOpts, gasLimit: ethers.BigNumber.from(73804 + 290001 + 5774) }
);
expect(failMock).not.toHaveBeenCalled();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-node/src/evm/fulfillments/api-calls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export async function estimateGasAndSubmitFulfill(
const subTotalCost = airnodeRrpGasCost.add(fulfillmentCallGasCost);
// https://github.com/ethereum/EIPs/issues/114
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-150.md
const eip150GasReserve = subTotalCost.div(64);
const eip150GasReserve = subTotalCost.div(63);
const totalGasCost = subTotalCost.add(eip150GasReserve);

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

0 comments on commit 36d4325

Please sign in to comment.