Support u8 slice digester in frozen abi struct. (#23726)
* support u8 slice in frozen abi digester * use slice in account struct * add bpf cargo lock file * no need to pass account.data to serializer * fix comments
This commit is contained in:
@@ -16,6 +16,7 @@ lazy_static = "1.4.0"
|
||||
log = "0.4.14"
|
||||
serde = "1.0.136"
|
||||
serde_derive = "1.0.103"
|
||||
serde_bytes = "0.11"
|
||||
sha2 = "0.10.2"
|
||||
solana-frozen-abi-macro = { path = "macro", version = "=1.10.4" }
|
||||
thiserror = "1.0"
|
||||
|
@@ -562,6 +562,17 @@ mod tests {
|
||||
#[derive(Serialize, AbiExample)]
|
||||
struct TestNewtypeStruct(i8);
|
||||
|
||||
#[frozen_abi(digest = "Hbs1X2X7TF2gFEfsspwfZ1JKr8ZGbLY3uidQBebqcMYt")]
|
||||
#[derive(Serialize, AbiExample)]
|
||||
struct Foo<'a> {
|
||||
#[serde(with = "serde_bytes")]
|
||||
data1: Vec<u8>,
|
||||
#[serde(with = "serde_bytes")]
|
||||
data2: &'a [u8],
|
||||
#[serde(with = "serde_bytes")]
|
||||
data3: &'a Vec<u8>,
|
||||
}
|
||||
|
||||
#[frozen_abi(digest = "5qio5qYurHDv6fq5kcwP2ue2RBEazSZF8CPk2kUuwC2j")]
|
||||
#[derive(Serialize, AbiExample)]
|
||||
struct TestStructReversed {
|
||||
|
@@ -415,6 +415,13 @@ impl AbiExample for &Vec<u8> {
|
||||
}
|
||||
}
|
||||
|
||||
impl AbiExample for &[u8] {
|
||||
fn example() -> Self {
|
||||
info!("AbiExample for (&[u8]): {}", type_name::<Self>());
|
||||
&VEC_U8[..]
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: AbiExample> AbiExample for VecDeque<T> {
|
||||
fn example() -> Self {
|
||||
info!("AbiExample for (Vec<T>): {}", type_name::<Self>());
|
||||
|
Reference in New Issue
Block a user