lotus/chain/actors/builtin/README.md
Steven Allen d3594835c4 [WIP] Network upgrade support
This patch starts adding support for network upgrades.

* It adds an actors abstraction layer for loading abstract (cross-version) actors.
* It starts switching over to a shared deadline type.
* It adds an abstraction for ADTs (hamt/amt).
* It removes the callback-based API in the StateManager (difficult to abstract
across actor versions).
* It _does not_ actually add support for actors v2. We can do that in a followup
patch but that should be relatively easy.

This patch is heavily WIP and does not compile. Feel free to push changes
directly to this branch.

Notes:

* State tree access now needs a network version, because the HAMT type will change.
* I haven't figured out a nice way to abstract over changes to the _message_
types. However, many of them will be type aliased to actors v0 in actors v2 so
we can likely continue using the v0 versions (or use the v2 versions
everywhere). I've been renaming imports to `v0*` to make it clear that we're
importing types from a _specific_ actors version.

TODO:

* Consider merging incremental improvements? We'd have to get this compiling
again first but we could merge in the new abstractions, and slowly switch over.
* Finish migrating to the new abstractions.
* Remove all actor state types from the public API. See `miner.State.Info()` for
the planned approach here.
* Fix the tests. This is likely going to be a massive pain.
2020-09-11 20:16:29 -07:00

1017 B

Actors

This package contains shims for abstracting over different actor versions.

Design

Shims in this package follow a few common design principles.

Structure Agnostic

Shims interfaces defined in this package should (ideally) not change even if the structure of the underlying data changes. For example:

  • All shims store an internal "store" object. That way, state can be moved into a separate object without needing to add a store to the function signature.
  • All functions must return an error, even if unused for now.

Minimal

These interfaces should be expanded only as necessary to reduce maintenance burden.

Queries, not field assessors.

When possible, functions should query the state instead of simply acting as field assessors. These queries are more likely to remain stable across specs-actor upgrades than specific state fields.

Note: there is a trade-off here. Avoid implementing complicated query logic inside these shims, as it will need to be replicated in every shim.