diff --git a/program-runtime/Cargo.toml b/program-runtime/Cargo.toml index b2583b347096ee..29f67de5db1f26 100644 --- a/program-runtime/Cargo.toml +++ b/program-runtime/Cargo.toml @@ -32,6 +32,7 @@ thiserror = { workspace = true } [dev-dependencies] solana-logger = { workspace = true } +solana-sdk = { workspace = true, features = ["dev-context-only-utils"] } [lib] crate-type = ["lib"] diff --git a/programs/zk-token-proof/src/lib.rs b/programs/zk-token-proof/src/lib.rs index 87665cb23596a4..9d1bf6aeeb5e07 100644 --- a/programs/zk-token-proof/src/lib.rs +++ b/programs/zk-token-proof/src/lib.rs @@ -64,7 +64,7 @@ where return Err(InstructionError::InvalidAccountData); } - proof_context_account.set_data(context_state_data)?; + proof_context_account.set_data_from_slice(&context_state_data)?; } Ok(()) diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 7e8368d82acc22..6f47005275ad7e 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -35,6 +35,7 @@ full = [ "sha3", "digest", ] +dev-context-only-utils = [] [dependencies] assert_matches = { workspace = true, optional = true } diff --git a/sdk/src/transaction_context.rs b/sdk/src/transaction_context.rs index fc7c1215966795..79e0f7f104794f 100644 --- a/sdk/src/transaction_context.rs +++ b/sdk/src/transaction_context.rs @@ -888,7 +888,10 @@ impl<'a> BorrowedAccount<'a> { /// account mapping is enabled. /// /// Currently only used by tests and the program-test crate. - #[cfg(not(target_os = "solana"))] + #[cfg(all( + not(target_os = "solana"), + any(test, feature = "dev-context-only-utils") + ))] pub fn set_data(&mut self, data: Vec) -> Result<(), InstructionError> { self.can_data_be_resized(data.len())?; self.can_data_be_changed()?;