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

Checksum Validation Bug in account.rs #216

Open
Miska05 opened this issue Oct 25, 2024 · 1 comment
Open

Checksum Validation Bug in account.rs #216

Miska05 opened this issue Oct 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Miska05
Copy link

Miska05 commented Oct 25, 2024

Hey team! 👋 I was digging into the account.rs file and noticed something off with the checksum validation logic for Ethereum addresses around line 45.

Looks like the current implementation doesn’t fully handle cases where checksums aren't matching correctly. To fix this, I’d suggest using a stricter validation method that re-checks the checksum based on a standard like EIP-55. This would ensure we're catching all invalid addresses and preventing any weird edge cases from slipping through.

Proposed fix:

if !is_checksum_valid(s) {
return Err("Invalid checksum for Ethereum address. Please check again.");
}

Let me know what you think! Happy to help with the fix if needed.

@kayagokalp kayagokalp added the bug Something isn't working label Nov 16, 2024
@kayagokalp
Copy link
Member

kayagokalp commented Nov 16, 2024

Hey there thank you for the issue report. We would be happy to see a PR landed if you wish to tackle it.

Feel free to send a PR!

Miska05 added a commit to Miska05/forc-wallet that referenced this issue Nov 28, 2024
- Added validation for Ethereum addresses using the EIP-55 checksum standard.
- Implemented the `validate_eth_address` function to ensure all Ethereum addresses are correctly validated before use.
- Updated the `Account::new` constructor to include checksum validation logic.
- Included test cases to verify the correctness of valid and invalid Ethereum addresses.
- Improved error handling for invalid addresses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants