This repository was archived by the owner on Jan 22, 2025. It is now read-only.
More serde snapshot cleanup#22449
Merged
brooksprumo merged 1 commit intosolana-labs:masterfrom Jan 13, 2022
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22449 +/- ##
=========================================
- Coverage 81.1% 81.1% -0.1%
=========================================
Files 555 556 +1
Lines 150664 150665 +1
=========================================
- Hits 122301 122292 -9
- Misses 28363 28373 +10 |
a3e1d83 to
ae92a36
Compare
brooksprumo
commented
Jan 13, 2022
Comment on lines
-10
to
-44
| /// 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: AppendVecIdSerialized, | ||
| accounts_current_len: usize, | ||
| } | ||
|
|
||
| pub trait SerializableStorage { | ||
| fn id(&self) -> AppendVecIdSerialized; | ||
| fn current_len(&self) -> usize; | ||
| } | ||
|
|
||
| impl SerializableStorage for SerializableAccountStorageEntry { | ||
| fn id(&self) -> AppendVecIdSerialized { | ||
| self.id | ||
| } | ||
| fn current_len(&self) -> usize { | ||
| self.accounts_current_len | ||
| } | ||
| } | ||
|
|
||
| #[cfg(RUSTC_WITH_SPECIALIZATION)] | ||
| impl solana_frozen_abi::abi_example::IgnoreAsHelper for SerializableAccountStorageEntry {} | ||
|
|
||
| impl From<&AccountStorageEntry> for SerializableAccountStorageEntry { | ||
| fn from(rhs: &AccountStorageEntry) -> Self { | ||
| Self { | ||
| id: rhs.append_vec_id() as AppendVecIdSerialized, | ||
| accounts_current_len: rhs.accounts.len(), | ||
| } | ||
| } | ||
| } |
Contributor
Author
There was a problem hiding this comment.
I moved all this over to a new file, storage.rs, because I'm going to add a new serde style, which would result in these types/traits being duplicated and causing build errors.
| // This some what long test harness is required to freeze the ABI of | ||
| // Bank's serialization due to versioned nature | ||
| #[frozen_abi(digest = "4xi75P1M48JwDjxf5k8y43r2w57AjYmgjMB1BmX6hXKK")] | ||
| #[frozen_abi(digest = "7PcarCw6gpw9Yw8xypdxQP24TFjLiaHyuDkq95cgwtte")] |
Contributor
Author
There was a problem hiding this comment.
The diff is due to moving the storage fields into a new module.
$ diff
1629c1629
< element solana_runtime::serde_snapshot::newer::SerializableAccountStorageEntry
---
> element solana_runtime::serde_snapshot::storage::SerializableAccountStorageEntry
| // because it's handled by SerializableVersionedBank. | ||
| // So, sync fields with it! | ||
| #[derive(Clone, Deserialize)] | ||
| pub(crate) struct DeserializableVersionedBank { |
Contributor
Author
There was a problem hiding this comment.
Nothing in here is used outside of this module, so removing the pub. Same with SerializableVersionedBank below.
mvines
approved these changes
Jan 13, 2022
mergify Bot
pushed a commit
that referenced
this pull request
Feb 1, 2022
(cherry picked from commit 2756abc) # Conflicts: # runtime/src/serde_snapshot.rs # runtime/src/serde_snapshot/newer.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is part two of cleanup for serde snapshot, following PR #22431.