diff --git a/app/submodule/chain/chaininfo_api.go b/app/submodule/chain/chaininfo_api.go index 238b0f6b11..2829528293 100644 --- a/app/submodule/chain/chaininfo_api.go +++ b/app/submodule/chain/chaininfo_api.go @@ -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 { diff --git a/go.mod b/go.mod index 385c95d332..3016c74a3e 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 9f1d7c04a4..21de593e83 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/pkg/fork/fork.go b/pkg/fork/fork.go index 78f1386f2f..6f048271b8 100644 --- a/pkg/fork/fork.go +++ b/pkg/fork/fork.go @@ -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) @@ -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)) } @@ -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) } diff --git a/pkg/fvm/fvm.go b/pkg/fvm/fvm.go index 5dc4bab103..eb1d0c589d 100644 --- a/pkg/fvm/fvm.go +++ b/pkg/fvm/fvm.go @@ -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) diff --git a/venus-devtool/compatible/actors/main.go b/venus-devtool/compatible/actors/main.go index 2eaebce539..24a2954dbd 100644 --- a/venus-devtool/compatible/actors/main.go +++ b/venus-devtool/compatible/actors/main.go @@ -9,6 +9,7 @@ import ( "regexp" "strings" + "github.com/filecoin-project/lotus/chain/actors" "github.com/urfave/cli/v2" ) @@ -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) } diff --git a/venus-devtool/compatible/actors/render.go b/venus-devtool/compatible/actors/render.go index 236ad675c8..9046bde55d 100644 --- a/venus-devtool/compatible/actors/render.go +++ b/venus-devtool/compatible/actors/render.go @@ -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) @@ -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 { @@ -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, }) @@ -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{}{ diff --git a/venus-devtool/compatible/actors/source.go b/venus-devtool/compatible/actors/source.go deleted file mode 100644 index 06ab7d0f9a..0000000000 --- a/venus-devtool/compatible/actors/source.go +++ /dev/null @@ -1 +0,0 @@ -package main diff --git a/venus-devtool/go.mod b/venus-devtool/go.mod index 778cd1cbae..05389b179e 100644 --- a/venus-devtool/go.mod +++ b/venus-devtool/go.mod @@ -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 @@ -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 ) diff --git a/venus-devtool/go.sum b/venus-devtool/go.sum index 063f463d4e..e82ee2ee8c 100644 --- a/venus-devtool/go.sum +++ b/venus-devtool/go.sum @@ -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= @@ -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= @@ -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= @@ -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= @@ -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= @@ -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= @@ -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= diff --git a/venus-shared/actors/actor_cids.go b/venus-shared/actors/actor_cids.go index 1f5d6ed776..4be79b6eab 100644 --- a/venus-shared/actors/actor_cids.go +++ b/venus-shared/actors/actor_cids.go @@ -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 { diff --git a/venus-shared/actors/builtin/datacap/actor.go b/venus-shared/actors/builtin/datacap/actor.go new file mode 100644 index 0000000000..5c257a0bbe --- /dev/null +++ b/venus-shared/actors/builtin/datacap/actor.go @@ -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{} +} diff --git a/venus-shared/actors/builtin/datacap/actor.go.template b/venus-shared/actors/builtin/datacap/actor.go.template new file mode 100644 index 0000000000..4f553ecc43 --- /dev/null +++ b/venus-shared/actors/builtin/datacap/actor.go.template @@ -0,0 +1,57 @@ +// FETCHED FROM LOTUS: builtin/datacap/actor.go.template + +package datacap + +import ( + "fmt" + + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + actorstypes "github.com/filecoin-project/go-state-types/actors" + builtin{{.latestVersion}} "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 { + {{range .versions}} + case actorstypes.Version{{.}}: + return load{{.}}(store, act.Head) + {{end}} + } + } + + 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 { +{{range .versions}} + case actorstypes.Version{{.}}: + return make{{.}}(store, governor, bitwidth) + + default: return nil, fmt.Errorf("datacap actor only valid for actors v9 and above, got %d", av) +{{end}} + } +} + +type State interface { + cbor.Marshaler + + Governor() (address.Address, error) + GetState() interface{} +} diff --git a/venus-shared/actors/builtin/datacap/state.sep.go.template b/venus-shared/actors/builtin/datacap/state.sep.go.template new file mode 100644 index 0000000000..16e2e47576 --- /dev/null +++ b/venus-shared/actors/builtin/datacap/state.sep.go.template @@ -0,0 +1,52 @@ +// FETCHED FROM LOTUS: builtin/datacap/state.go.template + +package datacap + +import ( + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + "github.com/ipfs/go-cid" + + "github.com/filecoin-project/venus/venus-shared/actors" + "github.com/filecoin-project/venus/venus-shared/actors/adt" + + datacap{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}datacap" + adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt" + builtin{{.v}} "github.com/filecoin-project/go-state-types/builtin" +) + +var _ State = (*state{{.v}})(nil) + +func load{{.v}}(store adt.Store, root cid.Cid) (State, error) { + out := state{{.v}}{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make{{.v}}(store adt.Store, governor address.Address, bitwidth uint64) (State, error) { + out := state{{.v}}{store: store} + s, err := datacap{{.v}}.ConstructState(store, governor, bitwidth) + if err != nil { + return nil, err + } + + out.State = *s + + return &out, nil +} + +type state{{.v}} struct { + datacap{{.v}}.State + store adt.Store +} + +func (s *state{{.v}}) Governor() (address.Address, error) { + return s.State.Governor, nil +} + +func (s *state{{.v}}) GetState() interface{} { + return &s.State +} diff --git a/venus-shared/actors/builtin/datacap/state.v9.go b/venus-shared/actors/builtin/datacap/state.v9.go new file mode 100644 index 0000000000..2ed92e39ad --- /dev/null +++ b/venus-shared/actors/builtin/datacap/state.v9.go @@ -0,0 +1,48 @@ +// FETCHED FROM LOTUS: builtin/datacap/state.go.template + +package datacap + +import ( + "github.com/filecoin-project/go-address" + "github.com/ipfs/go-cid" + + "github.com/filecoin-project/venus/venus-shared/actors/adt" + + datacap9 "github.com/filecoin-project/go-state-types/builtin/v9/datacap" +) + +var _ State = (*state9)(nil) + +func load9(store adt.Store, root cid.Cid) (State, error) { + out := state9{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make9(store adt.Store, governor address.Address, bitwidth uint64) (State, error) { + out := state9{store: store} + s, err := datacap9.ConstructState(store, governor, bitwidth) + if err != nil { + return nil, err + } + + out.State = *s + + return &out, nil +} + +type state9 struct { + datacap9.State + store adt.Store +} + +func (s *state9) Governor() (address.Address, error) { + return s.State.Governor, nil +} + +func (s *state9) GetState() interface{} { + return &s.State +} diff --git a/venus-shared/actors/builtin/miner/state.sep.go.template b/venus-shared/actors/builtin/miner/state.sep.go.template index 55f372baa7..42c9855a44 100644 --- a/venus-shared/actors/builtin/miner/state.sep.go.template +++ b/venus-shared/actors/builtin/miner/state.sep.go.template @@ -415,6 +415,10 @@ func (s *state{{.v}}) Info() (MinerInfo, error) { SectorSize: info.SectorSize, WindowPoStPartitionSectors: info.WindowPoStPartitionSectors, ConsensusFaultElapsed: {{if (ge .v 2)}}info.ConsensusFaultElapsed{{else}}-1{{end}}, + {{if (ge .v 9)}} + Beneficiary: info.Beneficiary, + BeneficiaryTerm: info.BeneficiaryTerm, + PendingBeneficiaryTerm: info.PendingBeneficiaryTerm,{{end}} } return mi, nil diff --git a/venus-shared/actors/builtin/miner/state.v9.go b/venus-shared/actors/builtin/miner/state.v9.go index ea67b528e3..4548504322 100644 --- a/venus-shared/actors/builtin/miner/state.v9.go +++ b/venus-shared/actors/builtin/miner/state.v9.go @@ -385,6 +385,10 @@ func (s *state9) Info() (MinerInfo, error) { SectorSize: info.SectorSize, WindowPoStPartitionSectors: info.WindowPoStPartitionSectors, ConsensusFaultElapsed: info.ConsensusFaultElapsed, + + Beneficiary: info.Beneficiary, + BeneficiaryTerm: info.BeneficiaryTerm, + PendingBeneficiaryTerm: info.PendingBeneficiaryTerm, } return mi, nil diff --git a/venus-shared/actors/builtin_actors_test.go b/venus-shared/actors/builtin_actors_test.go index 782ec676c0..1e4af87454 100644 --- a/venus-shared/actors/builtin_actors_test.go +++ b/venus-shared/actors/builtin_actors_test.go @@ -21,7 +21,7 @@ func TestRegistration(t *testing.T) { require.True(t, found) require.True(t, manifestCid.Defined()) - for _, key := range GetBuiltinActorsKeys() { + for _, key := range GetBuiltinActorsKeys(actorstypes.Version8) { actorCid, found := GetActorCodeID(actorstypes.Version8, key) require.True(t, found) name, version, found := GetActorMetaByCode(actorCid) diff --git a/venus-shared/actors/manifest.go b/venus-shared/actors/manifest.go index de69f774e3..3b69882a8b 100644 --- a/venus-shared/actors/manifest.go +++ b/venus-shared/actors/manifest.go @@ -31,10 +31,11 @@ const ( RewardKey = "reward" SystemKey = "system" VerifregKey = "verifiedregistry" + DatacapKey = "datacap" ) -func GetBuiltinActorsKeys() []string { - return []string{ +func GetBuiltinActorsKeys(av actorstypes.Version) []string { + keys := []string{ AccountKey, CronKey, InitKey, @@ -47,6 +48,10 @@ func GetBuiltinActorsKeys() []string { SystemKey, VerifregKey, } + if av >= 9 { + keys = append(keys, DatacapKey) + } + return keys } var ( @@ -58,7 +63,7 @@ type actorEntry struct { version actorstypes.Version } -// ClearManifest clears all known manifests. This is usually used in tests that need to switch networks. +// ClearManifests clears all known manifests. This is usually used in tests that need to switch networks. func ClearManifests() { manifestMx.Lock() defer manifestMx.Unlock() @@ -103,12 +108,14 @@ func ReadManifest(ctx context.Context, store cbor.IpldStore, mfCid cid.Cid) (map return nil, fmt.Errorf("error loading manifest (cid: %s): %w", mfCid, err) } - actorKeys := GetBuiltinActorsKeys() // TODO: we should be able to enumerate manifests directly. - metadata := make(map[string]cid.Cid, len(actorKeys)) - for _, name := range actorKeys { - if c, ok := mf.Get(name); ok { - metadata[name] = c - } + var manifestData manifest.ManifestData + if err := store.Get(ctx, mf.Data, &manifestData); err != nil { + return nil, fmt.Errorf("error loading manifest data: %w", err) + } + + metadata := make(map[string]cid.Cid) + for _, entry := range manifestData.Entries { + metadata[entry.Name] = entry.Code } return metadata, nil diff --git a/venus-shared/api/wallet/method.md b/venus-shared/api/wallet/method.md index dd9f6ba4a0..eba66dfc20 100644 --- a/venus-shared/api/wallet/method.md +++ b/venus-shared/api/wallet/method.md @@ -67,7 +67,7 @@ Inputs: ```json [ [ - "string value" + "write" ] ] ``` @@ -90,7 +90,7 @@ Inputs: Response: ```json [ - "string value" + "write" ] ``` diff --git a/venus-shared/api/wallet/mock/mock_ifullapi.go b/venus-shared/api/wallet/mock/mock_ifullapi.go index 1b17379848..9b9f4e7f7f 100644 --- a/venus-shared/api/wallet/mock/mock_ifullapi.go +++ b/venus-shared/api/wallet/mock/mock_ifullapi.go @@ -9,6 +9,7 @@ import ( reflect "reflect" address "github.com/filecoin-project/go-address" + auth "github.com/filecoin-project/go-jsonrpc/auth" crypto "github.com/filecoin-project/go-state-types/crypto" internal "github.com/filecoin-project/venus/venus-shared/internal" types "github.com/filecoin-project/venus/venus-shared/types" @@ -98,7 +99,7 @@ func (mr *MockIFullAPIMockRecorder) AddSupportAccount(arg0, arg1 interface{}) *g } // AuthNew mocks base method. -func (m *MockIFullAPI) AuthNew(arg0 context.Context, arg1 []string) ([]byte, error) { +func (m *MockIFullAPI) AuthNew(arg0 context.Context, arg1 []auth.Permission) ([]byte, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AuthNew", arg0, arg1) ret0, _ := ret[0].([]byte) @@ -113,10 +114,10 @@ func (mr *MockIFullAPIMockRecorder) AuthNew(arg0, arg1 interface{}) *gomock.Call } // AuthVerify mocks base method. -func (m *MockIFullAPI) AuthVerify(arg0 context.Context, arg1 string) ([]string, error) { +func (m *MockIFullAPI) AuthVerify(arg0 context.Context, arg1 string) ([]auth.Permission, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AuthVerify", arg0, arg1) - ret0, _ := ret[0].([]string) + ret0, _ := ret[0].([]auth.Permission) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/venus-shared/compatible-checks/actor-sources.txt b/venus-shared/compatible-checks/actor-sources.txt index 4aa53bb5d7..ef28938e77 100644 --- a/venus-shared/compatible-checks/actor-sources.txt +++ b/venus-shared/compatible-checks/actor-sources.txt @@ -29,6 +29,8 @@ SOURCES IN chain/actors: builtin/cron/v7.go builtin/cron/v8.go builtin/cron/v9.go + builtin/datacap/datacap.go + builtin/datacap/v9.go builtin/init/diff.go builtin/init/init.go builtin/init/v0.go diff --git a/venus-shared/compatible-checks/actor-templates.txt b/venus-shared/compatible-checks/actor-templates.txt index 5aa537eb3e..6b7ef4c1eb 100644 --- a/venus-shared/compatible-checks/actor-templates.txt +++ b/venus-shared/compatible-checks/actor-templates.txt @@ -4,6 +4,8 @@ TEMPLATES IN chain/actors: builtin/builtin.go.template builtin/cron/actor.go.template builtin/cron/state.go.template + builtin/datacap/actor.go.template + builtin/datacap/state.go.template builtin/init/actor.go.template builtin/init/state.go.template builtin/market/actor.go.template diff --git a/venus-shared/compatible-checks/api-checksum.txt b/venus-shared/compatible-checks/api-checksum.txt index 371038bda0..7854255486 100644 --- a/venus-shared/compatible-checks/api-checksum.txt +++ b/venus-shared/compatible-checks/api-checksum.txt @@ -1,6 +1,6 @@ v0api.FullNode: - AuthNew: In=2, Out=2, CheckSum=248fe5ed43f2e294ea5d71596b9272ac - AuthVerify: In=2, Out=2, CheckSum=c156d52455ed5f2d227e08a518d5f8a1 + AuthNew: In=2, Out=2, CheckSum=faeef9dc68d6f2533bdf7d8f22ef902d + AuthVerify: In=2, Out=2, CheckSum=3cb63db9d6f8869fd4e9da953cc9cdcb BeaconGetEntry: In=2, Out=2, CheckSum=c74f5c0f4039207ea45c11bfe3319c38 ChainDeleteObj: In=2, Out=1, CheckSum=50d40a0afa31dabb8a61693aabea61b7 ChainExport: In=4, Out=2, CheckSum=aaf98926e0ba36ec808a96de76a3cd98 @@ -218,8 +218,8 @@ v0api.FullNode: WalletVerify: In=4, Out=2, CheckSum=9b22231e95efdfb94d9d55038f500636 api.FullNode: - AuthNew: In=2, Out=2, CheckSum=248fe5ed43f2e294ea5d71596b9272ac - AuthVerify: In=2, Out=2, CheckSum=c156d52455ed5f2d227e08a518d5f8a1 + AuthNew: In=2, Out=2, CheckSum=faeef9dc68d6f2533bdf7d8f22ef902d + AuthVerify: In=2, Out=2, CheckSum=3cb63db9d6f8869fd4e9da953cc9cdcb ChainBlockstoreInfo: In=1, Out=2, CheckSum=09640e20c6d71c3e96c7a56c8698acc9 ChainCheckBlockstore: In=1, Out=1, CheckSum=c39be30cc5a8826024fcf4d23e7017d6 ChainDeleteObj: In=2, Out=1, CheckSum=50d40a0afa31dabb8a61693aabea61b7