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

[BUG] Starknet addresses can't be pasted into faucet input #420

Closed
kfastov opened this issue Jan 19, 2025 · 0 comments · Fixed by #421
Closed

[BUG] Starknet addresses can't be pasted into faucet input #420

kfastov opened this issue Jan 19, 2025 · 0 comments · Fixed by #421

Comments

@kfastov
Copy link
Contributor

kfastov commented Jan 19, 2025

Issue Overview

Typical Starknet address cannot be pasted into the faucet because the input has a validator that checks if address length equals to 42.
It's not correct because in Starknet addresses are felt and can be 32 bytes long (which corresponds to address length of 66 including '0x' prefix).
Also I believe it's not correct to check for minimal length in Starknet because leading zeroes are often dropped and 0x1 is a technically correct address.
The bug was introduced in #398
Relevant lines of code:

const isValid =
/^(0x)([a-fA-F0-9]{40})$/.test(sanitizedValue) &&
!/0x.*0x/.test(sanitizedValue);
if (!isValid) {
return;
}
if (sanitizedValue.length !== 42) {
return;
}

Proposed Solutions or Ideas

I guess it will be sufficient to test for /^0x[0-9A-Fa-f]{1,64}$/ and remove all redundant checks like /0x.*0x/ and sanitizedValue.length !== 42

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 a pull request may close this issue.

1 participant