Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable gas estimation in airnode-examples local flow and E2E test #1836

Merged
merged 7 commits into from
Jul 21, 2023

Conversation

dcroote
Copy link
Contributor

@dcroote dcroote commented Jul 16, 2023

Closes #1692
Closes #1833

PR title mostly speaks for itself, with the key phrase being "local flow", see the description in #1833 for why.

I thought it best to solve both of these issues together rather than just hack a solution for the E2E test. The CI logs demonstrate that gas is being estimated (and therefore the contract is deployed) successfully:

[2023-07-16 20:14:03.109] DEBUG Attempting to estimate required gas to fulfill API call for Request:0xf1d0abf72e568ca563162db958e64075158eb416726dc355b28938daa9357c36... Coordinator-ID:a0a50a3cef98f2ae, Chain-ID:31337, Provider:exampleProvider, Endpoint-ID:0xfb87102cdabadf905321521ba0b3cbf74ad09c5d400ac2eccdbef8d6143e78c4, Sponsor-Address:0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
[2023-07-16 20:14:03.109] DEBUG Attempting to estimate AirnodeRrp overhead to fulfill API call for Request:0xf1d0abf72e568ca563162db958e64075158eb416726dc355b28938daa9357c36... Coordinator-ID:a0a50a3cef98f2ae, Chain-ID:31337, Provider:exampleProvider, Endpoint-ID:0xfb87102cdabadf905321521ba0b3cbf74ad09c5d400ac2eccdbef8d6143e78c4, Sponsor-Address:0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
[2023-07-16 20:14:03.109] DEBUG Attempting to estimate fulfillment call overhead to fulfill API call for Request:0xf1d0abf72e568ca563162db958e64075158eb416726dc355b28938daa9357c36... Coordinator-ID:a0a50a3cef98f2ae, Chain-ID:31337, Provider:exampleProvider, Endpoint-ID:0xfb87102cdabadf905321521ba0b3cbf74ad09c5d400ac2eccdbef8d6143e78c4, Sponsor-Address:0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
[2023-07-16 20:14:03.109] INFO Gas limit is set to 92785 (AirnodeRrp: 42043 + Fulfillment Call: 50742) for Request:0xf1d0abf72e568ca563162db958e64075158eb416726dc355b28938daa9357c36. Coordinator-ID:a0a50a3cef98f2ae, Chain-ID:31337, Provider:exampleProvider, Endpoint-ID:0xfb87102cdabadf905321521ba0b3cbf74ad09c5d400ac2eccdbef8d6143e78c4, Sponsor-Address:0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
[2023-07-16 20:14:03.109] INFO Submitting API call fulfillment for Request:0xf1d0abf72e568ca563162db958e64075158eb416726dc355b28938daa9357c36... Coordinator-ID:a0a50a3cef98f2ae, Chain-ID:31337, Provider:exampleProvider, Endpoint-ID:0xfb87102cdabadf905321521ba0b3cbf74ad09c5d400ac2eccdbef8d6143e78c4, Sponsor-Address:0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266

@dcroote dcroote self-assigned this Jul 16, 2023
@@ -181,7 +181,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({

const generateConfig = async (generateExampleFile = false) => {
const config = await createConfig(generateExampleFile);
generateConfigFile(__dirname, config, generateExampleFile);
await generateConfigFile(__dirname, config, generateExampleFile);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think await here is redundant because after this line function is ending.

Copy link
Contributor Author

@dcroote dcroote Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks much for this self-explanatory example. It makes me understand the behavior. 🙏🏼

Copy link
Contributor

@bdrhn9 bdrhn9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the implementation, it's good idea to incorporate estimating gas feature with airnode-examples.

Just for different perspective, I'd prefer to treat AirnodeRrpV0DryRun contract like we do for AirnodeRrpV0. So:

  • Firstly I'd implement the function similar to getExistingAirnodeRrpV0
  • Then I'd populate deployed AirnodeRrpV0DryRun address to .json file under packages/airnode-examples/deployments as in here by utilizing the function getExistingAirnodeRrpV0DryRun in first step
  • I'd create the function similar to getAirnodeRrpAddress
  • Then, I'll use the function getAirnodeRrpDryRunAddress here to populate chains[*].contracts.AirnodeRrpDryRun

@dcroote
Copy link
Contributor Author

dcroote commented Jul 21, 2023

@bdrhn9 - I very much appreciate your thoughts and code links, but I'd actually like to do the exact opposite 😅 What I mean is that I implemented the functions you're referring to before we defaulted to the API3 deployed AirnodeRrpV0 contract in Airnode. Now that we have that functionality I'd like to remove and refactor this airnode-examples code to leverage it. However, since we want to release Airnode v0.12, this code is working, and a refactor is not a high priority at the moment, I will merge this and create a separate issue for that.

@dcroote dcroote merged commit a2370e1 into master Jul 21, 2023
25 checks passed
@dcroote dcroote deleted the dcroote/issue1692 branch July 21, 2023 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants