From 8921b000dca9a9a93f17bb725c7f5a9629be414d Mon Sep 17 00:00:00 2001 From: Thiago Coimbra Lemos Date: Fri, 15 Mar 2024 11:05:57 -0300 Subject: [PATCH] use empty byte array instead of all zeros for receipt poststate (#3449) (#3459) --- jsonrpc/types/types.go | 2 +- state/helper.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonrpc/types/types.go b/jsonrpc/types/types.go index ec50389564..b9c902cc1a 100644 --- a/jsonrpc/types/types.go +++ b/jsonrpc/types/types.go @@ -658,7 +658,7 @@ func NewReceipt(tx types.Transaction, r *types.Receipt, l2Hash *common.Hash) (Re Type: ArgUint64(r.Type), TxL2Hash: l2Hash, } - if common.BytesToHash(r.PostState).String() != state.ZeroHash.String() { + if len(r.PostState) > 0 { root := common.BytesToHash(r.PostState) receipt.Root = &root } diff --git a/state/helper.go b/state/helper.go index d20cca07bf..49193966e0 100644 --- a/state/helper.go +++ b/state/helper.go @@ -293,7 +293,7 @@ func GenerateReceipt(blockNumber *big.Int, processedTx *ProcessTransactionRespon receipt.PostState = processedTx.StateRoot.Bytes() receipt.CumulativeGasUsed = processedTx.GasUsed } else { - receipt.PostState = ZeroHash.Bytes() + receipt.PostState = []byte{} receipt.CumulativeGasUsed = processedTx.CumulativeGasUsed } if processedTx.EffectiveGasPrice != "" {