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

feat: refactor: actor bundling system #8838

Merged
merged 10 commits into from
Jun 13, 2022
Merged

feat: refactor: actor bundling system #8838

merged 10 commits into from
Jun 13, 2022

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Jun 10, 2022

Related Issues

fixes #8701

Proposed Changes

  1. Include the builtin-actors in the lotus source tree.
  2. Embed the bundle on build instead of downloading at runtime.
  3. Avoid reading the bundle whenever possible by including bundle metadata (the bundle CID, the actor CIDs, etc.).
  4. Remove everything related to dependency injection.
    1. We're no longer downloading the bundle, so doing anything ahead of time doesn't really help.
    2. We register the manifests on init because, unfortunately, they're global.
    3. We explicitly load the current actors bundle in the genesis state-tree method.
    4. For testing, we just change the in-use bundle with a bit of a hack. It's not great, but using dependency injection doesn't make any sense either because, again, the manifest information is global.
  5. Remove the bundle.toml file. Bundles may be overridden by specifying an override path in the parameters file, or an environment variable.

Checklist

Before you mark the PR ready for review, please make sure that:

  • All commits have a clear commit message.
  • The PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, INTERFACE BREAKING CHANGE, CONSENSUS BREAKING, build, chore, ci, docs,perf, refactor, revert, style, test
    • area: api, chain, state, vm, data transfer, market, mempool, message, block production, multisig, networking, paychan, proving, sealing, wallet, deps
  • This PR has tests for new functionality or change in behaviour
  • If new user-facing features are introduced, clear usage guidelines and / or documentation updates should be included in https://lotus.filecoin.io or Discussion Tutorials.
  • CI is green

TODO

  • Add a test to make sure that the generated bundle metadata matches the embedded bundle.
  • Test to make sure that loading from paths still works correctly.

Maybes:

  • Cleanup/improve the download script? Maybe add a make target?
  • Merge some of the methods in chain/actors/builtin/builtin.go with chain/actors/bundle.go, because they're basically the same.

@Stebalien Stebalien force-pushed the feat/builtin-bundle branch 2 times, most recently from 01e4341 to e2a28d3 Compare June 10, 2022 03:44
build/params_2k.go Show resolved Hide resolved
chain/actors/builtin/builtin.go Show resolved Hide resolved
chain/consensus/filcns/upgrades.go Show resolved Hide resolved
cmd/lotus-miner/init.go Show resolved Hide resolved
@@ -580,12 +578,7 @@ var genesisCarCmd = &cli.Command{
bstor := blockstore.WrapIDStore(blockstore.NewMemorySync())
sbldr := vm.Syscalls(ffiwrapper.ProofVerifier)

// load appropriate bundles
if err := bundle.FetchAndLoadBundles(c.Context, bstor, build.BuiltinActorReleases); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

MakeInitialStateTree now loads the actors bundle, if necessary, for us.

itests/kit/ensemble.go Outdated Show resolved Hide resolved
lotuspond/front/src/chain/methods.json Outdated Show resolved Hide resolved
node/builder_miner.go Show resolved Hide resolved
@Stebalien Stebalien force-pushed the feat/builtin-bundle branch 2 times, most recently from 3b18d2c to e9d419f Compare June 10, 2022 04:59
paychmgr/paychget_test.go Outdated Show resolved Hide resolved
@Stebalien

This comment was marked as resolved.

1. Include the builtin-actors in the lotus source tree.
2. Embed the bundle on build instead of downloading at runtime.
3. Avoid reading the bundle whenever possible by including bundle
   metadata (the bundle CID, the actor CIDs, etc.).
4. Remove everything related to dependency injection.
    1. We're no longer downloading the bundle, so doing anything ahead
       of time doesn't really help.
    2. We register the manifests on init because, unfortunately, they're
       global.
    3. We explicitly load the current actors bundle in the genesis
       state-tree method.
    4. For testing, we just change the in-use bundle with a bit of a
       hack. It's not great, but using dependency injection doesn't make
       any sense either because, again, the manifest information is
       global.

fixes #8701
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.

Direction generally LGTM.

build/params_debug.go Outdated Show resolved Hide resolved
@Stebalien Stebalien force-pushed the feat/builtin-bundle branch 6 times, most recently from 8d927ed to a0f907f Compare June 10, 2022 22:51
Instead, we override bundles using environment variables and overrides
in the build parameter files.
@Stebalien Stebalien marked this pull request as ready for review June 10, 2022 23:00
@Stebalien Stebalien requested a review from a team as a code owner June 10, 2022 23:00
1. Use mockProofs to determine the correct test bundle.
2. Don't even bother setting InsecurePoStValidation for itests, it's
already set.
This gets tested:

1. When we load dynamically (by path) specified bundles.
2. When we decode the embedded bundles to generate the metadata.

Effectively, this lets us test that the embedded bundles are actually
correct.
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.

One question, but this seems like a major improvement!

build/builtin_actors.go Show resolved Hide resolved
@jennijuju jennijuju changed the title Refactor actor bundling system feat: refactor: actor bundling system Jun 13, 2022
@@ -295,6 +295,12 @@ actors-gen:
$(GOCC) run ./chain/actors/agen
$(GOCC) fmt ./...

bundle-gen:
Copy link
Member

Choose a reason for hiding this comment

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

bundle-jen?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a must-have.

build/actors/README.md Outdated Show resolved Hide resolved
This will:

1. Download the actors bundles and pack them into the appropriate tarfile.
2. Run `make bundle-gen` in the top-level directory to regenerate the bundle metadata file.
Copy link
Member

Choose a reason for hiding this comment

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

can one specify two versions at one time?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, you'd have to run the command for each version/release you want to download.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I see. make bundle-gen will generate the metadata for all versions.

@Stebalien Stebalien merged commit 30981d0 into master Jun 13, 2022
@Stebalien Stebalien deleted the feat/builtin-bundle branch June 13, 2022 17:15
Stebalien added a commit that referenced this pull request Jun 13, 2022
1. Include the builtin-actors in the lotus source tree.
2. Embed the bundle on build instead of downloading at runtime.
3. Avoid reading the bundle whenever possible by including bundle
   metadata (the bundle CID, the actor CIDs, etc.).
4. Remove everything related to dependency injection.
    1. We're no longer downloading the bundle, so doing anything ahead
       of time doesn't really help.
    2. We register the manifests on init because, unfortunately, they're
       global.
    3. We explicitly load the current actors bundle in the genesis
       state-tree method.
    4. For testing, we just change the in-use bundle with a bit of a
       hack. It's not great, but using dependency injection doesn't make
       any sense either because, again, the manifest information is
       global.
    5. Remove the bundle.toml file. Bundles may be overridden by
       specifying an override path in the parameters file, or an
       environment variable.

fixes #8701
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.

Embed the bundles during make
4 participants