You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that since #22806 and the release of geth v1.10.10, I noticed that some data in the Receipt type are lost during marshalling. Previously the test below used to work correctly.
System information
Geth version: >=1.10.10
OS & Version: Tested on Linux and macOS
Expected behaviour
Receipt should be marshalled and unmarshaled without data loss.
Actual behaviour
When using MarshalBinary then UnmarshalBinary, the following fields are lost.
typeReceiptstruct {
....
...// Implementation fields: These fields are added by geth when processing a transaction.// They are stored in the chain database.TxHash common.Hash`json:"transactionHash" gencodec:"required"`ContractAddress common.Address`json:"contractAddress"`GasUseduint64`json:"gasUsed" gencodec:"required"`// Inclusion information: These fields provide information about the inclusion of the// transaction corresponding to this receipt.BlockHash common.Hash`json:"blockHash,omitempty"`BlockNumber*big.Int`json:"blockNumber,omitempty"`TransactionIndexuint`json:"transactionIndex"`
}
Steps to reproduce the behaviour
Add the following test in core/types/receipt_test.go:
quentinlesceller
changed the title
Data Loss during MarshalBinary and UnmarshalBinary for Receipt
Data loss during MarshalBinary and UnmarshalBinary for Receipt
Dec 6, 2021
After reading some more on this. It seems like this is the expected behaviour? That's unfortunate because we used these values internally and I don't see at first glance a way to serialise it without losing data.
From the description of the function // MarshalBinary returns the consensus encoding of the receipt. it's aimed to return the consensus encoding. Thus it omits the "unnecessary" fields when marshaling the receipt to derive a binary with consensus definition.
Thank you for your answer. The main problem that we had is that the new encoding broke our usage since we use go rpc.
I guess that if it is a consensus thing we will probably use jsonrpc. Closing.
Hi everyone,
I believe that since #22806 and the release of geth v1.10.10, I noticed that some data in the
Receipt
type are lost during marshalling. Previously the test below used to work correctly.System information
Geth version: >=1.10.10
OS & Version: Tested on Linux and macOS
Expected behaviour
Receipt should be marshalled and unmarshaled without data loss.
Actual behaviour
When using MarshalBinary then UnmarshalBinary, the following fields are lost.
Steps to reproduce the behaviour
Add the following test in
core/types/receipt_test.go
:Backtrace
The text was updated successfully, but these errors were encountered: