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

Add assert_valid_signature utility #1223

Open
ericnordelo opened this issue Nov 18, 2024 · 0 comments
Open

Add assert_valid_signature utility #1223

ericnordelo opened this issue Nov 18, 2024 · 0 comments

Comments

@ericnordelo
Copy link
Member

🧐 Motivation

We have a few places where this code snippet is being used:

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

// 3. 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);

We can refactor it into a single utility to avoid repeating it further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant