Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIP0031 refinements #8429

Merged
merged 69 commits into from
Apr 15, 2022
Merged

FIP0031 refinements #8429

merged 69 commits into from
Apr 15, 2022

Conversation

vyzo
Copy link
Contributor

@vyzo vyzo commented Apr 4, 2022

This embeds the bundle for v8; long run we want to autofetch from IPFS, but we discussed this with @raulk and decided it is fine for now, avoiding scope creep.

As it is it will load and embed the bundle from build/builtin-actors/builtin-actors-v8.car.

TBD:

@vyzo vyzo requested review from magik6k and arajasek April 4, 2022 11:35
@vyzo vyzo requested a review from a team as a code owner April 4, 2022 11:35
Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First limited pass.

You probably want to run full make gen to fix codegen issues.

node/builder_chain.go Outdated Show resolved Hide resolved
chain/actors/manifest.go Show resolved Hide resolved
Copy link
Contributor

@arajasek arajasek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vyzo
Copy link
Contributor Author

vyzo commented Apr 8, 2022

sure!

Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments

build/builtin-actors/fetch-bundles.sh Outdated Show resolved Hide resolved
chain/actors/agen/main.go Outdated Show resolved Hide resolved
chain/actors/builtin/market/state.go.template Outdated Show resolved Hide resolved
chain/consensus/filcns/upgrades.go Outdated Show resolved Hide resolved
chain/actors/builtin/power/power.go Outdated Show resolved Hide resolved

for _, a := range acts {
err = st.MutateActor(a, func(act *types.Actor) error {
name := actors.CanonicalName(builtin.ActorNameByCode(act.Code))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't we just putting those actors with correct CIDs right away?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the correct cids... thays a big conversation, but it is not workable to expect specs-actors to have baked in the correct CIDs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The manifest should allow us to remove the baked-in code cids from v8 specs-actors, no?

Comment on lines +377 to +418
// 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be fixed once we have test bundles to load.

node/builder_chain.go Outdated Show resolved Hide resolved
@vyzo
Copy link
Contributor Author

vyzo commented Apr 12, 2022

So the merge overwrote the specs-actors dep and results in a broken manifest loader; see filecoin-project/specs-actors#1587

@vyzo
Copy link
Contributor Author

vyzo commented Apr 12, 2022

fixed, updated filecoin-project/specs-actors#1587

@vyzo
Copy link
Contributor Author

vyzo commented Apr 12, 2022

Also, the forks_test ended broken; fixed.

@vyzo vyzo changed the title [WIP] FIP0031 refinements FIP0031 refinements Apr 12, 2022
Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels close to being landable

ac := a.Code()
ar.actors[ac] = ai

// necessary to make stuff work
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand in v8 actors we only really need ActorRegistry to map actor method->param type. Ideally we'd move that logic to chain/actors/, and only use the ActorRegistry in LegacyVM (so this would have no method type mappings, and wouldn't need to worry about FVM).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This can be a followup PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed.

Comment on lines +228 to +243
// required for genesis/testing
if nv := rt.NetworkVersion(); nv >= network.Version16 {
name, av, ok := actors.GetActorMetaByCode(act.Code)

if ok {
// lies, lies, lies
builder := cid.V1Builder{Codec: cid.Raw, MhType: mh.IDENTITY}
synthetic := fmt.Sprintf("fil/%d/%s", av, name)
syntheticCid, err := builder.Sum([]byte(synthetic))
if err != nil {
panic(aerrors.Fatalf("failed to generate synthetic CID: %s", err))
}

return syntheticCid, true
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really I think we should be trying to get rid of the id(fil/8/y) code cids from the codebase, otherwise we'll have to translate them back and forth everywhere, which will be really painful, especially with more network upgrades

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I totally agree, but it's not as simple -- we'll have to do some surgery in specs-actors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't we remove most Go specs-actors logic, and mostly just keep the data-accessing bits? That should remove almost all dependencies on old code CIDs. (I'm assuming that builtin-actors don't use them - didn't look at them much yet)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we remove all specs-actors logic we will be fine; really, we should become fvm only, except for state.

node/builder_chain.go Show resolved Hide resolved
@vyzo vyzo changed the base branch from asr/fip-0031 to feat/nv16 April 14, 2022 16:23
@vyzo
Copy link
Contributor Author

vyzo commented Apr 14, 2022

rebased on nv16 and resolved the conflicts; Summoning @arajasek and @magik6k for final review.

@vyzo vyzo mentioned this pull request Apr 14, 2022
6 tasks
@vyzo vyzo requested review from magik6k and arajasek April 14, 2022 17:00
Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • For whatever reason make-gen complains about stuff in build/builtin-actors
  • Something about itests / ensemble is very broken - I'm ok with fixing those in feat/nv16 to not block this any more

cmd/lotus-miner/init.go Outdated Show resolved Hide resolved
Comment on lines +228 to +243
// required for genesis/testing
if nv := rt.NetworkVersion(); nv >= network.Version16 {
name, av, ok := actors.GetActorMetaByCode(act.Code)

if ok {
// lies, lies, lies
builder := cid.V1Builder{Codec: cid.Raw, MhType: mh.IDENTITY}
synthetic := fmt.Sprintf("fil/%d/%s", av, name)
syntheticCid, err := builder.Sum([]byte(synthetic))
if err != nil {
panic(aerrors.Fatalf("failed to generate synthetic CID: %s", err))
}

return syntheticCid, true
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't we remove most Go specs-actors logic, and mostly just keep the data-accessing bits? That should remove almost all dependencies on old code CIDs. (I'm assuming that builtin-actors don't use them - didn't look at them much yet)

@@ -580,6 +580,23 @@ func MakeGenesisBlock(ctx context.Context, j journal.Journal, bs bstore.Blocksto
return nil, xerrors.Errorf("setup miners failed: %w", err)
}

if template.NetworkVersion >= network.Version16 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might not be easy, but we should make the genesis logic use the FVM. Definitely not needed now, but this is the only thing which depends on a big chunk of Go specs-actors logic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(definitely not something we want to do in this PR / not needed for M1)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, agreed. The sooner specs-actors retires, the better.

chain/gen/genesis/util.go Outdated Show resolved Hide resolved
@vyzo
Copy link
Contributor Author

vyzo commented Apr 15, 2022

yeah, i have no idea whats wrong with make gen.

Itests need a policy adjusted bundle before they can be fixed, i have listed it as TODO follow up in the nv16 tracking pr -- basically improving our bundle situation and fixing itests is next on my pile.

@magik6k magik6k merged commit d1fd3f5 into feat/nv16 Apr 15, 2022
@magik6k magik6k deleted the vyzo/fip-0031 branch April 15, 2022 18:08
@raulk raulk mentioned this pull request Apr 18, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants