Skip to content

Added option for raw_input attribute on entrypoints.#9793

Open
orizi wants to merge 1 commit intomainfrom
orizi/03-25-added_option_for_raw_input_attribute_on_entrypoints
Open

Added option for raw_input attribute on entrypoints.#9793
orizi wants to merge 1 commit intomainfrom
orizi/03-25-added_option_for_raw_input_attribute_on_entrypoints

Conversation

@orizi
Copy link
Copy Markdown
Collaborator

@orizi orizi commented Mar 26, 2026

Summary

Adds support for the #[raw_input] attribute for Starknet contract functions, allowing functions to receive raw Span<felt252> input data directly without automatic deserialization. Also includes a new proxy contract example that demonstrates library calls using this feature.


Type of change

Please check one:

  • Bug fix (fixes incorrect behavior)
  • New feature
  • Performance improvement
  • Documentation change with concrete technical impact
  • Style, wording, formatting, or typo-only change

Why is this change needed?

This change enables more flexible contract patterns, particularly proxy contracts that need to forward raw call data to other contracts via library calls. Without #[raw_input], functions must define specific parameter types, making it difficult to create generic proxy functions that can handle arbitrary call data.


What was the behavior or documentation before?

Previously, all external functions required explicitly typed parameters that would be automatically deserialized from the input data. There was no way to access the raw Span<felt252> input directly.


What is the behavior or documentation after?

Functions can now be marked with #[raw_input] to receive the raw input data as a Span<felt252> parameter. The attribute enforces that:

  • Functions must have exactly one parameter (besides self)
  • The parameter must be of type Span<felt252>
  • The parameter cannot be a ref parameter
  • Input length validation is skipped for these functions

Related issue or discussion (if any)

This feature enables proxy contract patterns commonly used in upgradeable contract architectures.


Additional context

The implementation includes comprehensive validation and error messages for incorrect usage of the #[raw_input] attribute. The proxy contract example demonstrates practical usage with library calls to different contract implementations.


Note

Medium Risk
Updates the Starknet plugin’s entrypoint wrapper generation to support bypassing calldata deserialization, which can affect how all external entrypoints receive and validate inputs.

Overview
Adds a new #[raw_input] attribute for Starknet entrypoints so functions can receive the raw calldata Span::<felt252> directly, skipping the usual parameter deserialization and the trailing "input too long" check.

Updates plugin codegen and tests to validate raw_input usage (must be a single calldata parameter) and adds a new proxy example contract plus generated test vectors (.sierra, contract_class.json, compiled_contract_class.json) and hash fixtures to exercise raw forwarding via library_call_syscall.

Written by Cursor Bugbot for commit 8276967. This will update automatically on new commits. Configure here.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Collaborator Author

orizi commented Mar 26, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@orizi orizi requested a review from TomerStarkware March 26, 2026 08:08
@orizi orizi marked this pull request as ready for review March 26, 2026 08:08
@orizi orizi force-pushed the orizi/03-25-added_option_for_raw_input_attribute_on_entrypoints branch 2 times, most recently from 6609345 to 6849818 Compare March 26, 2026 14:54
Copy link
Copy Markdown
Collaborator

@TomerStarkware TomerStarkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

@TomerStarkware reviewed 30 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on orizi).

Additionally added a proxy-style example contract.
@orizi orizi force-pushed the orizi/03-25-added_option_for_raw_input_attribute_on_entrypoints branch from 6849818 to 8276967 Compare March 27, 2026 12:36
Copy link
Copy Markdown
Collaborator

@TomerStarkware TomerStarkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

@TomerStarkware reviewed 24 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on orizi).

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.

3 participants