MCPcopy Create free account
hub / github.com/nifty-oss/asset / validate

Function validate

programs/asset/program/src/processor/update.rs:388–414  ·  view source on GitHub ↗
(
    extension_type: ExtensionType,
    input_data: &mut [u8],
    current_data: Option<&mut [u8]>,
    authority: &Pubkey,
)

Source from the content-addressed store, hash-verified

386/// created.
387#[inline(always)]
388fn validate(
389 extension_type: ExtensionType,
390 input_data: &mut [u8],
391 current_data: Option<&mut [u8]>,
392 authority: &Pubkey,
393) -> Result<(), AssetError> {
394 if let Some(current_data) = current_data {
395 on_update(extension_type, current_data, input_data, Some(authority)).map_err(|error| {
396 msg!("[ERROR] {}", error);
397 AssetError::ExtensionDataInvalid
398 })
399 } else {
400 match extension_type {
401 ExtensionType::None | ExtensionType::Manager | ExtensionType::Proxy => {
402 err!(
403 AssetError::ExtensionDataInvalid,
404 "invalid extension type: {:?}",
405 extension_type
406 )
407 }
408 _ => on_create(extension_type, input_data, Some(authority)).map_err(|error| {
409 msg!("[ERROR] {}", error);
410 AssetError::ExtensionDataInvalid
411 }),
412 }
413 }
414}

Callers 1

process_updateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected