frozen-abi: add imbl::GenericHashMap#583
Merged
2501babe merged 6 commits intoanza-xyz:masterfrom Mar 4, 2026
Merged
Conversation
This was referenced Feb 24, 2026
f5b4d97 to
99e1019
Compare
c5a798b to
a713827
Compare
2501babe
commented
Mar 3, 2026
Comment on lines
+434
to
+436
| #[cfg(not(target_os = "solana"))] | ||
| impl<K, V, S, P> AbiExample for imbl::GenericHashMap<K, V, S, P> | ||
| where |
Member
Author
There was a problem hiding this comment.
imbl::HashMap is just a type alias for this struct with two of the generic params held fixed
joncinque
reviewed
Mar 3, 2026
Collaborator
joncinque
left a comment
There was a problem hiding this comment.
Hehe very clever! Confirming the types are equivalent in v6 and v7, let's just add a comment so we don't mess this up in the future
| hex = "0.4.3" | ||
| hmac = "0.12.1" | ||
| im = "15.1.0" | ||
| imbl = ">= 6.0.0, < 8.0.0" |
Collaborator
There was a problem hiding this comment.
Can you just add a comment here so we don't mess this up in the future? Something like
# Use v6 in the SDK to maintain a lower rust-version, but allow v7 for Agave which uses a higher rust-version and needs v7 performance
Member
Author
There was a problem hiding this comment.
73b053c i put it to the right rather than above to copy the style of the serde comments
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
anza-xyz/agave#10762 intends to replace
imwithimblas the backing store ofStakesCache. the current crate is no longer maintained, while the new crate is a drop-in replacement under active development, with significant improvementstesting with my own benchmarks (anza-xyz/agave#10760) and confirmed by alessandro on mainnet, this change speeds up epoch cutover by 30-50%. however, we must implement
AbiExampleforimbl::HashMapto satify the frozen-abi contract onBank. the way this is done forimis a simple impl in sdkone of the challenges with copying this for
imblis the perf improvements we want are inimbl@v7.0.0, but this version depends on rust 1.85, while sdk enforces a minimum supported version of 1.81. the alternative is to putimbl::HashMapunder a newtype wrapper and implementAbiExamplein agave, with no sdk changes. this ends up being quite unpleasant because it requires us to write a differentSerializefor thefrozen-abifeature gate that returns some other type, because a wrapper overimbl::HashMapdoes not save us from needingAbiExampleon every underlying type. aside from being ugly, i feel this violates the spirit offrozen-abibecause we are explicitly lying to it about the serde representation of our type"if only there were a better way!" there is. but i leave it to you to decide if i am a clever sort or if im guilty of Crate Crimes. this pr does the simple
AbiExampleforimbl::HashMapin sdk, identical to the treatment ofim::HashMap. but i allow bothimbl@v6andimbl@7inCargo.toml, and give sdk aCargo.lockenforcing 6. this means sdk is happy on rust 1.81. but the open version allows agave to use 7 without issue, getting us the perf we desirenone of this should affect the actual thing these tests care about, which is the snapshot format.
im::HashMapandimbl::HashMapboth go to the serde serialized representation of a platonic hashmap