-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[token22] Avoid the use of extend_from_slice
when appending instructions
#7489
[token22] Avoid the use of extend_from_slice
when appending instructions
#7489
Conversation
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.
This is relevant when building the token22 program for wasm target. The Instruction type implements Clone for non-wasm targets, but does not seem to implement it for wasm targets (https://github.com/anza-xyz/agave/blob/master/sdk/instruction/src/lib.rs#L108).
Bah, this looks like it was a bug introduced in anza-xyz/agave#1658 -- there's no reason we shouldn't derive those for the wasm build. I'll put a fix in there. In the meantime, this change looks good!
#### Problem As noticed in solana-labs/solana-program-library#7489, the wasm build for `Instruction` doesn't contain `Clone`. This is because we missed the derivations for the wasm version of `Instruction` in anza-xyz#1658. #### Summary of changes Looking back through that PR, I noticed that we only missed those additional derives on `Instruction`, so just fix those in `Instruction`. Since this is fixing a small regression for wasm builds, I think we should backport the change to v2.1.
#### Problem As noticed in solana-labs/solana-program-library#7489, the wasm build for `Instruction` doesn't contain `Clone`. This is because we missed the derivations for the wasm version of `Instruction` in #1658. #### Summary of changes Looking back through that PR, I noticed that we only missed those additional derives on `Instruction`, so just fix those in `Instruction`. Since this is fixing a small regression for wasm builds, I think we should backport the change to v2.1.
#### Problem As noticed in solana-labs/solana-program-library#7489, the wasm build for `Instruction` doesn't contain `Clone`. This is because we missed the derivations for the wasm version of `Instruction` in #1658. #### Summary of changes Looking back through that PR, I noticed that we only missed those additional derives on `Instruction`, so just fix those in `Instruction`. Since this is fixing a small regression for wasm builds, I think we should backport the change to v2.1. (cherry picked from commit d3bce9f)
… (#3610) instruction: Derive everything for wasm build (#3606) #### Problem As noticed in solana-labs/solana-program-library#7489, the wasm build for `Instruction` doesn't contain `Clone`. This is because we missed the derivations for the wasm version of `Instruction` in #1658. #### Summary of changes Looking back through that PR, I noticed that we only missed those additional derives on `Instruction`, so just fix those in `Instruction`. Since this is fixing a small regression for wasm builds, I think we should backport the change to v2.1. (cherry picked from commit d3bce9f) Co-authored-by: Jon C <[email protected]>
Problem
In the confidential mint and burn extension, the vector of proof instructions are appended to the token instruction using the
extend_from_slice
method, which requires the underlying element type of the slice to implement theClone
trait. Though minimal, it is better to use theextend
function that subsumes the input vector sinceextend
does not require the underlying element type to be implement any trait.This is relevant when building the token22 program for wasm target. The
Instruction
type implementsClone
for non-wasm targets, but does not seem to implement it for wasm targets (https://github.com/anza-xyz/agave/blob/master/sdk/instruction/src/lib.rs#L108).Summary of Changes
Replace
extend_from_slice
withextend
.