Fix transaction/receipt encoding in eth_getRawTransaction #245

Closed
opened 2023-06-12 22:13:13 +00:00 by i-norden · 1 comment
Member

After EIP-2718 when the new tx types were added, the “consensus encoding” of a transaction (and receipt) is not a pure RLP encoding except for the legacy transaction. For non-legacy tx/rct types it is an RLP encoding of the tx/rct + prepending it with a specific prefix. This is encapsulated in the new tx.MarshalBinary and rct.MarshalBinary methods. https://github.com/cerc-io/ipld-eth-server/blob/v5/pkg/eth/api.go#L470 and other usages of rlp.EncodeToBytes to encode transaction and receipts need to be replaced with tx.MarshalBinary or rct.MarshalBinary.

After EIP-2718 when the new tx types were added, the “consensus encoding” of a transaction (and receipt) is not a pure RLP encoding except for the legacy transaction. For non-legacy tx/rct types it is an RLP encoding of the tx/rct + prepending it with a specific prefix. This is encapsulated in the new `tx.MarshalBinary` and` rct.MarshalBinary` methods. https://github.com/cerc-io/ipld-eth-server/blob/v5/pkg/eth/api.go#L470 and other usages of `rlp.EncodeToBytes` to encode transaction and receipts need to be replaced with `tx.MarshalBinary` or `rct.MarshalBinary`.
Author
Member
Also needs to be replaced at https://github.com/cerc-io/ipld-eth-server/blob/v5/pkg/eth/backend_utils.go#L278
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/ipld-eth-server#245
No description provided.