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

Add coin gecko pro API usage for the governor #4025

Merged
merged 13 commits into from
Dec 12, 2024
Merged

Add coin gecko pro API usage for the governor #4025

merged 13 commits into from
Dec 12, 2024

Conversation

mdulin2
Copy link
Contributor

@mdulin2 mdulin2 commented Jul 18, 2024

In case the Guardians want to use API keys for Coin Gecko, support for the API keys has been added. This changes code in the Guardian and adds a command line flag.

Testing this is difficult because we don't want to include a key in here. Prior to this, I don't think we had tests for the query success from CoinGecko anyway. So, I added tests that make requests to coin gecko using the standard and pro APIs. If the API key isn't specified in the test file, the test is just skipped. If there's a better way to do this or relying on external APIs for builds to succeed is bad practice, then please say something and I'm happy to make changes accordingly.

@mdulin2
Copy link
Contributor Author

mdulin2 commented Jul 18, 2024

Failing tests have been fixed. I'm unsure why tilt is failing though.

@mdulin2
Copy link
Contributor Author

mdulin2 commented Jul 18, 2024

Once John's changes for cancel flow are approved at #4016 I'll have to fix a few locations since it touches similar code.

Copy link
Collaborator

@djb15 djb15 left a comment

Choose a reason for hiding this comment

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

Not sure if this is the best way to do it, but for the Pro API test we could load a string from an environment variable? That way we could add a key as a secret in GitHub and load it in the Action

node/cmd/guardiand/node.go Outdated Show resolved Hide resolved
node/pkg/governor/governor.go Outdated Show resolved Hide resolved
bruce-riley
bruce-riley previously approved these changes Jul 19, 2024
node/pkg/governor/governor_prices.go Outdated Show resolved Hide resolved
node/pkg/governor/governor_test.go Outdated Show resolved Hide resolved
node/pkg/governor/governor_test.go Outdated Show resolved Hide resolved
@mdulin2
Copy link
Contributor Author

mdulin2 commented Jul 19, 2024

Not sure if this is the best way to do it, but for the Pro API test we could load a string from an environment variable? That way we could add a key as a secret in GitHub and load it in the Action

Good thought! I wasn't sure if testing this small feature was worth the pain of doing something like that. What do you think?

Also, it depends on whether we can even connect to the Internet during our tests.

node/pkg/governor/governor_prices.go Outdated Show resolved Hide resolved
node/pkg/node/options.go Show resolved Hide resolved
@evan-gray
Copy link
Contributor

Not sure if this is the best way to do it, but for the Pro API test we could load a string from an environment variable? That way we could add a key as a secret in GitHub and load it in the Action

@djb15 - I saw this comment and wanted to note that I don’t believe secrets for this repo would be available to PRs from forks, so I would not rely on that approach. https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#using-secrets-in-a-workflow

It may be better to simply give reviewers a “hack” script or the like to prove the updated fetching logic does indeed work with and without an API key and have the unit tests ensure that URL is formatted appropriately.

@djb15
Copy link
Collaborator

djb15 commented Jul 30, 2024

@djb15 - I saw this comment and wanted to note that I don’t believe secrets for this repo would be available to PRs from forks, so I would not rely on that approach. https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#using-secrets-in-a-workflow

It may be better to simply give reviewers a “hack” script or the like to prove the updated fetching logic does indeed work with and without an API key and have the unit tests ensure that URL is formatted appropriately.

Ah thanks, yeah that's not an option then. Anyhow I think the approach we're going for with this now is to avoid adding an internet dependency here in these unit tests: #4025 (comment)

@evan-gray evan-gray marked this pull request as draft July 30, 2024 18:04
@evan-gray
Copy link
Contributor

converting to draft while this has conflicts

@mdulin2 mdulin2 marked this pull request as ready for review August 2, 2024 18:04
@mdulin2
Copy link
Contributor Author

mdulin2 commented Aug 2, 2024

I accidentally added a test CoinGecko API key in the last commit. I deleted the key from the PR and revoked the key from my coin gecko account.

djb15
djb15 previously approved these changes Aug 6, 2024
node/pkg/governor/governor_prices.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@SEJeff SEJeff left a comment

Choose a reason for hiding this comment

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

Nice

@djb15 djb15 merged commit 0be4486 into main Dec 12, 2024
24 checks passed
@djb15 djb15 deleted the coin_gecko_pro branch December 12, 2024 14:55
kakucodes pushed a commit that referenced this pull request Dec 18, 2024
cosmwasm(cw_wormhole): integration tests- initial implementation

chore: adding additional vaa parsing tests

cosmwasm: added cw_wormhole integration tests and some code cleanup

cosmwasm: reverted contract changes

Update 0012_ibc_generic_messaging.md with permissionless channel creation information (#4167)

The `wormhole-ibc-receiver` contract contains an allowlist of Wormhole chain ID to channel mappings (other side of Cosmos chain). The allowlist is not used when receiving a packet because we don't want to handle the case of a token transfer failure on the other side. Instead, we just emit the message and ignore it in the IBC watcher. I am just updating the documentation to reflect this.

node: governor token list update

tilt: aptos multi-platform support

tilt: sui multi-platform support

tilt: node multi-platform support

tilt: solana-test-validator multi-platform support

tilt: smaller sui image

Add coin gecko pro API usage for the governor (#4025)

* Add coin gecko pro API usage for the governor

* Add in missing parameter for node test

* Fix missing parameter in publicrpcserver_test.go

* Add in NIT fixes

* Change CLI description

* Reorder error message so that the important part is not truncated in the logs

* Remove network test from unit test. Plan on creating a Github action cron action for this instead

* Remove unnecessary '&' from URL path

* Add in new parameters for gov from rebase

* Fix regression on query creation

* Add coin gecko pro API usage for the governor

* Add in NIT fixes

* Remove network test from unit test. Plan on creating a Github action cron action for this instead

---------

Co-authored-by: Maxwell Dulin <strikeout@maxwells-mbp.lan>
Co-authored-by: Maxwell Dulin <strikeout@Maxwells-MacBook-Pro.local>

node: add amazon kms and benchmark signers (#4168)

* add kms and benchmark signers

* include context during guardiansigner calls

* add error counters and address review comment

* address pr comments

* address pr comments

---------

Co-authored-by: pleasew8t <jason@asymmetric.re>

wormchain: add ibc_receiver_test and ict workflow (#4155)

Update CODEOWNERS (#4151)

sdk: worldchain mainnet SR entry. (#4188)

cosmwasm: refactored the to guardianAddress logic

wormchain: lower ict setup params to improve stability
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants