genesis: instantiate EAM at id 10.
This commit is contained in:
parent
7e7fff1dc5
commit
57a515f7a8
@ -6,6 +6,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/ipfs/go-datastore"
|
"github.com/ipfs/go-datastore"
|
||||||
cbor "github.com/ipfs/go-ipld-cbor"
|
cbor "github.com/ipfs/go-ipld-cbor"
|
||||||
@ -565,6 +566,11 @@ func MakeGenesisBlock(ctx context.Context, j journal.Journal, bs bstore.Blocksto
|
|||||||
return nil, xerrors.Errorf("make initial state tree failed: %w", err)
|
return nil, xerrors.Errorf("make initial state tree failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set up the Ethereum Address Manager.
|
||||||
|
if err = SetupEAM(ctx, st); err != nil {
|
||||||
|
return nil, xerrors.Errorf("failed to setup EAM: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
stateroot, err := st.Flush(ctx)
|
stateroot, err := st.Flush(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("flush state tree failed: %w", err)
|
return nil, xerrors.Errorf("flush state tree failed: %w", err)
|
||||||
@ -667,3 +673,18 @@ func MakeGenesisBlock(ctx context.Context, j journal.Journal, bs bstore.Blocksto
|
|||||||
Genesis: b,
|
Genesis: b,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetupEAM(_ context.Context, nst *state.StateTree) error {
|
||||||
|
// TODO Version10
|
||||||
|
codecid, ok := actors.GetActorCodeID(actors.Version8, actors.EamKey)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("failed to get CodeCID for EAM during genesis")
|
||||||
|
}
|
||||||
|
|
||||||
|
header := &types.Actor{
|
||||||
|
Code: codecid,
|
||||||
|
Head: vm.EmptyObjectCid,
|
||||||
|
Balance: big.Zero(),
|
||||||
|
}
|
||||||
|
return nst.SetActor(builtintypes.EthereumAddressManagerActorAddr, header)
|
||||||
|
}
|
||||||
|
@ -459,7 +459,6 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
|
|||||||
|
|
||||||
paramBytes = mustEnc(confirmParams)
|
paramBytes = mustEnc(confirmParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = doExecValue(ctx, genesisVm, minerInfos[i].maddr, power.Address, big.Zero(), builtintypes.MethodsMiner.ConfirmSectorProofsValid, paramBytes)
|
_, err = doExecValue(ctx, genesisVm, minerInfos[i].maddr, power.Address, big.Zero(), builtintypes.MethodsMiner.ConfirmSectorProofsValid, paramBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err)
|
return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err)
|
||||||
@ -471,7 +470,6 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
|
|||||||
RawByteDelta: types.NewInt(uint64(m.SectorSize)),
|
RawByteDelta: types.NewInt(uint64(m.SectorSize)),
|
||||||
QualityAdjustedDelta: sectorWeight,
|
QualityAdjustedDelta: sectorWeight,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = doExecValue(ctx, genesisVm, power.Address, minerInfos[i].maddr, big.Zero(), power.Methods.UpdateClaimedPower, mustEnc(claimParams))
|
_, err = doExecValue(ctx, genesisVm, power.Address, minerInfos[i].maddr, big.Zero(), power.Methods.UpdateClaimedPower, mustEnc(claimParams))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err)
|
return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user