diff --git a/chain/gen/genesis/f01_init.go b/chain/gen/genesis/f01_init.go index 9fc6cfb9e..718eb4480 100644 --- a/chain/gen/genesis/f01_init.go +++ b/chain/gen/genesis/f01_init.go @@ -133,9 +133,22 @@ func SetupInitActor(bs bstore.Blockstore, netname string, initialActors []genesi } } - err := setupMsig(remainder.Meta) - if err != nil { - return 0, nil, nil, xerrors.Errorf("setting up remainder msig: %w", err) + if remainder.Type == genesis.TAccount { + var ainfo genesis.AccountMeta + if err := json.Unmarshal(remainder.Meta, &ainfo); err != nil { + return 0, nil, nil, xerrors.Errorf("unmarshaling account meta: %w", err) + } + + // TODO: Use builtin.ReserveAddress... + value := cbg.CborInt(90) + if err := amap.Put(abi.AddrKey(ainfo.Owner), &value); err != nil { + return 0, nil, nil, err + } + } else if remainder.Type == genesis.TMultisig { + err := setupMsig(remainder.Meta) + if err != nil { + return 0, nil, nil, xerrors.Errorf("setting up remainder msig: %w", err) + } } amapaddr, err := amap.Root() diff --git a/chain/gen/genesis/genesis.go b/chain/gen/genesis/genesis.go index d382e4d0d..4b86db550 100644 --- a/chain/gen/genesis/genesis.go +++ b/chain/gen/genesis/genesis.go @@ -330,24 +330,18 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge if err := json.Unmarshal(template.RemainderAccount.Meta, &ainfo); err != nil { return nil, nil, xerrors.Errorf("unmarshaling account meta: %w", err) } - st, err := cst.Put(ctx, &account0.State{Address: ainfo.Owner}) - if err != nil { - return nil, nil, err - } _, ok := keyIDs[ainfo.Owner] if ok { return nil, nil, fmt.Errorf("remainder account has already been declared, cannot be assigned 90: %s", ainfo.Owner) } - err = state.SetActor(builtin.ReserveAddress, &types.Actor{ - Code: builtin0.AccountActorCodeID, - Balance: template.RemainderAccount.Balance, - Head: st, - }) + keyIDs[ainfo.Owner] = builtin.ReserveAddress + err = createAccountActor(ctx, cst, state, template.RemainderAccount, keyIDs) if err != nil { - return nil, nil, xerrors.Errorf("setting remainder account: %w", err) + return nil, nil, xerrors.Errorf("creating remainder acct: %w", err) } + case genesis.TMultisig: if err = createMultisigAccount(ctx, bs, cst, state, builtin.ReserveAddress, template.RemainderAccount, keyIDs); err != nil { return nil, nil, xerrors.Errorf("failed to set up remainder: %w", err)