diff --git a/build/builtin-actors/bundles.env b/build/builtin-actors/bundles.env index 78405d95361..808a758c751 100644 --- a/build/builtin-actors/bundles.env +++ b/build/builtin-actors/bundles.env @@ -1,2 +1,2 @@ actors7_release="" -actors8_release=a9635268e3b359bd +actors8_release=5921189441f18b88 diff --git a/chain/actors/builtin/multisig/message.go.template b/chain/actors/builtin/multisig/message.go.template index 6bff8983ab0..b8bee97809b 100644 --- a/chain/actors/builtin/multisig/message.go.template +++ b/chain/actors/builtin/multisig/message.go.template @@ -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, } diff --git a/chain/actors/builtin/multisig/message0.go b/chain/actors/builtin/multisig/message0.go index dc43a9d5dc3..ec40e13478c 100644 --- a/chain/actors/builtin/multisig/message0.go +++ b/chain/actors/builtin/multisig/message0.go @@ -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, } diff --git a/chain/actors/builtin/multisig/message2.go b/chain/actors/builtin/multisig/message2.go index da2700d067d..96953662f36 100644 --- a/chain/actors/builtin/multisig/message2.go +++ b/chain/actors/builtin/multisig/message2.go @@ -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, } diff --git a/chain/actors/builtin/multisig/message3.go b/chain/actors/builtin/multisig/message3.go index f5f6d8cdfba..581e4808e1f 100644 --- a/chain/actors/builtin/multisig/message3.go +++ b/chain/actors/builtin/multisig/message3.go @@ -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, } diff --git a/chain/actors/builtin/multisig/message4.go b/chain/actors/builtin/multisig/message4.go index 90885aa0715..6b50e72483b 100644 --- a/chain/actors/builtin/multisig/message4.go +++ b/chain/actors/builtin/multisig/message4.go @@ -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, } diff --git a/chain/actors/builtin/multisig/message5.go b/chain/actors/builtin/multisig/message5.go index 9a8110f2cd5..8775e334a57 100644 --- a/chain/actors/builtin/multisig/message5.go +++ b/chain/actors/builtin/multisig/message5.go @@ -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, } diff --git a/chain/actors/builtin/multisig/message6.go b/chain/actors/builtin/multisig/message6.go index b2b95245e5e..4e70a58633f 100644 --- a/chain/actors/builtin/multisig/message6.go +++ b/chain/actors/builtin/multisig/message6.go @@ -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, } diff --git a/chain/actors/builtin/multisig/message7.go b/chain/actors/builtin/multisig/message7.go index e7fb83e9bd0..ceba4f41a14 100644 --- a/chain/actors/builtin/multisig/message7.go +++ b/chain/actors/builtin/multisig/message7.go @@ -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, } diff --git a/chain/actors/builtin/multisig/message8.go b/chain/actors/builtin/multisig/message8.go index 9852af105ad..bd0016762ee 100644 --- a/chain/actors/builtin/multisig/message8.go +++ b/chain/actors/builtin/multisig/message8.go @@ -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, } diff --git a/chain/actors/manifest.go b/chain/actors/manifest.go index f9932d1dba8..72cc411fa5b 100644 --- a/chain/actors/manifest.go +++ b/chain/actors/manifest.go @@ -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 diff --git a/chain/vm/fvm.go b/chain/vm/fvm.go index a22020d83fb..14421bfcc82 100644 --- a/chain/vm/fvm.go +++ b/chain/vm/fvm.go @@ -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 diff --git a/cli/init.go b/cli/init.go new file mode 100644 index 00000000000..f908115561e --- /dev/null +++ b/cli/init.go @@ -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)) + } + } +} diff --git a/itests/kit/ensemble.go b/itests/kit/ensemble.go index 6149758d63f..d9eb9a2fdeb 100644 --- a/itests/kit/ensemble.go +++ b/itests/kit/ensemble.go @@ -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,