forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core/types: transaction and receipt encoding/decoding optimizations (e…
…thereum#27976) Just some minor optimizations I figured out a while ago. By using ReadBytes instead of Bytes on the rlp stream, we can save the allocation of a temporary buffer for the typed tx payload. If kind == rlp.Byte, the size reported by Stream.Kind will be zero, but we need a buffer of size 1 for ReadBytes. Since typed txs always have to be longer than 1 byte, we can just return an error for kind == rlp.Byte. There is a also a small change for Log: since the first three fields of Log are the ones that should appear in the canon encoding, we can simply ignore the remaining fields via struct tag. Doing this removes an indirection through the rlpLog type. --------- Co-authored-by: Martin Holst Swende <[email protected]>
- Loading branch information
Showing
6 changed files
with
58 additions
and
53 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters