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: Validation of the new spl metadata account #4132

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion solana/modules/token_bridge/program/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ impl<'b> Seeded<&SplTokenMetaDerivationData> for SplTokenMeta<'b> {
}
}

//New data length of spl token metadata account
pub const NEW_MAX_METADATA_LEN: usize = 607;

/// This method removes code duplication when checking token metadata. When metadata is read for
/// attestation and transfers, Token Bridge does not invoke Metaplex's Token Metadata program, so
/// it must validate the account the same way Token Metadata program does to ensure the correct
Expand All @@ -128,7 +131,7 @@ pub fn deserialize_and_verify_metadata(
}

// Account must be the expected Metadata length.
if info.data_len() != spl_token_metadata::state::MAX_METADATA_LEN {
if info.data_len() != spl_token_metadata::state::MAX_METADATA_LEN && info.data_len() != NEW_MAX_METADATA_LEN {
return Err(TokenBridgeError::InvalidMetadata.into());
}

Expand Down