Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(starknet_api): use const for l1 handler tx version #2763

Merged
merged 1 commit into from
Dec 22, 2024

Conversation

ArniStarkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link

github-actions bot commented Dec 18, 2024

Artifacts upload workflows:

@ArniStarkware ArniStarkware marked this pull request as ready for review December 18, 2024 13:46
@ArniStarkware ArniStarkware force-pushed the arni/l1_handler/test_utils/version/use_const branch from 8fbc491 to 3437855 Compare December 19, 2024 12:22
Copy link
Contributor

@giladchase giladchase left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @ArniStarkware)


crates/starknet_api/src/transaction.rs line 692 at r2 (raw file):

    /// purposes.
    pub const VERSION: TransactionVersion = TransactionVersion::ZERO;
}

WDYT?
This will
a) make its api consistent with the rest of the tx types which all use a getter
b) make it impossible to instantiate an l1 tx with an incorrect field (and communicate that fact better maybe)

Suggestion:

#[derive(Debug, Clone, Default, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)]
pub struct L1HandlerTransaction {
    pub nonce: Nonce,
    pub contract_address: ContractAddress,
    pub entry_point_selector: EntryPointSelector,
    pub calldata: Calldata,
}

impl L1HandlerTransaction {
    /// The transaction version is considered 0 for L1-Handler transaction for hash calculation
    /// purposes.
    pub const VERSION: TransactionVersion = TransactionVersion::ZERO;
    
    pub fn version(&self) -> TransactionVersion {
        Self::VERSION
    }
}

Copy link
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 7 files reviewed, all discussions resolved (waiting on @giladchase)


crates/starknet_api/src/transaction.rs line 692 at r2 (raw file):

Previously, giladchase wrote…

WDYT?
This will
a) make its api consistent with the rest of the tx types which all use a getter
b) make it impossible to instantiate an l1 tx with an incorrect field (and communicate that fact better maybe)

On a later PR.

I tried something similar. There is an issue with the serialization, etc.

Copy link
Contributor

@giladchase giladchase left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 7 of 7 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ArniStarkware)


crates/starknet_api/src/transaction.rs line 692 at r2 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

On a later PR.

I tried something similar. There is an issue with the serialization, etc.

🫠

Copy link
Contributor Author

ArniStarkware commented Dec 22, 2024

Merge activity

  • Dec 22, 3:39 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Dec 22, 3:39 AM EST: A user merged this pull request with Graphite.

@ArniStarkware ArniStarkware merged commit abb7d90 into main Dec 22, 2024
20 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants