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] PrimitiveSignature doesn't support serialized Signature #831

Closed
gusinacio opened this issue Dec 24, 2024 · 6 comments · Fixed by #832
Closed

[Bug] PrimitiveSignature doesn't support serialized Signature #831

gusinacio opened this issue Dec 24, 2024 · 6 comments · Fixed by #832
Labels
bug Something isn't working

Comments

@gusinacio
Copy link

Component

primitives

What version of Alloy are you on?

0.8

Operating System

None

Describe the bug

My current system uses serialization and deserialization to send signatures via the network. We were using Signature but since version 0.4.2, it was deprecated to use PrimitiveSignature. The problem is that I don't control the clients and if they update to the latest version or not, so I'm still receiving older signatures.

I had to revert because the deserialization couldn't process the parity if it were Eip155 or NonEip155.

app 2024-12-19T18:29:17.724484Z DEBUG jsonrpsee_core::proc_macros_support: Error parsing "receipts" as "Vec < EIP712SignedMessage < Receipt > >": ErrorObject { code: InvalidParams, message: "Invalid params", data: Some(RawValue("invalid y_parity at line 1 column 331" │
│ )) }

I don't know if this is considered a breaking change or if you have any suggestions for fixing this problem.

@gusinacio gusinacio added the bug Something isn't working label Dec 24, 2024
@ethsdev
Copy link

ethsdev commented Dec 26, 2024

Hello @gusinacio , sorry for leaving a comment here without respecting the team rules. As a blockchain developer, I think my tech stack is fit for the team project. So I want to prove my skills by solving some team issues and join the team as a full-time developer. Could you give me a test task?

@mattsse
Copy link
Member

mattsse commented Dec 26, 2024

@klkvr I assume this happens because of

let y_parity = y_parity
.or(v)

@gusinacio
Copy link
Author

I think it's related to

if y_parity > U64::from(1) {
Err(serde::de::Error::custom("invalid y_parity"))

Since older signatures could have 27/28 for NonEip155 or bigger equal than 35 for Eip155, It's not possible to deserialize using PrimitiveSignature.

@klkvr
Copy link
Member

klkvr commented Dec 26, 2024

@gusinacio with #832 this should deserialize correctly, however note that if we receive a signature with eip155 value for v, the data about chain id will be lost during deserialization unless the signature is serialized along with chainId key (which is what's happening for legacy transactions for example)

@gusinacio
Copy link
Author

Thanks for the quick response and resolution!

I'm using signatures with Eip712 so I don't need information about ChainId because it's already in the domain. As long as it can deserialize correctly and recover the signer address, I'm happy.

@gusinacio
Copy link
Author

Hi there, is there any release schedule for this fix to be added?

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

Successfully merging a pull request may close this issue.

4 participants