Skip to content

Conversation

@cptartur
Copy link
Member

@cptartur cptartur commented Oct 22, 2025

@cptartur cptartur force-pushed the spr/master/b701265d branch from f3341f3 to 975c55c Compare October 23, 2025 13:53
@cptartur cptartur force-pushed the spr/master/30d7f8cd branch from 5be308b to 2fb1cab Compare October 23, 2025 13:53
@cptartur cptartur mentioned this pull request Oct 23, 2025
@cptartur cptartur force-pushed the spr/master/30d7f8cd branch from 2fb1cab to 5f1378b Compare November 7, 2025 11:21
@cptartur cptartur force-pushed the spr/master/b701265d branch from 975c55c to b529f57 Compare November 7, 2025 11:21
@cptartur cptartur force-pushed the spr/master/30d7f8cd branch from 5f1378b to 61e2887 Compare November 7, 2025 11:23
@cptartur cptartur force-pushed the spr/master/b701265d branch from b529f57 to a5347c6 Compare November 7, 2025 11:23
@cptartur cptartur force-pushed the spr/master/30d7f8cd branch from 61e2887 to b6dbc2c Compare November 7, 2025 11:29
@cptartur cptartur force-pushed the spr/master/b701265d branch 2 times, most recently from 275f396 to 12fa2fe Compare November 7, 2025 11:31
@cptartur cptartur force-pushed the spr/master/30d7f8cd branch from b6dbc2c to 7a5f8b2 Compare November 7, 2025 11:31
@cptartur cptartur marked this pull request as ready for review November 7, 2025 11:50
@cptartur cptartur requested a review from a team as a code owner November 7, 2025 11:50
@cptartur cptartur requested review from MKowalski8 and ksew1 and removed request for a team November 7, 2025 11:50
/// use this wrapper to NOT add extra length felt
/// useful e.g. when you need to pass an already serialized value
#[derive(Debug)]
pub struct NoLengthFeltVec<T>(pub Vec<T>)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could name it SerializedValue? As this i think is only usefull if value is serialized

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming

@cptartur cptartur force-pushed the spr/master/b701265d branch from 12fa2fe to f955261 Compare November 12, 2025 12:23
@cptartur cptartur force-pushed the spr/master/30d7f8cd branch from 7a5f8b2 to 69854b2 Compare November 12, 2025 12:23
@cptartur cptartur requested a review from ksew1 November 12, 2025 12:23
@cptartur cptartur force-pushed the spr/master/30d7f8cd branch from 69854b2 to 45efdc4 Compare November 12, 2025 12:54
///
/// Use this to omit adding extra felt for the length of the vector during serialization.
#[derive(Debug)]
pub struct SerializedValue<T>(pub Vec<T>)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also drop generic. Only valid representation i would say is pub struct SerializedValue(pub Vec<Felt>)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one use case where we want to write serialized array of ResourceBounds structs into memory in serialized format and we do it as so

&SerializedValue::new(resource_bounds).serialize_to_vec(),

We can change serialized value to be a Vec<Felt> but we would either have to provide an constructor that allows creating it from other values that implement serialize (we would have to do the serialization at construction time though) or change the usage to something along the lines of

&resource_bounds
                .iter()
                .flat_map(conversions::serde::serialize::SerializeToFeltVec::serialize_to_vec)
                .collect::<Vec<_>>(),

which kind of duplicates the logic.

}
}

impl CairoDeserialize for SerializedValue<Felt> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need it to .read() the already serialized data that oracle returns.

commit-id:30d7f8cd
@cptartur cptartur force-pushed the spr/master/30d7f8cd branch from 45efdc4 to a2eeb0b Compare December 1, 2025 18:19
@cptartur cptartur force-pushed the spr/master/b701265d branch from f955261 to 74c94e0 Compare December 1, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants