use existing variable for empty object CID.

This commit is contained in:
Raúl Kripalani 2023-01-11 23:26:13 +00:00 committed by raulk
parent 1c7db7c782
commit 008d04fd57
2 changed files with 3 additions and 10 deletions

View File

@ -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)

View File

@ -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,