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

[Ethereum] Error in EthereumMessageSigner for hex messages #3831

Closed
JaimeToca opened this issue May 9, 2024 · 1 comment · Fixed by #3833
Closed

[Ethereum] Error in EthereumMessageSigner for hex messages #3831

JaimeToca opened this issue May 9, 2024 · 1 comment · Fixed by #3833
Labels
bug Something isn't working

Comments

@JaimeToca
Copy link
Collaborator

JaimeToca commented May 9, 2024

Describe the bug
Some dapps directly return message to sign as hexadecimal, when assembling the ethereum message, wallet core could check if it needs to be decoded or not, and do the formatting/size.

fn data_to_sign(&self) -> Vec<u8> {

Logic could be something like:

if string.isHex() -> hex::decode(s)
else -> s.as_bytes()

Problem
If client tries to decode hex string and transform to string, wallet core returns "invalid data when serializing a protocol buffer"

EthereumMessageSigner.signMessage(<PrivateKey>, <Message>)

To Reproduce
Message: "0xc0a96273d5c3fbe4d4000491f08daef9c17f88df846c1d6f57eb5f33c1fbd035"

@JaimeToca JaimeToca added the bug Something isn't working label May 9, 2024
@satoshiotomakan
Copy link
Collaborator

Hi @JaimeToca, thank you for the suggestion! I think we can do that. The only note is that we should check if the provided data contains expected "Ethereum Signed Message" EIP191 prefix, otherwise I think we shouldn't allow to sign such a message.

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.

2 participants