Merge pull request #1529 from filecoin-project/asr/type
Sever the API's dependency on VM
This commit is contained in:
commit
4bf784b44f
@ -20,7 +20,6 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
|
||||
@ -313,7 +312,7 @@ type RetrievalOrder struct {
|
||||
type InvocResult struct {
|
||||
Msg *types.Message
|
||||
MsgRct *types.MessageReceipt
|
||||
InternalExecutions []*vm.ExecutionResult
|
||||
InternalExecutions []*types.ExecutionResult
|
||||
Error string
|
||||
Duration time.Duration
|
||||
}
|
||||
|
9
chain/types/execresult.go
Normal file
9
chain/types/execresult.go
Normal file
@ -0,0 +1,9 @@
|
||||
package types
|
||||
|
||||
type ExecutionResult struct {
|
||||
Msg *Message
|
||||
MsgRct *MessageReceipt
|
||||
Error string
|
||||
|
||||
Subcalls []*ExecutionResult
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package types
|
||||
|
||||
type InvokeRet struct {
|
||||
Result []byte
|
||||
ReturnCode byte
|
||||
}
|
@ -48,7 +48,7 @@ type Runtime struct {
|
||||
origin address.Address
|
||||
originNonce uint64
|
||||
|
||||
internalExecutions []*ExecutionResult
|
||||
internalExecutions []*types.ExecutionResult
|
||||
numActorsCreated uint64
|
||||
}
|
||||
|
||||
@ -337,7 +337,7 @@ func (rt *Runtime) internalSend(from, to address.Address, method abi.MethodNum,
|
||||
GasUsed: 0,
|
||||
}
|
||||
|
||||
er := ExecutionResult{
|
||||
er := types.ExecutionResult{
|
||||
Msg: msg,
|
||||
MsgRct: &mr,
|
||||
}
|
||||
|
@ -36,36 +36,6 @@ import (
|
||||
|
||||
var log = logging.Logger("vm")
|
||||
|
||||
const (
|
||||
gasFundTransfer = 10
|
||||
gasInvoke = 5
|
||||
|
||||
gasGetObj = 10
|
||||
gasGetPerByte = 1
|
||||
gasPutObj = 20
|
||||
gasPutPerByte = 2
|
||||
gasCommit = 50
|
||||
gasPerMessageByte = 2
|
||||
)
|
||||
|
||||
const (
|
||||
outOfGasErrCode = 200
|
||||
)
|
||||
|
||||
type ExecutionResult struct {
|
||||
Msg *types.Message
|
||||
MsgRct *types.MessageReceipt
|
||||
Error string
|
||||
|
||||
Subcalls []*ExecutionResult
|
||||
}
|
||||
|
||||
// Storage interface
|
||||
|
||||
// End of storage interface
|
||||
|
||||
// Send allows the current execution context to invoke methods on other actors in the system
|
||||
|
||||
// ResolveToKeyAddr returns the public key type of address (`BLS`/`SECP256K1`) of an account actor identified by `addr`.
|
||||
func ResolveToKeyAddr(state types.StateTree, cst cbor.IpldStore, addr address.Address) (address.Address, aerrors.ActorError) {
|
||||
if addr.Protocol() == address.BLS || addr.Protocol() == address.SECP256K1 {
|
||||
@ -195,7 +165,7 @@ type ApplyRet struct {
|
||||
types.MessageReceipt
|
||||
ActorErr aerrors.ActorError
|
||||
Penalty types.BigInt
|
||||
InternalExecutions []*ExecutionResult
|
||||
InternalExecutions []*types.ExecutionResult
|
||||
Duration time.Duration
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
"github.com/filecoin-project/lotus/miner"
|
||||
|
||||
"github.com/docker/go-units"
|
||||
@ -808,7 +807,7 @@ var stateComputeStateCmd = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
func printInternalExecutions(prefix string, trace []*vm.ExecutionResult) {
|
||||
func printInternalExecutions(prefix string, trace []*types.ExecutionResult) {
|
||||
for _, im := range trace {
|
||||
fmt.Printf("%s%s\t%s\t%s\t%d\t%x\t%d\t%x\n", prefix, im.Msg.From, im.Msg.To, im.Msg.Value, im.Msg.Method, im.Msg.Params, im.MsgRct.ExitCode, im.MsgRct.Return)
|
||||
printInternalExecutions(prefix+"\t", im.Subcalls)
|
||||
|
Loading…
Reference in New Issue
Block a user