Closed kudohamu closed 2 years ago
Thanks for the PR :) I will review it.
Merging #120 (98b8993) into main (bb640c7) will increase coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #120 +/- ##
=======================================
Coverage 99.74% 99.74%
=======================================
Files 67 67
Lines 3855 3858 +3
=======================================
+ Hits 3845 3848 +3
Misses 10 10
Impacted Files | Coverage Δ | |
---|---|---|
lib/eth/signature.rb | 100.00% <100.00%> (ø) |
|
spec/eth/signature_spec.rb | 100.00% <100.00%> (ø) |
:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more
Hi, thanks for the useful gem!
I encountered a problem when verifying signature signed with web3.js that in some cases could not be verified correctly. So I tried signing messages using web3.js and eth.rb, and noticed that different signatures are generated only if they contain multibyte characters.
Here is an example.
What's happening?
I found a difference in the logic of prefixing with "known messages" in web3.js and eth.rb. In the known message, eth.rb counts the number of characters, but web3.js counts the number of bytes.
Which is correct?
The EIP-191 specification quotes go-ethereum as follows.
len
, a built-in function of golang, is designed to "returns the number of bytes" in the case of string. ref: https://pkg.go.dev/builtin@go1.18.3#lenTherefore, I decided that it was a mistake on the eth.rb side and created this PR.