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

Enhanced Input Validation and Code Refactoring for Starknet Address Script #1553

Merged
merged 6 commits into from
Nov 7, 2024

Conversation

futreall
Copy link
Contributor

@futreall futreall commented Oct 29, 2024

Enhanced input validation and refactored address computation logic in Starknet address pre-computation script


Time spent on this PR:

0.5 days


Pull request type:

  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)

What is the current behavior?

The original code does not validate hexadecimal inputs for classHash, salt, and deployerAddress fields, which could lead to runtime errors if users provide values in an incorrect format. Additionally, the function and variable names do not fully conform to consistent camelCase styling.


What is the new behavior?

  • Input Validation: Implemented validation for hexadecimal input values using regular expressions to ensure the correct format for classHash, salt, and deployerAddress.
  • Improved Naming Conventions: Updated function and variable names to camelCase for readability and consistency.
  • Error Messages: Added clearer error messages to guide users when input format is incorrect.

Files Changed:

  1. Script File:

    • Added input validation to check for hexadecimal format in classHash, salt, and deployerAddress.
    • Refactored variable and function names to camelCase style.
    • Improved console output for readability and ease of debugging.
  2. README Documentation:

    • Updated usage instructions to reflect new validation requirements.
    • Provided example inputs that adhere to expected formats.
  3. Environment Configuration (if applicable):

    • No functional changes but updated comments to specify input requirements, particularly around the format for private keys and addresses.

This change is Reviewable

ClementWalter
ClementWalter previously approved these changes Nov 4, 2024
@ClementWalter
Copy link
Member

need to fix trunk (linter)

@futreall
Copy link
Contributor Author

futreall commented Nov 6, 2024

need to fix trunk (linter)

Thanks for the heads-up! I’ll get those fixes sorted and update the PR later today.

@futreall
Copy link
Contributor Author

futreall commented Nov 7, 2024

Hey @ClementWalter
I've made the requested fixes.Thanks!

@ClementWalter ClementWalter merged commit f857703 into kkrt-labs:main Nov 7, 2024
13 checks passed
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