From e97da0ea1509976a202d5b4509bd25d89cff3fb4 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Thu, 16 Dec 2021 08:41:01 -0600 Subject: [PATCH] AcctIdx: define type for serialized AppendVecId (#21938) --- runtime/src/serde_snapshot/future.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/runtime/src/serde_snapshot/future.rs b/runtime/src/serde_snapshot/future.rs index bc279e3551..898e658ec3 100644 --- a/runtime/src/serde_snapshot/future.rs +++ b/runtime/src/serde_snapshot/future.rs @@ -9,20 +9,23 @@ use { type AccountsDbFields = super::AccountsDbFields; +/// the serialized type is fixed as usize +pub type AppendVecIdSerialized = usize; + // Serializable version of AccountStorageEntry for snapshot format #[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Serialize, Deserialize)] pub(super) struct SerializableAccountStorageEntry { - id: AppendVecId, + id: AppendVecIdSerialized, accounts_current_len: usize, } pub trait SerializableStorage { - fn id(&self) -> AppendVecId; + fn id(&self) -> AppendVecIdSerialized; fn current_len(&self) -> usize; } impl SerializableStorage for SerializableAccountStorageEntry { - fn id(&self) -> AppendVecId { + fn id(&self) -> AppendVecIdSerialized { self.id } fn current_len(&self) -> usize { @@ -36,7 +39,7 @@ impl solana_frozen_abi::abi_example::IgnoreAsHelper for SerializableAccountStora impl From<&AccountStorageEntry> for SerializableAccountStorageEntry { fn from(rhs: &AccountStorageEntry) -> Self { Self { - id: rhs.append_vec_id(), + id: rhs.append_vec_id() as AppendVecIdSerialized, accounts_current_len: rhs.accounts.len(), } }