dcou: BorrowedAccount::set_data() (#32424)
* dcou: BorrowedAccount::set_data() * Properly depend on dev-context-only-utils
This commit is contained in:
parent
40249cdc9e
commit
d80745cfaf
|
@ -33,6 +33,7 @@ thiserror = { workspace = true }
|
|||
[dev-dependencies]
|
||||
libsecp256k1 = { workspace = true }
|
||||
solana-logger = { workspace = true }
|
||||
solana-sdk = { workspace = true, features = ["dev-context-only-utils"] }
|
||||
|
||||
[lib]
|
||||
crate-type = ["lib"]
|
||||
|
|
|
@ -24,6 +24,7 @@ thiserror = { workspace = true }
|
|||
|
||||
[dev-dependencies]
|
||||
memoffset = { workspace = true }
|
||||
solana-sdk = { workspace = true, features = ["dev-context-only-utils"] }
|
||||
|
||||
[lib]
|
||||
crate-type = ["lib"]
|
||||
|
|
|
@ -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(())
|
||||
|
|
|
@ -85,6 +85,7 @@ libsecp256k1 = { workspace = true }
|
|||
memoffset = { workspace = true }
|
||||
rand_chacha = { workspace = true }
|
||||
solana-logger = { workspace = true }
|
||||
solana-sdk = { workspace = true, features = ["dev-context-only-utils"] }
|
||||
static_assertions = { workspace = true }
|
||||
test-case = { workspace = true }
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ full = [
|
|||
"sha3",
|
||||
"digest",
|
||||
]
|
||||
dev-context-only-utils = []
|
||||
|
||||
[dependencies]
|
||||
assert_matches = { workspace = true, optional = true }
|
||||
|
|
|
@ -886,9 +886,10 @@ impl<'a> BorrowedAccount<'a> {
|
|||
/// You should always prefer set_data_from_slice(). Calling this method is
|
||||
/// currently safe but requires some special casing during CPI when direct
|
||||
/// 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<u8>) -> Result<(), InstructionError> {
|
||||
self.can_data_be_resized(data.len())?;
|
||||
self.can_data_be_changed()?;
|
||||
|
|
Loading…
Reference in New Issue