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: Panic on too big Felt #81

Open
FabijanC opened this issue Jul 16, 2024 · 2 comments
Open

bug: Panic on too big Felt #81

FabijanC opened this issue Jul 16, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@FabijanC
Copy link

FabijanC commented Jul 16, 2024

Bug Report

types-rs version:

0.1.5

Current behavior:

When using Felt::from_hex or deserializing, if the input is too long, the code panics.

Expected behavior:

I'd prefer it to return Err rather than panic because I can do nothing about that except write my own wrapper, which beats the purpose of having a unified Felt type.

Steps to reproduce:

E.g.:

Felt::from_hex(&format!("0x{}", "f".repeat(65)))

But not just that, if you replace 65 with 63, it doesn't panic but gives this output:

0x7ffffffffffffeefffffffffffffffffffffffffffffffffffffffffffffffe

Other information:

@FabijanC FabijanC added the bug Something isn't working label Jul 16, 2024
@FabijanC
Copy link
Author

I updated the steps to reproduce with more info.

@FabijanC
Copy link
Author

Not opening a new issue because the following finding is relevant to this topic:

The expecting method of FeltVisitor is not implemented properly:

formatter.write_str("Failed to deserialize hexadecimal string")

It results in errors like this:

Invalid block ID: invalid type: number, expected Failed to deserialize hexadecimal string at line 1 column 33'

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

1 participant