Skip to content

Commit

Permalink
feat: actors: Integrate datacap actor (#5362)
Browse files Browse the repository at this point in the history
* feat: actors: Integrate datacap actor

* fix: state: Return beneficiary info from miner state Info()

* fix: make api-gen
  • Loading branch information
simlecode authored Oct 12, 2022
1 parent db9cc19 commit f1e1ca2
Show file tree
Hide file tree
Showing 24 changed files with 309 additions and 53 deletions.
2 changes: 1 addition & 1 deletion app/submodule/chain/chaininfo_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ func (cia *chainInfoAPI) StateActorCodeCIDs(ctx context.Context, nv network.Vers

cids["_manifest"] = manifestCid

var actorKeys = actors.GetBuiltinActorsKeys()
var actorKeys = actors.GetBuiltinActorsKeys(actorVersion)
for _, name := range actorKeys {
actorCID, ok := actors.GetActorCodeID(actorVersion, name)
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/filecoin-project/go-fil-markets v1.24.0
github.com/filecoin-project/go-jsonrpc v0.1.5
github.com/filecoin-project/go-paramfetch v0.0.4
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220920181425-d683559e386b
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220921193302-60676bda3cb5
github.com/filecoin-project/pubsub v1.0.0
github.com/filecoin-project/specs-actors v0.9.15
github.com/filecoin-project/specs-actors/v2 v2.3.6
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ github.com/filecoin-project/go-state-types v0.1.5/go.mod h1:UwGVoMsULoCK+bWjEdd/
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220920181425-d683559e386b h1:s4F3e3EBo56j+4xmrzmoAIvtgvDwLn4nsIf5bqcU0Qg=
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220920181425-d683559e386b/go.mod h1:n/kujdC9JphvYTrmaD1+vJpvDPy/DwzckoMzP0nBKWI=
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220921193302-60676bda3cb5 h1:5FCdArFQ/nzsv2vBJ7ibLnocTf+pnnTVxcF0Ohe97O0=
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220921193302-60676bda3cb5/go.mod h1:n/kujdC9JphvYTrmaD1+vJpvDPy/DwzckoMzP0nBKWI=
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
github.com/filecoin-project/go-statemachine v1.0.2-0.20220322104818-27f8fbb86dfd/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc=
Expand Down
8 changes: 4 additions & 4 deletions pkg/fork/fork.go
Original file line number Diff line number Diff line change
Expand Up @@ -2292,7 +2292,7 @@ func (c *ChainFork) GetForkUpgrade() *config.ForkUpgradeConfig {
// return LiteMigration(ctx, bstore, newActorsManifestCid, root, av, vmstate.StateTreeVersion4, newStateTreeVersion)
// }

func LiteMigration(ctx context.Context, bstore blockstoreutil.Blockstore, newActorsManifestCid cid.Cid, root cid.Cid, av actorstypes.Version, oldStateTreeVersion vmstate.StateTreeVersion, newStateTreeVersion vmstate.StateTreeVersion) (cid.Cid, error) {
func LiteMigration(ctx context.Context, bstore blockstoreutil.Blockstore, newActorsManifestCid cid.Cid, root cid.Cid, oldAv actorstypes.Version, newAv actorstypes.Version, oldStateTreeVersion vmstate.StateTreeVersion, newStateTreeVersion vmstate.StateTreeVersion) (cid.Cid, error) {
buf := blockstoreutil.NewTieredBstore(bstore, blockstoreutil.NewTemporarySync())
store := chain.ActorStore(ctx, buf)
adtStore := gstStore.WrapStore(ctx, store)
Expand Down Expand Up @@ -2332,10 +2332,10 @@ func LiteMigration(ctx context.Context, bstore blockstoreutil.Blockstore, newAct
return cid.Undef, fmt.Errorf("error loading new manifest data: %w", err)
}

if len(oldManifestData.Entries) != len(actors.GetBuiltinActorsKeys()) {
if len(oldManifestData.Entries) != len(actors.GetBuiltinActorsKeys(oldAv)) {
return cid.Undef, fmt.Errorf("incomplete old manifest with %d code CIDs", len(oldManifestData.Entries))
}
if len(newManifestData.Entries) != len(actors.GetBuiltinActorsKeys()) {
if len(newManifestData.Entries) != len(actors.GetBuiltinActorsKeys(newAv)) {
return cid.Undef, fmt.Errorf("incomplete new manifest with %d code CIDs", len(newManifestData.Entries))
}

Expand Down Expand Up @@ -2367,7 +2367,7 @@ func LiteMigration(ctx context.Context, bstore blockstoreutil.Blockstore, newAct
}
var head cid.Cid
if addr == system.Address {
newSystemState, err := system.MakeState(store, av, newManifest.Data)
newSystemState, err := system.MakeState(store, newAv, newManifest.Data)
if err != nil {
return fmt.Errorf("could not make system actor state: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/fvm/fvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func NewDebugFVM(ctx context.Context, opts *vm.VmOption) (*FVM, error) {

// create actor redirect mapping
actorRedirect := make(map[cid.Cid]cid.Cid)
for _, key := range actors.GetBuiltinActorsKeys() {
for _, key := range actors.GetBuiltinActorsKeys(av) {
from, ok := actors.GetActorCodeID(av, key)
if !ok {
fvmLog.Warnf("actor missing in the from manifest %s", key)
Expand Down
8 changes: 7 additions & 1 deletion venus-devtool/compatible/actors/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"regexp"
"strings"

"github.com/filecoin-project/lotus/chain/actors"
"github.com/urfave/cli/v2"
)

Expand Down Expand Up @@ -96,7 +97,12 @@ var renderCmd = &cli.Command{

log.Print("rendering")
for _, tpath := range templates {
err = render(filepath.Join(abs, tpath))
versions := actors.Versions
// datacap actor available since version v9
if strings.Contains(tpath, "builtin/datacap") {
versions = actors.Versions[8:]
}
err = render(filepath.Join(abs, tpath), versions)
if err != nil {
return fmt.Errorf("for %s: %w", tpath, err)
}
Expand Down
14 changes: 7 additions & 7 deletions venus-devtool/compatible/actors/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func importPath(v int) string {
return fmt.Sprintf("/v%d/", v)
}

func render(tpath string) error {
func render(tpath string, versions []int) error {
dir := filepath.Dir(tpath)
fname := filepath.Base(tpath)

Expand Down Expand Up @@ -49,9 +49,9 @@ func render(tpath string) error {
}

if separated {
err = renderSeparated(t, dir)
err = renderSeparated(t, dir, versions)
} else {
err = renderSingle(t, dir)
err = renderSingle(t, dir, versions)
}

if err != nil {
Expand All @@ -61,10 +61,10 @@ func render(tpath string) error {
return nil
}

func renderSingle(t *template.Template, dir string) error {
func renderSingle(t *template.Template, dir string, versions []int) error {
var buf bytes.Buffer
err := t.Execute(&buf, map[string]interface{}{
"versions": actors.Versions,
"versions": versions,
"latestVersion": actors.LatestVersion,
})

Expand All @@ -85,9 +85,9 @@ func renderSingle(t *template.Template, dir string) error {
return nil
}

func renderSeparated(t *template.Template, dir string) error {
func renderSeparated(t *template.Template, dir string, versions []int) error {
var buf bytes.Buffer
for _, v := range actors.Versions {
for _, v := range versions {
buf.Reset()

err := t.Execute(&buf, map[string]interface{}{
Expand Down
1 change: 0 additions & 1 deletion venus-devtool/compatible/actors/source.go

This file was deleted.

9 changes: 3 additions & 6 deletions venus-devtool/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ require (
github.com/filecoin-project/go-bitfield v0.2.4
github.com/filecoin-project/go-data-transfer v1.15.2
github.com/filecoin-project/go-fil-markets v1.24.0
github.com/filecoin-project/go-jsonrpc v0.1.7
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220920181425-d683559e386b
github.com/filecoin-project/lotus v1.17.2-0.20220921145658-94add978b01f
github.com/filecoin-project/go-jsonrpc v0.1.8
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220921193302-60676bda3cb5
github.com/filecoin-project/lotus v1.17.2-0.20221006132714-fc59d2b48bb5
github.com/filecoin-project/venus v0.0.0-00010101000000-000000000000
github.com/ipfs/go-block-format v0.0.3
github.com/ipfs/go-cid v0.2.0
Expand Down Expand Up @@ -212,8 +212,5 @@ require (

replace (
github.com/filecoin-project/filecoin-ffi => .././extern/filecoin-ffi
github.com/filecoin-project/go-jsonrpc => github.com/ipfs-force-community/go-jsonrpc v0.1.4-0.20210731021807-68e5207079bc
github.com/filecoin-project/venus => ../
github.com/ipfs/go-ipfs-cmds => github.com/ipfs-force-community/go-ipfs-cmds v0.6.1-0.20210521090123-4587df7fa0ab
github.com/multiformats/go-multiaddr => github.com/multiformats/go-multiaddr v0.3.0
)
38 changes: 29 additions & 9 deletions venus-devtool/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ github.com/filecoin-project/go-hamt-ipld/v3 v3.0.1/go.mod h1:gXpNmr3oQx8l3o7qkGy
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 h1:rVVNq0x6RGQIzCo1iiJlGFm9AGIZzeifggxtKMU7zmI=
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0/go.mod h1:bxmzgT8tmeVQA1/gvBwFmYdT8SOFUwB3ovSUfG1Ux0g=
github.com/filecoin-project/go-indexer-core v0.2.16/go.mod h1:5kCKyhtT9k1vephr9l9SFGX8B/HowXIvOhGCkmbxwbY=
github.com/filecoin-project/go-jsonrpc v0.1.3/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4=
github.com/filecoin-project/go-jsonrpc v0.1.5/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4=
github.com/filecoin-project/go-jsonrpc v0.1.8 h1:uXX/ikAk3Q4f/k8DRd9Zw+fWnfiYb5I+UI1tzlQgHog=
github.com/filecoin-project/go-jsonrpc v0.1.8/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4=
github.com/filecoin-project/go-legs v0.4.4/go.mod h1:JQ3hA6xpJdbR8euZ2rO0jkxaMxeidXf0LDnVuqPAe9s=
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20/go.mod h1:mPn+LRRd5gEKNAtc+r3ScpW2JRU/pj4NBKdADYWHiak=
github.com/filecoin-project/go-padreader v0.0.1 h1:8h2tVy5HpoNbr2gBRr+WD6zV6VD6XHig+ynSGJg8ZOs=
Expand All @@ -415,8 +419,8 @@ github.com/filecoin-project/go-state-types v0.1.5/go.mod h1:UwGVoMsULoCK+bWjEdd/
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220920181425-d683559e386b h1:s4F3e3EBo56j+4xmrzmoAIvtgvDwLn4nsIf5bqcU0Qg=
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220920181425-d683559e386b/go.mod h1:n/kujdC9JphvYTrmaD1+vJpvDPy/DwzckoMzP0nBKWI=
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220921193302-60676bda3cb5 h1:5FCdArFQ/nzsv2vBJ7ibLnocTf+pnnTVxcF0Ohe97O0=
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220921193302-60676bda3cb5/go.mod h1:n/kujdC9JphvYTrmaD1+vJpvDPy/DwzckoMzP0nBKWI=
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
github.com/filecoin-project/go-statemachine v1.0.2-0.20220322104818-27f8fbb86dfd/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc=
Expand All @@ -427,8 +431,8 @@ github.com/filecoin-project/go-statestore v0.2.0/go.mod h1:8sjBYbS35HwPzct7iT4lI
github.com/filecoin-project/go-storedcounter v0.1.0/go.mod h1:4ceukaXi4vFURIoxYMfKzaRF5Xv/Pinh2oTnoxpv+z8=
github.com/filecoin-project/index-provider v0.8.1 h1:ggoBWvMSWR91HZQCWfv8SZjoTGNyJBwNMLuN9bJZrbU=
github.com/filecoin-project/index-provider v0.8.1/go.mod h1:c/Ym5HtWPp9NQgNc9dgSBMpSNsZ/DE9FEi9qVubl5RM=
github.com/filecoin-project/lotus v1.17.2-0.20220921145658-94add978b01f h1:Waagfi15+gDrYHW9cIAgO84MQ0PHktZuG5KGHHFDYWk=
github.com/filecoin-project/lotus v1.17.2-0.20220921145658-94add978b01f/go.mod h1:kITnSb8jWWmbwUdc5AUW0ziRp3M/e94JjBt2AOUInTA=
github.com/filecoin-project/lotus v1.17.2-0.20221006132714-fc59d2b48bb5 h1:4AUrw79ZyeL7xG+wsXB7jEjHxjMr+9vNUA24eHUnwns=
github.com/filecoin-project/lotus v1.17.2-0.20221006132714-fc59d2b48bb5/go.mod h1:v/Exb6aDLJheqMccPX0n1pjaaggrt0VkE3O0KtPiUqI=
github.com/filecoin-project/pubsub v1.0.0 h1:ZTmT27U07e54qV1mMiQo4HDr0buo8I1LDHBYLXlsNXM=
github.com/filecoin-project/pubsub v1.0.0/go.mod h1:GkpB33CcUtUNrLPhJgfdy4FDx4OMNR9k+46DHx/Lqrg=
github.com/filecoin-project/specs-actors v0.9.13/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao=
Expand Down Expand Up @@ -799,10 +803,6 @@ github.com/influxdata/influxdb-client-go/v2 v2.2.2/go.mod h1:fa/d1lAdUHxuc1jedx3
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
github.com/ipfs-force-community/go-ipfs-cmds v0.6.1-0.20210521090123-4587df7fa0ab h1:+Jov61TTljdzTKBecQizmUWJ6IIoVgzjukKppVr5TgI=
github.com/ipfs-force-community/go-ipfs-cmds v0.6.1-0.20210521090123-4587df7fa0ab/go.mod h1:ZgYiWVnCk43ChwoH8hAmI1IRbuVtq3GSTHwtRB/Kqhk=
github.com/ipfs-force-community/go-jsonrpc v0.1.4-0.20210731021807-68e5207079bc h1:L4JH2Ltl/Embq4qYezs3RsIYW1BB/fB9TfUkk42FOzU=
github.com/ipfs-force-community/go-jsonrpc v0.1.4-0.20210731021807-68e5207079bc/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4=
github.com/ipfs-force-community/metrics v1.0.0/go.mod h1:mn40SioMuKtjmRumHFy/fJ26Pn028XuDjUJE9dorjyw=
github.com/ipfs-force-community/metrics v1.0.1-0.20211022060227-11142a08b729/go.mod h1:mn40SioMuKtjmRumHFy/fJ26Pn028XuDjUJE9dorjyw=
github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI=
Expand Down Expand Up @@ -908,6 +908,10 @@ github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcB
github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7NapWLY8=
github.com/ipfs/go-ipfs-chunker v0.0.5/go.mod h1:jhgdF8vxRHycr00k13FM8Y0E+6BoalYeobXmUyTreP8=
github.com/ipfs/go-ipfs-cmdkit v0.0.1/go.mod h1:9FtbMdUabcSqv/G4/8WCxSLxkZxn/aZEFrxxqnVcRbg=
github.com/ipfs/go-ipfs-cmds v0.6.0/go.mod h1:ZgYiWVnCk43ChwoH8hAmI1IRbuVtq3GSTHwtRB/Kqhk=
github.com/ipfs/go-ipfs-cmds v0.6.1-0.20220212012746-40b8fddb899f/go.mod h1:y0bflH6m4g6ary4HniYt98UqbrVnRxmRarzeMdLIUn0=
github.com/ipfs/go-ipfs-cmds v0.7.0 h1:0lEldmB7C83RxIOer38Sv1ob6wIoCAIEOaxiYgcv7wA=
github.com/ipfs/go-ipfs-cmds v0.7.0/go.mod h1:y0bflH6m4g6ary4HniYt98UqbrVnRxmRarzeMdLIUn0=
github.com/ipfs/go-ipfs-config v0.5.3/go.mod h1:nSLCFtlaL+2rbl3F+9D4gQZQbT1LjRKx7TJg/IHz6oM=
github.com/ipfs/go-ipfs-config v0.18.0 h1:Ta1aNGNEq6RIvzbw7dqzCVZJKb7j+Dd35JFnAOCpT8g=
github.com/ipfs/go-ipfs-config v0.18.0/go.mod h1:wz2lKzOjgJeYJa6zx8W9VT7mz+iSd0laBMqS/9wmX6A=
Expand Down Expand Up @@ -1733,8 +1737,22 @@ github.com/multiformats/go-base32 v0.0.4 h1:+qMh4a2f37b4xTNs6mqitDinryCI+tfO2dRV
github.com/multiformats/go-base32 v0.0.4/go.mod h1:jNLFzjPZtp3aIARHbJRZIaPuspdH0J6q39uUM5pnABM=
github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4=
github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM=
github.com/multiformats/go-multiaddr v0.3.0 h1:z1Old9IYcUyMEtSbvwCOJ1jcrmJdU0LYH8aFBvZKzcQ=
github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo=
github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4=
github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z7tZ04iMk5wP4QMGGE=
github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u0xW5UouOmQQrn6a3Y=
github.com/multiformats/go-multiaddr v0.3.0/go.mod h1:dF9kph9wfJ+3VLAaeBqo9Of8x4fJxp6ggJGteB8HQTI=
github.com/multiformats/go-multiaddr v0.3.1/go.mod h1:uPbspcUPd5AfaP6ql3ujFY+QWzmBD8uLLL4bXW0XfGc=
github.com/multiformats/go-multiaddr v0.3.3/go.mod h1:lCKNGP1EQ1eZ35Za2wlqnabm9xQkib3fyB+nZXHLag0=
github.com/multiformats/go-multiaddr v0.4.0/go.mod h1:YcpyLH8ZPudLxQlemYBPhSm0/oCXAT8Z4mzFpyoPyRc=
github.com/multiformats/go-multiaddr v0.4.1/go.mod h1:3afI9HfVW8csiF8UZqtpYRiDyew8pRX7qLIGHu9FLuM=
github.com/multiformats/go-multiaddr v0.5.0/go.mod h1:3KAxNkUqLTJ20AAwN4XVX4kZar+bR+gh4zgbfr3SNug=
github.com/multiformats/go-multiaddr v0.6.0 h1:qMnoOPj2s8xxPU5kZ57Cqdr0hHhARz7mFsPMIiYNqzg=
github.com/multiformats/go-multiaddr v0.6.0/go.mod h1:F4IpaKZuPP360tOMn2Tpyu0At8w23aRyVqeK0DbFeGM=
github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
github.com/multiformats/go-multiaddr-dns v0.0.3/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
Expand Down Expand Up @@ -1789,6 +1807,8 @@ github.com/multiformats/go-multistream v0.3.0/go.mod h1:ODRoqamLUsETKS9BNcII4gcR
github.com/multiformats/go-multistream v0.3.1/go.mod h1:ODRoqamLUsETKS9BNcII4gcRsJBU5VAwRIv7O39cEXg=
github.com/multiformats/go-multistream v0.3.3 h1:d5PZpjwRgVlbwfdTDjife7XszfZd8KYWfROYFlGcR8o=
github.com/multiformats/go-multistream v0.3.3/go.mod h1:ODRoqamLUsETKS9BNcII4gcRsJBU5VAwRIv7O39cEXg=
github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY=
github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
Expand Down
2 changes: 1 addition & 1 deletion venus-shared/actors/actor_cids.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func GetActorCodeIDs(av actorstypes.Version) (map[string]cid.Cid, error) {
return cids, nil
}

actorsKeys := GetBuiltinActorsKeys()
actorsKeys := GetBuiltinActorsKeys(av)
synthCids := make(map[string]cid.Cid)

for _, key := range actorsKeys {
Expand Down
57 changes: 57 additions & 0 deletions venus-shared/actors/builtin/datacap/actor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// FETCHED FROM LOTUS: builtin/datacap/actor.go.template

package datacap

import (
"fmt"

"github.com/filecoin-project/go-address"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/cbor"

"github.com/filecoin-project/venus/venus-shared/actors"
"github.com/filecoin-project/venus/venus-shared/actors/adt"
types "github.com/filecoin-project/venus/venus-shared/internal"
)

var (
Address = builtin9.DatacapActorAddr
Methods = builtin9.MethodsDatacap
)

func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != actors.DatacapKey {
return nil, fmt.Errorf("actor code is not datacap: %s", name)
}

switch av {

case actorstypes.Version9:
return load9(store, act.Head)

}
}

return nil, fmt.Errorf("unknown actor code %s", act.Code)
}

func MakeState(store adt.Store, av actorstypes.Version, governor address.Address, bitwidth uint64) (State, error) {
switch av {

case actorstypes.Version9:
return make9(store, governor, bitwidth)

default:
return nil, fmt.Errorf("datacap actor only valid for actors v9 and above, got %d", av)

}
}

type State interface {
cbor.Marshaler

Governor() (address.Address, error)
GetState() interface{}
}
Loading

0 comments on commit f1e1ca2

Please sign in to comment.