From 424824019b402b29d1d06967ad484c1d247f3d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 6 Feb 2023 14:38:48 +0100 Subject: [PATCH] fix: ethtypes: Correct 'no uncles' hash in NewEthBlock --- chain/types/ethtypes/eth_types.go | 4 +++- lib/must/must.go | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 lib/must/must.go diff --git a/chain/types/ethtypes/eth_types.go b/chain/types/ethtypes/eth_types.go index e84517396..9d1924d9c 100644 --- a/chain/types/ethtypes/eth_types.go +++ b/chain/types/ethtypes/eth_types.go @@ -22,6 +22,7 @@ import ( builtintypes "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/lib/must" ) var ( @@ -157,13 +158,14 @@ type EthBlock struct { var ( EmptyEthBloom = [256]byte{} EmptyEthHash = EthHash{} + NoUncleHash = must.One(ParseEthHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347")) EmptyEthInt = EthUint64(0) EmptyEthNonce = [8]byte{0, 0, 0, 0, 0, 0, 0, 0} ) func NewEthBlock() EthBlock { return EthBlock{ - Sha3Uncles: EmptyEthHash, + Sha3Uncles: NoUncleHash, StateRoot: EmptyEthHash, TransactionsRoot: EmptyEthHash, ReceiptsRoot: EmptyEthHash, diff --git a/lib/must/must.go b/lib/must/must.go new file mode 100644 index 000000000..e072b4e04 --- /dev/null +++ b/lib/must/must.go @@ -0,0 +1,9 @@ +package must + +func One[R any](r R, err error) R { + if err != nil { + panic(err) + } + + return r +}