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

Fix Eth:Tx.decode for transaction with s length < 64 chars #148

Merged
merged 2 commits into from
Sep 26, 2022

Conversation

Regul777
Copy link
Contributor

@Regul777 Regul777 commented Sep 23, 2022

Sometimes transaction can have "s" that has 62 char length, instead of 64 chars.

In the "ethereumjs-monorepo"(which is used in web3.js) used the same solution for creation signature
https://github.com/ethereumjs/ethereumjs-monorepo/blob/f39b0b2c826031a3f56b30f154d80c85bebfd611/packages/util/src/signature.ts#L59

const signature = Buffer.concat([setLengthLeft(r, 32), setLengthLeft(s, 32)], 64)

I've added the example transaction in tests:

Raw Transaction:
0xf86b820e8485012a05f200831e848094ffe811714ab35360b67ee195ace7c10d93f89d8c80844e71d92d8194a07b8f34a8fb85d850b3be4fc0330382e125e4216df5598c6d2c3bc47954684cf99f35ef53ee007c2f705eca91448b5c86e81d10f659ad868409bac8197bba9814

@q9f q9f added the bug Something isn't working label Sep 26, 2022
@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2022

Codecov Report

Merging #148 (8368df0) into main (c100d53) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #148   +/-   ##
=======================================
  Coverage   99.74%   99.74%           
=======================================
  Files          67       67           
  Lines        3901     3911   +10     
=======================================
+ Hits         3891     3901   +10     
  Misses         10       10           
Impacted Files Coverage Δ
lib/eth/tx/legacy.rb 100.00% <100.00%> (ø)
spec/eth/tx_spec.rb 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

lib/eth/tx/legacy.rb Outdated Show resolved Hide resolved
@q9f
Copy link
Owner

q9f commented Sep 26, 2022

fix looks good, we would need to apply to for all transaction types though!

also, please run rufo on the code!

@q9f q9f merged commit 7926fc4 into q9f:main Sep 26, 2022
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 this pull request may close these issues.

3 participants