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

feature: add assert_valid_signature utility function #1353

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CaptainLEVI-XXX
Copy link
Contributor

##Fixes [#1223]

Overview

Adding an internal utility function assert_valid_signature to reduce code duplication in signature validation logic.

Changes

// Before
let is_valid_signature_felt = ISRC6Dispatcher { contract_address: voter }
            .is_valid_signature(hash, signature.into());

// Check either 'VALID' or true for backwards compatibility
let is_valid_signature = is_valid_signature_felt == starknet::VALIDATED
            || is_valid_signature_felt == 1;

assert(is_valid_signature, Errors::INVALID_SIGNATURE);

// After
self.assert_valid_signature(account, hash, signature);
  • Added new utility function assert_valid_signature to the InternalTrait implementation
  • Updated external function to use the new utility function
  • Maintains compatibility with both starknet::VALIDATED and legacy 1 values
  • Ran full test suite and formatting checks:
    • snforge test - All tests passing
    • scarb fmt -w --check - Code formatting verified

@CaptainLEVI-XXX
Copy link
Contributor Author

hey @ericnordelo , can you please review this PR?

@ericnordelo
Copy link
Member

Hey @CaptainLEVI-XXX. Thanks again for taking the time. We will go through it early this week.

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.

2 participants