Closed joncinque closed 10 months ago
Not sure why CI is failing, but the important bits of building and testing the program pass!
Not sure why CI is failing, but the important bits of building and testing the program pass!
CI fails for the client part since it needs a token, which is not available on forks. But as you said, the important bits of building and testing are passing.
Thank you!
Problem
The token-metadata program uses the
serialize
function directly from Borsh, which has the unfortunate side-effect of consuming the underlying slice.More information about the issue at https://github.com/near/borsh-rs/pull/34
Solution
Use the
borsh::to_writer
API which properly moves theWriter
in order to serialize the data. You can see how this was done in SPL at https://github.com/solana-labs/solana-program-library/pull/4228.This will avoid any gotchas already present in the code. In
programs/token-metadata/program/src/state/mod.rs
, there's this comment:Using the
borsh::to_writer
API, you never need to worry about that!