apollo_staking: reorganize contract_types.rs into TryFromIterator and TryFrom<Retdata> sections#13064
Conversation
ef7e6b7 to
1b8eaa2
Compare
7ddd109 to
8cd5a82
Compare
1b8eaa2 to
6611dda
Compare
8cd5a82 to
ab5f80c
Compare
6611dda to
afe3cc6
Compare
matanl-starkware
left a comment
There was a problem hiding this comment.
@matanl-starkware reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on dafnamatsry).
crates/apollo_staking/src/contract_types.rs line 38 at r1 (raw file):
// Represents a Cairo1 `Option` containing an element that can be deserialized to `T`. #[derive(Debug)] pub(crate) struct CairoOption<T>(pub(crate) Option<T>);
Also from prev PR.
These are generic and unrelated to staking.
Code quote:
// Represents a Cairo1 `Array` containing elements that can be deserialized to `T`.
// `T` must implement `TryFrom<[Felt; N]>`, where `N` is the size of `T`'s Cairo equivalent.
#[derive(Debug, PartialEq, Eq)]
struct CairoArray<T>(Vec<T>);
// Represents a Cairo1 `Option` containing an element that can be deserialized to `T`.
#[derive(Debug)]
pub(crate) struct CairoOption<T>(pub(crate) Option<T>);afe3cc6 to
61f60d0
Compare
2308017 to
c9436c9
Compare
dafnamatsry
left a comment
There was a problem hiding this comment.
@dafnamatsry made 1 comment.
Reviewable status: 0 of 9 files reviewed, 1 unresolved discussion (waiting on matanl-starkware).
crates/apollo_staking/src/contract_types.rs line 38 at r1 (raw file):
Previously, matanl-starkware (Matan Lior) wrote…
Also from prev PR.
These are generic and unrelated to staking.
Done.
c9436c9 to
8737c50
Compare
8737c50 to
441b747
Compare
61f60d0 to
233a2e9
Compare
441b747 to
e2a0fe1
Compare
matanl-starkware
left a comment
There was a problem hiding this comment.
@matanl-starkware reviewed 9 files and all commit messages, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on dafnamatsry).
e2a0fe1 to
e3353da
Compare
233a2e9 to
530c383
Compare
530c383 to
3d6d953
Compare
06b67c2 to
0dd895c
Compare
dafnamatsry
left a comment
There was a problem hiding this comment.
@dafnamatsry reviewed 9 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on dafnamatsry).
0dd895c to
f6f4be6
Compare
Merge activity
|
… TryFrom<Retdata> sections
f6f4be6 to
58e11d2
Compare
dafnamatsry
left a comment
There was a problem hiding this comment.
@dafnamatsry reviewed 1 file and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on dafnamatsry).

Note
Medium Risk
Moderate risk because it moves Cairo retdata deserialization types (
RetdataDeserializationError,CairoArray,CairoOption) into a new shared crate and updates staking to depend on it; mistakes here could break contract-return parsing at runtime, though the logic is largely a direct extraction/refactor.Overview
Extracts Cairo retdata parsing helpers into a new shared crate. Adds
apollo_cairo_utilsto the workspace, providingTryFromIterator,CairoArray,CairoOption, andRetdataDeserializationErrorfor deserializing Cairo1 return values (Retdata) into Rust types.Updates staking to use the shared utilities.
apollo_stakingnow depends onapollo_cairo_utilsand removes the duplicated parsing/error definitions fromcontract_types.rs, switching imports incairo_staking_contract.rs,staking_contract.rs, and tests accordingly (with no intended behavior change aside from the refactor).Written by Cursor Bugbot for commit 58e11d2. This will update automatically on new commits. Configure here.