Merge pull request #8521 from filecoin-project/fix/itests-nv16

[nv16] improve itest situation and preload manifests in cli
This commit is contained in:
Aayush Rajasekaran 2022-04-21 10:12:16 -04:00 committed by GitHub
commit a7dc3f519b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 74 additions and 30 deletions

View File

@ -1,2 +1,2 @@
actors7_release=""
actors8_release=a9635268e3b359bd
actors8_release=5921189441f18b88

View File

@ -54,9 +54,17 @@ func (m message{{.v}}) Create(
return nil, actErr
}
{{if (le .v 7)}}
actorCodeID := builtin{{.v}}.MultisigActorCodeID
{{else}}
actorCodeID, ok := actors.GetActorCodeID(actors.Version{{.v}}, "multisig")
if !ok {
return nil, xerrors.Errorf("error getting actor multisig code id for actor version %d", {{.v}})
}
{{end}}
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init{{.v}}.ExecParams{
CodeCID: builtin{{.v}}.MultisigActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: enc,
}

View File

@ -53,9 +53,11 @@ func (m message0) Create(
return nil, actErr
}
actorCodeID := builtin0.MultisigActorCodeID
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init0.ExecParams{
CodeCID: builtin0.MultisigActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: enc,
}

View File

@ -50,9 +50,11 @@ func (m message2) Create(
return nil, actErr
}
actorCodeID := builtin2.MultisigActorCodeID
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init2.ExecParams{
CodeCID: builtin2.MultisigActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: enc,
}

View File

@ -50,9 +50,11 @@ func (m message3) Create(
return nil, actErr
}
actorCodeID := builtin3.MultisigActorCodeID
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init3.ExecParams{
CodeCID: builtin3.MultisigActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: enc,
}

View File

@ -50,9 +50,11 @@ func (m message4) Create(
return nil, actErr
}
actorCodeID := builtin4.MultisigActorCodeID
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init4.ExecParams{
CodeCID: builtin4.MultisigActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: enc,
}

View File

@ -50,9 +50,11 @@ func (m message5) Create(
return nil, actErr
}
actorCodeID := builtin5.MultisigActorCodeID
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init5.ExecParams{
CodeCID: builtin5.MultisigActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: enc,
}

View File

@ -50,9 +50,11 @@ func (m message6) Create(
return nil, actErr
}
actorCodeID := builtin6.MultisigActorCodeID
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init6.ExecParams{
CodeCID: builtin6.MultisigActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: enc,
}

View File

@ -50,9 +50,11 @@ func (m message7) Create(
return nil, actErr
}
actorCodeID := builtin7.MultisigActorCodeID
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init7.ExecParams{
CodeCID: builtin7.MultisigActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: enc,
}

View File

@ -50,9 +50,14 @@ func (m message8) Create(
return nil, actErr
}
actorCodeID, ok := actors.GetActorCodeID(actors.Version8, "multisig")
if !ok {
return nil, xerrors.Errorf("error getting actor multisig code id for actor version %d", 8)
}
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init8.ExecParams{
CodeCID: builtin8.MultisigActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: enc,
}

View File

@ -25,10 +25,7 @@ var manifests map[Version]*manifest.Manifest
var actorMeta map[cid.Cid]actorEntry
var (
loadOnce sync.Once
loadError error
manifestMx sync.Mutex
manifestMx sync.RWMutex
)
type actorEntry struct {
@ -44,17 +41,18 @@ func AddManifest(av Version, manifestCid cid.Cid) {
}
func GetManifest(av Version) (cid.Cid, bool) {
manifestMx.Lock()
defer manifestMx.Unlock()
manifestMx.RLock()
defer manifestMx.RUnlock()
c, ok := manifestCids[av]
return c, ok
}
func LoadManifests(ctx context.Context, store cbor.IpldStore) error {
// tests may invoke this concurrently, so we wrap it in a sync.Once
loadOnce.Do(func() { loadError = loadManifests(ctx, store) })
return loadError
manifestMx.Lock()
defer manifestMx.Unlock()
return loadManifests(ctx, store)
}
func loadManifests(ctx context.Context, store cbor.IpldStore) error {
@ -87,6 +85,9 @@ func loadManifests(ctx context.Context, store cbor.IpldStore) error {
}
func GetActorCodeID(av Version, name string) (cid.Cid, bool) {
manifestMx.RLock()
defer manifestMx.RUnlock()
mf, ok := manifests[av]
if ok {
return mf.Get(name)
@ -96,6 +97,9 @@ func GetActorCodeID(av Version, name string) (cid.Cid, bool) {
}
func GetActorMetaByCode(c cid.Cid) (string, Version, bool) {
manifestMx.RLock()
defer manifestMx.RUnlock()
entry, ok := actorMeta[c]
if !ok {
return "", -1, false

View File

@ -257,7 +257,6 @@ type FVM struct {
}
func NewFVM(ctx context.Context, opts *VMOpts) (*FVM, error) {
log.Info("using the FVM, this is experimental!")
circToReport := opts.FilVested
// For v14 (and earlier), we perform the FilVested portion of the calculation, and let the FVM dynamically do the rest
// v15 and after, the circ supply is always constant per epoch, so we calculate the base and report it at creation

22
cli/init.go Normal file
View File

@ -0,0 +1,22 @@
package cli
import (
"context"
"fmt"
"github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors"
)
func init() {
// preload manifest so that we have the correct code CID inventory for cli since that doesn't
// go through CI
if len(build.BuiltinActorsV8Bundle()) > 0 {
bs := blockstore.NewMemory()
if err := actors.LoadManifestFromBundle(context.TODO(), bs, actors.Version8, build.BuiltinActorsV8Bundle()); err != nil {
panic(fmt.Errorf("error loading actor manifest: %w", err))
}
}
}

View File

@ -406,16 +406,8 @@ func (n *Ensemble) Start() *Ensemble {
// this is a miner created after genesis, so it won't have a preseal.
// we need to create it on chain.
// we get the proof type for the requested sector size, for
// the current network version.
// nv, err := m.FullNode.FullNode.StateNetworkVersion(ctx, types.EmptyTSK)
// require.NoError(n.t, err)
// TODO this doesn't currently work with the FVM -- we need to specify policy somehow
// proofType, err := miner.WindowPoStProofTypeFromSectorSize(m.options.sectorSize)
// require.NoError(n.t, err)
// so do this instead, which works:
proofType := abi.RegisteredPoStProof_StackedDrgWindow64GiBV1
proofType, err := miner.WindowPoStProofTypeFromSectorSize(m.options.sectorSize)
require.NoError(n.t, err)
params, aerr := actors.SerializeParams(&power3.CreateMinerParams{
Owner: m.OwnerKey.Address,