Open
Conversation
5646390 to
2c0a166
Compare
CHr15F0x
commented
Apr 16, 2026
…Definition, SerializedClass into SerializedClassDefinition
defb65a to
3de8656
Compare
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.
Fixes: #3326
Rationale: we have 4 distinct types which are all passed around as
Vec<u8>. Just until recently this seemed good enough (though absolutely against static typing and a "everything is a type approach" that leverages the compiler), until it didn't. I spent a good couple of days trying to find a regression that I introduced, which was a simple copy-pasta caused by using aVec<u8>Sierra where Casm was actually expected. That was enough.The PR introduces 4 types:
SerializedSierraDefinitionSerializedCasmDefinitionSerializedCairoDefinitionSerializedOpaqueClassDefinition, where the internalVec<u8>is either sierra or cairo, but we don't really care because it's all passed around to the end consumer without the need to figure out which variant it really is; this is also how classes are stored and served via the RPCSerializedClassDefinition, which is the opposite of the above - it's an enum, which distinguishes between the two variantsI tried to make the changes transparent and not modify the semantics of the APIs, with one notable exception:
compute_class_hash, where it actually made sense to consume the buffer and reinterpret it as either of the variants in a safe manner, so thatdownload_classitself does not have to do the reinterpreting in an unsafe manner.I left all the fixtures as is to keep the delta reasonably small (which it already isn't).