-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: actors: Integrate datacap actor (#5362)
* feat: actors: Integrate datacap actor * fix: state: Return beneficiary info from miner state Info() * fix: make api-gen
- Loading branch information
Showing
24 changed files
with
309 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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{} | ||
} |
Oops, something went wrong.