From 008d04fd5739acfb768dc54e3c28371151b70d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Wed, 11 Jan 2023 23:26:13 +0000 Subject: [PATCH] use existing variable for empty object CID. --- chain/gen/genesis/genesis.go | 8 -------- chain/gen/genesis/genesis_eth.go | 5 +++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/chain/gen/genesis/genesis.go b/chain/gen/genesis/genesis.go index 4e53c1e29..d1c7d308e 100644 --- a/chain/gen/genesis/genesis.go +++ b/chain/gen/genesis/genesis.go @@ -59,8 +59,6 @@ type GenesisBootstrap struct { Genesis *types.BlockHeader } -var EmptyObjCid = cid.Undef - /* From a list of parameters, create a genesis block / initial state @@ -127,12 +125,6 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge // Create empty state tree cst := cbor.NewCborStore(bs) - var err error - EmptyObjCid, err = cst.Put(context.TODO(), []struct{}{}) - if err != nil { - return nil, nil, xerrors.Errorf("putting empty object: %w", err) - } - sv, err := state.VersionForNetwork(template.NetworkVersion) if err != nil { return nil, nil, xerrors.Errorf("getting state tree version: %w", err) diff --git a/chain/gen/genesis/genesis_eth.go b/chain/gen/genesis/genesis_eth.go index 516c68223..59c54adf8 100644 --- a/chain/gen/genesis/genesis_eth.go +++ b/chain/gen/genesis/genesis_eth.go @@ -19,6 +19,7 @@ import ( "github.com/filecoin-project/lotus/chain/state" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types/ethtypes" + "github.com/filecoin-project/lotus/chain/vm" ) // EthNullAddresses are the Ethereum addresses we want to create zero-balanced EthAccounts in. @@ -45,7 +46,7 @@ func SetupEAM(_ context.Context, nst *state.StateTree, nv network.Version) error header := &types.Actor{ Code: codecid, - Head: EmptyObjCid, + Head: vm.EmptyObjectCid, Balance: big.Zero(), Address: &builtin.EthereumAddressManagerActorAddr, // so that it can create ETH0 } @@ -61,7 +62,7 @@ func MakeEthNullAddressActor(av actorstypes.Version, addr address.Address) (*typ act := &types.Actor{ Code: actcid, - Head: EmptyObjCid, + Head: vm.EmptyObjectCid, Nonce: 0, Balance: big.Zero(), Address: &addr,