fixup merge artifacts
This commit is contained in:
parent
64798d081d
commit
2b23372ad3
@ -14,7 +14,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/eam"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v10/eam"
|
||||
typescrypto "github.com/filecoin-project/go-state-types/crypto"
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
|
@ -12,8 +12,9 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
gocrypto "github.com/filecoin-project/go-crypto"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/evm"
|
||||
init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v10/evm"
|
||||
init10 "github.com/filecoin-project/go-state-types/builtin/v10/init"
|
||||
crypto1 "github.com/filecoin-project/go-state-types/crypto"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
@ -67,16 +68,16 @@ func TestTransformParams(t *testing.T) {
|
||||
})
|
||||
require.Nil(t, err)
|
||||
|
||||
evmActorCid, ok := actors.GetActorCodeID(actors.Version8, "reward")
|
||||
evmActorCid, ok := actors.GetActorCodeID(actorstypes.Version10, "reward")
|
||||
require.True(t, ok)
|
||||
|
||||
params, err := actors.SerializeParams(&init8.ExecParams{
|
||||
params, err := actors.SerializeParams(&init10.ExecParams{
|
||||
CodeCID: evmActorCid,
|
||||
ConstructorParams: constructorParams,
|
||||
})
|
||||
require.Nil(t, err)
|
||||
|
||||
var exec init8.ExecParams
|
||||
var exec init10.ExecParams
|
||||
reader := bytes.NewReader(params)
|
||||
err1 := exec.UnmarshalCBOR(reader)
|
||||
require.Nil(t, err1)
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/multiformats/go-multihash"
|
||||
"github.com/multiformats/go-varint"
|
||||
@ -20,8 +19,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/eam"
|
||||
init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v10/eam"
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
)
|
||||
|
@ -676,7 +676,7 @@ func MakeGenesisBlock(ctx context.Context, j journal.Journal, bs bstore.Blocksto
|
||||
|
||||
func SetupEAM(_ context.Context, nst *state.StateTree) error {
|
||||
// TODO Version10
|
||||
codecid, ok := actors.GetActorCodeID(actors.Version8, actors.EamKey)
|
||||
codecid, ok := actors.GetActorCodeID(actorstypes.Version10, actors.EamKey)
|
||||
if !ok {
|
||||
return fmt.Errorf("failed to get CodeCID for EAM during genesis")
|
||||
}
|
||||
|
104
cli/chain.go
104
cli/chain.go
@ -29,9 +29,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
|
||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||
evm "github.com/filecoin-project/go-state-types/builtin/v10/evm"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/eam"
|
||||
init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v10/eam"
|
||||
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/account"
|
||||
@ -1488,106 +1486,6 @@ var ChainPruneCmd = &cli.Command{
|
||||
Value: false,
|
||||
Usage: "use moving gc for garbage collecting the coldstore",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
afmt := NewAppFmt(cctx.App)
|
||||
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
if !cctx.Args().Present() {
|
||||
return fmt.Errorf("must pass the filename containing actor code")
|
||||
}
|
||||
|
||||
filename := cctx.Args().First()
|
||||
file, err := os.Open(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close() // nolint
|
||||
|
||||
code, err := io.ReadAll(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params, err := actors.SerializeParams(&init8.InstallParams{
|
||||
Code: code,
|
||||
})
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to serialize params: %w", err)
|
||||
}
|
||||
|
||||
var fromAddr address.Address
|
||||
if from := cctx.String("from"); from == "" {
|
||||
defaddr, err := api.WalletDefaultAddress(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fromAddr = defaddr
|
||||
} else {
|
||||
addr, err := address.NewFromString(from)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fromAddr = addr
|
||||
}
|
||||
|
||||
msg := &types.Message{
|
||||
To: builtin.InitActorAddr,
|
||||
From: fromAddr,
|
||||
Value: big.Zero(),
|
||||
Method: 4,
|
||||
Params: params,
|
||||
}
|
||||
|
||||
afmt.Println("sending message...")
|
||||
smsg, err := api.MpoolPushMessage(ctx, msg, nil)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to push message: %w", err)
|
||||
}
|
||||
|
||||
afmt.Printf("gas limit: %d\n", smsg.Message.GasLimit)
|
||||
|
||||
afmt.Println("waiting for message to execute...")
|
||||
wait, err := api.StateWaitMsg(ctx, smsg.Cid(), 0)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("error waiting for message: %w", err)
|
||||
}
|
||||
|
||||
// check it executed successfully
|
||||
if wait.Receipt.ExitCode != 0 {
|
||||
return xerrors.Errorf("actor installation failed")
|
||||
}
|
||||
|
||||
var result init8.InstallReturn
|
||||
r := bytes.NewReader(wait.Receipt.Return)
|
||||
if err := result.UnmarshalCBOR(r); err != nil {
|
||||
return xerrors.Errorf("error unmarshaling return value: %w", err)
|
||||
}
|
||||
|
||||
afmt.Printf("Actor Code CID: %s\n", result.CodeCid)
|
||||
afmt.Printf("Installed: %t\n", result.Installed)
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var ChainExecCmd = &cli.Command{
|
||||
Name: "create-actor",
|
||||
Usage: "Create an new actor via the init actor and return its address",
|
||||
ArgsUsage: "code-cid [params]",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "from",
|
||||
Usage: "optionally specify the account to use for sending the exec message",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "move-to",
|
||||
Value: "",
|
||||
|
@ -15,8 +15,8 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/eam"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/evm"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v10/eam"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v10/evm"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
|
Loading…
Reference in New Issue
Block a user