Rename StateReplay to StateTransplant
This commit is contained in:
parent
cb801d47c7
commit
7826cc0bab
@ -320,8 +320,8 @@ type FullNode interface {
|
|||||||
|
|
||||||
// StateCall runs the given message and returns its result without any persisted changes.
|
// StateCall runs the given message and returns its result without any persisted changes.
|
||||||
StateCall(context.Context, *types.Message, types.TipSetKey) (*InvocResult, error)
|
StateCall(context.Context, *types.Message, types.TipSetKey) (*InvocResult, error)
|
||||||
// StateReplay returns the result of executing the indicated message, assuming it was executed in the indicated tipset.
|
// StateTransplant returns the result of executing the indicated message, assuming it was executed in the indicated tipset.
|
||||||
StateReplay(context.Context, types.TipSetKey, cid.Cid) (*InvocResult, error)
|
StateTransplant(context.Context, types.TipSetKey, cid.Cid) (*InvocResult, error)
|
||||||
// StateGetActor returns the indicated actor's nonce and balance.
|
// StateGetActor returns the indicated actor's nonce and balance.
|
||||||
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error)
|
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error)
|
||||||
// StateReadState returns the indicated actor's state.
|
// StateReadState returns the indicated actor's state.
|
||||||
|
@ -188,7 +188,7 @@ type FullNodeStruct struct {
|
|||||||
StateSectorExpiration func(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorExpiration, error) `perm:"read"`
|
StateSectorExpiration func(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorExpiration, error) `perm:"read"`
|
||||||
StateSectorPartition func(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorLocation, error) `perm:"read"`
|
StateSectorPartition func(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorLocation, error) `perm:"read"`
|
||||||
StateCall func(context.Context, *types.Message, types.TipSetKey) (*api.InvocResult, error) `perm:"read"`
|
StateCall func(context.Context, *types.Message, types.TipSetKey) (*api.InvocResult, error) `perm:"read"`
|
||||||
StateReplay func(context.Context, types.TipSetKey, cid.Cid) (*api.InvocResult, error) `perm:"read"`
|
StateTransplant func(context.Context, types.TipSetKey, cid.Cid) (*api.InvocResult, error) `perm:"read"`
|
||||||
StateGetActor func(context.Context, address.Address, types.TipSetKey) (*types.Actor, error) `perm:"read"`
|
StateGetActor func(context.Context, address.Address, types.TipSetKey) (*types.Actor, error) `perm:"read"`
|
||||||
StateReadState func(context.Context, address.Address, types.TipSetKey) (*api.ActorState, error) `perm:"read"`
|
StateReadState func(context.Context, address.Address, types.TipSetKey) (*api.ActorState, error) `perm:"read"`
|
||||||
StateMsgGasCost func(context.Context, cid.Cid, types.TipSetKey) (*api.MsgGasCost, error) `perm:"read"`
|
StateMsgGasCost func(context.Context, cid.Cid, types.TipSetKey) (*api.MsgGasCost, error) `perm:"read"`
|
||||||
@ -880,8 +880,8 @@ func (c *FullNodeStruct) StateCall(ctx context.Context, msg *types.Message, tsk
|
|||||||
return c.Internal.StateCall(ctx, msg, tsk)
|
return c.Internal.StateCall(ctx, msg, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateReplay(ctx context.Context, tsk types.TipSetKey, mc cid.Cid) (*api.InvocResult, error) {
|
func (c *FullNodeStruct) StateTransplant(ctx context.Context, tsk types.TipSetKey, mc cid.Cid) (*api.InvocResult, error) {
|
||||||
return c.Internal.StateReplay(ctx, tsk, mc)
|
return c.Internal.StateTransplant(ctx, tsk, mc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) {
|
func (c *FullNodeStruct) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) {
|
||||||
|
27
cli/state.go
27
cli/state.go
@ -60,7 +60,7 @@ var stateCmd = &cli.Command{
|
|||||||
stateSectorCmd,
|
stateSectorCmd,
|
||||||
stateGetActorCmd,
|
stateGetActorCmd,
|
||||||
stateLookupIDCmd,
|
stateLookupIDCmd,
|
||||||
stateReplaySetCmd,
|
stateTransplantCmd,
|
||||||
stateSectorSizeCmd,
|
stateSectorSizeCmd,
|
||||||
stateReadStateCmd,
|
stateReadStateCmd,
|
||||||
stateListMessagesCmd,
|
stateListMessagesCmd,
|
||||||
@ -384,9 +384,9 @@ var stateExecTraceCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var stateReplaySetCmd = &cli.Command{
|
var stateTransplantCmd = &cli.Command{
|
||||||
Name: "replay",
|
Name: "transplant",
|
||||||
Usage: "Replay a particular message within a tipset",
|
Usage: "Play a particular message within a tipset",
|
||||||
ArgsUsage: "[tipsetKey messageCid]",
|
ArgsUsage: "[tipsetKey messageCid]",
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
if cctx.Args().Len() < 1 {
|
if cctx.Args().Len() < 1 {
|
||||||
@ -437,30 +437,19 @@ var stateReplaySetCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var r *api.MsgLookup
|
ts, err = fapi.ChainHead(ctx)
|
||||||
r, err = fapi.StateWaitMsg(ctx, mcid, build.MessageConfidence)
|
|
||||||
if err != nil {
|
|
||||||
return xerrors.Errorf("finding message in chain: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
childTs, err := fapi.ChainGetTipSet(ctx, r.TipSet)
|
|
||||||
if err != nil {
|
|
||||||
return xerrors.Errorf("loading tipset: %w", err)
|
|
||||||
}
|
|
||||||
ts, err = fapi.ChainGetTipSet(ctx, childTs.Parents())
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := fapi.StateReplay(ctx, ts.Key(), mcid)
|
res, err := fapi.StateTransplant(ctx, ts.Key(), mcid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("replay call failed: %w", err)
|
return xerrors.Errorf("transplant call failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Replay receipt:")
|
fmt.Println("Transplant receipt:")
|
||||||
fmt.Printf("Exit code: %d\n", res.MsgRct.ExitCode)
|
fmt.Printf("Exit code: %d\n", res.MsgRct.ExitCode)
|
||||||
fmt.Printf("Return: %x\n", res.MsgRct.Return)
|
fmt.Printf("Return: %x\n", res.MsgRct.Return)
|
||||||
fmt.Printf("Gas Used: %d\n", res.MsgRct.GasUsed)
|
fmt.Printf("Gas Used: %d\n", res.MsgRct.GasUsed)
|
||||||
|
@ -26,7 +26,7 @@ class Block extends React.Component {
|
|||||||
|
|
||||||
messages = await Promise.all(messages.map(async (msg, i) => {
|
messages = await Promise.all(messages.map(async (msg, i) => {
|
||||||
if (msg.receipt.ExitCode !== 0) {
|
if (msg.receipt.ExitCode !== 0) {
|
||||||
let reply = await this.props.conn.call('Filecoin.StateReplay', [{Cids: [this.props.cid], Blocks: [header], Height: header.Height}, msg.Cid])
|
let reply = await this.props.conn.call('Filecoin.StateTransplant', [{Cids: [this.props.cid], Blocks: [header], Height: header.Height}, msg.Cid])
|
||||||
if(!reply.Error) {
|
if(!reply.Error) {
|
||||||
reply.Error = "reply: no error"
|
reply.Error = "reply: no error"
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ func (a *StateAPI) StateCall(ctx context.Context, msg *types.Message, tsk types.
|
|||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateReplay(ctx context.Context, tsk types.TipSetKey, mc cid.Cid) (*api.InvocResult, error) {
|
func (a *StateAPI) StateTransplant(ctx context.Context, tsk types.TipSetKey, mc cid.Cid) (*api.InvocResult, error) {
|
||||||
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user