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

[solana/cosmwasm/near] Rust tests refactor #1238

Merged
merged 41 commits into from
Jan 25, 2024
Merged

Conversation

guibescos
Copy link
Contributor

@guibescos guibescos commented Jan 23, 2024

I have the very ambitious project to "move up" a lot of the code that we use to generate accumulator updates in the Rust tests for the rust ecosystems (Cosmwasm, Near and Solana).

This PR is about deciding where this code should live.
I made a feature gen in pythnet-sdk that exposes the generator functions.
The reason why it's feature gated is that I use wormhole_sdk and I think it's good to be able to use pythnet-sdk without any wormhole dependencies.

Copy link

vercel bot commented Jan 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
example-oracle-amm ⬜️ Ignored (Inspect) Visit Preview Jan 25, 2024 6:16pm
xc-admin-frontend ⬜️ Ignored (Inspect) Visit Preview Jan 25, 2024 6:16pm

@guibescos guibescos changed the title Rust tests refactor [solana/cosmwasm/near] Rust tests refactor Jan 23, 2024
@guibescos guibescos marked this pull request as ready for review January 23, 2024 21:36
},
};

fn default_emitter_addr() -> [u8; 32] {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some examples of the functions that will live here.

Copy link
Contributor

@jayantk jayantk 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 idea of moving the code somewhere where it can be shared. I'm not sure whether it makes sense in this crate or not though, so I will let @ali-bahjati and @Reisen opine on that.

If they don't like this approach, I think another option would be to make a separate crate like pythnet-sdk-test-utils (?)

@ali-bahjati
Copy link
Collaborator

I definitely think this is a good change. Here are my thoughts:

I suggest changing the feature name and module to test-utils and keep functions that generate structs here and reuse them in rust ones and have a submodule called gen for fixture generation.

Then as a structural refactor I think it's better to rename the pythnet-sdk to accumulators-sdk and we can then move it to libs/accumulators-sdk/rust (from the repo root).

@guibescos guibescos force-pushed the rust-tests-refactor branch from fa963d7 to 94188ec Compare January 24, 2024 18:08
@guibescos guibescos changed the base branch from main to near-bump-wormhole January 24, 2024 18:08
@guibescos guibescos force-pushed the rust-tests-refactor branch from 94188ec to 559cec4 Compare January 24, 2024 21:53
@guibescos guibescos changed the base branch from near-bump-wormhole to main January 24, 2024 21:54
Copy link
Collaborator

@ali-bahjati ali-bahjati left a comment

Choose a reason for hiding this comment

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

It seems to have the near changes included. Perhaps we can remove them?

Apart from that it looks good to me as a good move and we can later do more structural changes (which I mentioned in the comments).

price: i64::MAX.into(),
conf: u64::MAX.into(),
price: i64::MAX,
conf: u64::MAX,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clippy did this

@guibescos guibescos merged commit 9697fad into main Jan 25, 2024
6 checks passed
@guibescos guibescos deleted the rust-tests-refactor branch January 25, 2024 18:25
@guibescos guibescos restored the rust-tests-refactor branch January 25, 2024 18:25
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.

3 participants