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 serde feature - token-2022 #3291
Conversation
How about adding this to token-2022 instead, which should already be a superset of token |
@mvines thanks for the response, I'm not super familiar with token-2022, is that just the new version of token? As long as we can use it for indexing existing contracts that's fine on my side. |
It's the next iteration of the token program, source is at https://github.com/solana-labs/solana-program-library/tree/master/token/program-2022 From a client perspective, using the spl-token-2022 should be equivalent to using the spl-token crate as long as you don't opt in to the new token 2022 features. My request has three motivations:
|
e4b3299
to
dc53cf0
Compare
@mvines moved it to token-2022 as requested |
It'd be nice to add a step in CI to run the new serde-feature tests in this PR, somewhere in here: https://github.com/solana-labs/solana-program-library/blob/master/.github/workflows/pull-request-token.yml#L16 |
i might be mistaken, but the existing directive to "Build and test token" also recurses into the including the folder that the while i can't verify that the tests included in this PR will run successfully until the PR gets approved, just wanted to be sure we didn't miss anything—@mvines is there a different configuration you're expecting for this serialization test in particular that you want to be sure we run in CI? |
yeah, pretty sure these new tests wont be run by default because they're under the new |
run: | | ||
cargo +"$RUST_STABLE" test-bpf \ | ||
--manifest-path=token/program-2022/Cargo.toml \ | ||
--features serde,serde_with \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joncinque this looks suspicious—i had expected the serde-feature = ["serde", "serde_with"]
in Cargo.toml to handle enabling this optional dependency, but cargo
kept complaining to me whenever i omitted this feature. i have this here to make sure CI passes right now, but if you have some insight here that'd be useful!
I made a couple of little changes to get this to work on CI 🤞 , and some little cosmetic changes to make things clearer. Unfortunately, we can't use the same feature name as a crate until we start using Rust 1.60, so I went with the name Also, there was an annoying deprecation warning because of rust-lang/rust#87454, so I just did |
By the way, what do you think about implementing serde on all instructions the same way? It looks like only the mint initialization instructions are using the |
i think this makes sense! we had targeted just the instructions we were concerned with but shouldn't be a huge lift. looks like we probably only need to serialize the pubkeys; should this extend to all the extension instruction structs too? tactically, is there a way to validate this more efficiently or should we enumerate through all those instructions in the test to validate the serialization annotations? |
Yep that was my thought! We don't have to do it in this PR though. If you create an issue outlining the rest of the work, then we can merge this one 😄 |
b6265ab
to
661b5b0
Compare
I rebased, so this should be good to go on my side once it passes CI |
ready to go! outlined some of the information i know about in #3325 |
We would like to serialize TokenInstruction to json in order to have easier indexing, already implemented it for Metaplex token. This is still a draft I worked on with Lawrence Wu.
cc: @joncinque @CriesofCarrots @lwus