Skip to content

Add assert_valid_signature utility #1444

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

utgarda
Copy link

@utgarda utgarda commented May 31, 2025

Add assert_valid_signature utility and use it for signature validation
fixes #1223

Added assert_valid_signature utility function in packages/account/src/utils.cairo that:

  • Standardizes signature validation using SRC6 is_valid_signature interface
  • Includes backwards compatibility (checks both starknet::VALIDATED and 1)
  • Takes signer address, hash, signature, and custom error message as parameters

Replaced duplicate signature validation logic in:

  • SRC9 Component (src9.cairo) - Outside execution validation
  • Governor Component (governor.cairo) - Vote casting by signature
  • Votes Component (votes.cairo) - Delegation by signature
  • ERC20 Component (erc20.cairo) - Permit function validation

Integration test coming

Copy link

codecov bot commented May 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.98%. Comparing base (a036924) to head (0fda783).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1444      +/-   ##
==========================================
+ Coverage   92.78%   92.98%   +0.19%     
==========================================
  Files          78       78              
  Lines        2093     2081      -12     
==========================================
- Hits         1942     1935       -7     
+ Misses        151      146       -5     
Files with missing lines Coverage Δ
packages/account/src/extensions/src9/src9.cairo 95.00% <100.00%> (-0.66%) ⬇️
packages/account/src/utils.cairo 100.00% <100.00%> (+11.11%) ⬆️
packages/governance/src/governor/governor.cairo 92.54% <100.00%> (+2.01%) ⬆️
packages/governance/src/votes/votes.cairo 89.65% <100.00%> (-0.67%) ⬇️
packages/token/src/erc20/erc20.cairo 98.03% <100.00%> (-0.04%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a036924...0fda783. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@ericnordelo ericnordelo left a comment

Choose a reason for hiding this comment

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

Thanks @utgarda. Looking very good! I left a couple of comments, but it is almost ready.

@utgarda utgarda requested a review from ericnordelo June 4, 2025 10:29
@ericnordelo
Copy link
Member

@immrsd, can you also review this PR before we merge it? Note that we may need to refactor the util outside of the account package when separating the interface package as discussed, but let's merge this in the meantime.

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.

Add assert_valid_signature utility
2 participants