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

fix: populate default contract addresses when loading config #1814

Merged
merged 2 commits into from
Jun 27, 2023

Conversation

dcroote
Copy link
Contributor

@dcroote dcroote commented Jun 22, 2023

This PR closes #1809 by populating default contract address when a config file, which may omit contract addresses for which there is an existing deployment, is loaded via loadTrustedConfig. Rather than duplicate the code to populate default addresses, this code calls validating functions added to airnode-validator as part of #1755.

@dcroote dcroote requested a review from amarthadan June 22, 2023 05:57
@dcroote dcroote self-assigned this Jun 22, 2023
Copy link
Contributor

@amarthadan amarthadan left a comment

Choose a reason for hiding this comment

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

Haven't tested it but the code LGTM.

packages/airnode-node/src/config/index.ts Outdated Show resolved Hide resolved
packages/airnode-node/src/config/index.ts Outdated Show resolved Hide resolved
Comment on lines +19 to +22
delete invalidConfig.chains[0].contracts;
delete invalidConfig.chains[0].authorizers.crossChainRequesterAuthorizers[0].contracts;
delete invalidConfig.chains[0].authorizers.crossChainRequesterAuthorizersWithErc721[0].contracts;
delete invalidConfig.chains[0].authorizers.requesterAuthorizersWithErc721[0].RequesterAuthorizerWithErc721;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you populate those fields in the example config if you're then emptying them here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The authorizers that have been added to the config are objects with several fields- here I'm only deleting the optional contract field in each before then confirming via the test that the deployed address is added.

Co-authored-by: Michal Kimle <[email protected]>
@dcroote
Copy link
Contributor Author

dcroote commented Jun 27, 2023

I've tested this with the api3/airnode-client-dev:97e936799a4a7132c384731c7c78eb1035d125e5 image using the coingecko-cross-chain-authorizer integration and get a successful request fulfillment without the previous error Cannot read properties of undefined (reading 'AirnodeRrp')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default contract addresses are not present after validation
2 participants