INFURA / go-ethlibs

Ethereum libraries in Go for interacting with Ethereum nodes
MIT License
162 stars 34 forks source link

bugfix: recover the correct From address for non-EIP-155 transactions #49

Closed ryanschneider closed 3 years ago

ryanschneider commented 3 years ago

Turns out we were never returning the correct From address when decoding unprotected EIP-155 transactions. This is because we were treating all txs as EIP-155, and thus using RLP(Nonce, GasPrice, Gas, To, Value, Input, ChainId, 0, 0) as the signing pre-image (where ChainId was always 0), but the correct pre-image for pre-EIP-155 unprotected transactions *those with v=27 or v=28) is just the 6-element list RLP(Nonce, GasPrice, Gas, To, Value, Input) from the yellow paper Appendix F, equations (287).

This PR fixes that and ensures that our unprotected tx test case inspects all the fields (prior to this PR the From field was wrong, all other fields were correct).