feat: fvm: update the FVM/FFI to v4.1 (#11608)

This:

1. Adds nv22 support.
2. Updates the message tracing format.
This commit is contained in:
Steven Allen 2024-02-06 17:22:14 -08:00 committed by GitHub
parent 95fb198597
commit ca877940a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 362 additions and 86 deletions

View File

@ -4,6 +4,52 @@
## Improvements ## Improvements
### Tracing API
Replace the `CodeCid` field in the message trace (added in 1.23.4) with an `InvokedActor` field.
**Before:**
```javascript
{
"Msg": {
"From": ...,
"To": ...,
...
"CodeCid": ... // The actor's code CID.
}
"MsgRct": ...,
"GasCharges": [],
"Subcalls": [],
}
```
**After:**
```javascript
{
"Msg": {
"From": ...,
"To": ...
}
"InvokedActor": { // The invoked actor (ommitted if the actor wasn't invoked).
"Id": 1234, // The ID of the actor.
"State": { // The actor's state object (may change between network versions).
"Code": ..., // The actor's code CID.
"Head": ..., // The actor's state-root (when invoked).
"CallSeqNum": ..., // The actor's nonce.
"Balance": ..., // The actor's balance (when invoked).
"Address": ..., // Delegated address (FEVM only).
}
}
"MsgRct": ...,
"GasCharges": [],
"Subcalls": [],
}
```
This means the trace now contains an accurate "snapshot" of the actor at the time of the call, information that may not be present in the final state-tree (e.g., due to reverts). This will hopefully improve the performance and accuracy of indexing services.
# v1.25.2 / 2024-01-11 # v1.25.2 / 2024-01-11
This is an optional but **highly recommended feature release** of Lotus, as it includes fixes for synchronizations issues that users have experienced. The feature release also introduces `Lotus-Provider` in its alpha testing phase, as well as the ability to call external PC2-binaries during the sealing process. This is an optional but **highly recommended feature release** of Lotus, as it includes fixes for synchronizations issues that users have experienced. The feature release also introduces `Lotus-Provider` in its alpha testing phase, as well as the ability to call external PC2-binaries during the sealing process.

View File

@ -154,13 +154,14 @@ func init() {
addExample(map[verifreg.ClaimId]verifreg.Claim{}) addExample(map[verifreg.ClaimId]verifreg.Claim{})
addExample(map[string]int{"name": 42}) addExample(map[string]int{"name": 42})
addExample(map[string]time.Time{"name": time.Unix(1615243938, 0).UTC()}) addExample(map[string]time.Time{"name": time.Unix(1615243938, 0).UTC()})
addExample(abi.ActorID(1000))
addExample(map[string]types.Actor{
"t01236": ExampleValue("init", reflect.TypeOf(types.Actor{}), nil).(types.Actor),
})
addExample(&types.ExecutionTrace{ addExample(&types.ExecutionTrace{
Msg: ExampleValue("init", reflect.TypeOf(types.MessageTrace{}), nil).(types.MessageTrace), Msg: ExampleValue("init", reflect.TypeOf(types.MessageTrace{}), nil).(types.MessageTrace),
MsgRct: ExampleValue("init", reflect.TypeOf(types.ReturnTrace{}), nil).(types.ReturnTrace), MsgRct: ExampleValue("init", reflect.TypeOf(types.ReturnTrace{}), nil).(types.ReturnTrace),
}) })
addExample(map[string]types.Actor{
"t01236": ExampleValue("init", reflect.TypeOf(types.Actor{}), nil).(types.Actor),
})
addExample(map[string]api.MarketDeal{ addExample(map[string]api.MarketDeal{
"t026363": ExampleValue("init", reflect.TypeOf(api.MarketDeal{}), nil).(api.MarketDeal), "t026363": ExampleValue("init", reflect.TypeOf(api.MarketDeal{}), nil).(api.MarketDeal),
}) })
@ -209,7 +210,6 @@ func init() {
si := uint64(12) si := uint64(12)
addExample(&si) addExample(&si)
addExample(retrievalmarket.DealID(5)) addExample(retrievalmarket.DealID(5))
addExample(abi.ActorID(1000))
addExample(map[string]cid.Cid{}) addExample(map[string]cid.Cid{})
addExample(map[string][]api.SealedRef{ addExample(map[string][]api.SealedRef{
"98000": { "98000": {

Binary file not shown.

Binary file not shown.

View File

@ -2395,7 +2395,83 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) {
return nil return nil
} }
var lengthBufMessageTrace = []byte{137} var lengthBufActorTrace = []byte{130}
func (t *ActorTrace) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
cw := cbg.NewCborWriter(w)
if _, err := cw.Write(lengthBufActorTrace); err != nil {
return err
}
// t.Id (abi.ActorID) (uint64)
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Id)); err != nil {
return err
}
// t.State (types.ActorV5) (struct)
if err := t.State.MarshalCBOR(cw); err != nil {
return err
}
return nil
}
func (t *ActorTrace) UnmarshalCBOR(r io.Reader) (err error) {
*t = ActorTrace{}
cr := cbg.NewCborReader(r)
maj, extra, err := cr.ReadHeader()
if err != nil {
return err
}
defer func() {
if err == io.EOF {
err = io.ErrUnexpectedEOF
}
}()
if maj != cbg.MajArray {
return fmt.Errorf("cbor input should be of type array")
}
if extra != 2 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.Id (abi.ActorID) (uint64)
{
maj, extra, err = cr.ReadHeader()
if err != nil {
return err
}
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.Id = abi.ActorID(extra)
}
// t.State (types.ActorV5) (struct)
{
if err := t.State.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.State: %w", err)
}
}
return nil
}
var lengthBufMessageTrace = []byte{136}
func (t *MessageTrace) MarshalCBOR(w io.Writer) error { func (t *MessageTrace) MarshalCBOR(w io.Writer) error {
if t == nil { if t == nil {
@ -2459,13 +2535,6 @@ func (t *MessageTrace) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteBool(w, t.ReadOnly); err != nil { if err := cbg.WriteBool(w, t.ReadOnly); err != nil {
return err return err
} }
// t.CodeCid (cid.Cid) (struct)
if err := cbg.WriteCid(cw, t.CodeCid); err != nil {
return xerrors.Errorf("failed to write cid field t.CodeCid: %w", err)
}
return nil return nil
} }
@ -2488,7 +2557,7 @@ func (t *MessageTrace) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("cbor input should be of type array") return fmt.Errorf("cbor input should be of type array")
} }
if extra != 9 { if extra != 8 {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
@ -2599,18 +2668,6 @@ func (t *MessageTrace) UnmarshalCBOR(r io.Reader) (err error) {
default: default:
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
} }
// t.CodeCid (cid.Cid) (struct)
{
c, err := cbg.ReadCid(cr)
if err != nil {
return xerrors.Errorf("failed to read cid field t.CodeCid: %w", err)
}
t.CodeCid = c
}
return nil return nil
} }
@ -2747,7 +2804,7 @@ func (t *ReturnTrace) UnmarshalCBOR(r io.Reader) (err error) {
return nil return nil
} }
var lengthBufExecutionTrace = []byte{132} var lengthBufExecutionTrace = []byte{133}
func (t *ExecutionTrace) MarshalCBOR(w io.Writer) error { func (t *ExecutionTrace) MarshalCBOR(w io.Writer) error {
if t == nil { if t == nil {
@ -2771,6 +2828,11 @@ func (t *ExecutionTrace) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.InvokedActor (types.ActorTrace) (struct)
if err := t.InvokedActor.MarshalCBOR(cw); err != nil {
return err
}
// t.GasCharges ([]*types.GasTrace) (slice) // t.GasCharges ([]*types.GasTrace) (slice)
if len(t.GasCharges) > 1000000000 { if len(t.GasCharges) > 1000000000 {
return xerrors.Errorf("Slice value in field t.GasCharges was too long") return xerrors.Errorf("Slice value in field t.GasCharges was too long")
@ -2820,7 +2882,7 @@ func (t *ExecutionTrace) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("cbor input should be of type array") return fmt.Errorf("cbor input should be of type array")
} }
if extra != 4 { if extra != 5 {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
@ -2841,6 +2903,25 @@ func (t *ExecutionTrace) UnmarshalCBOR(r io.Reader) (err error) {
return xerrors.Errorf("unmarshaling t.MsgRct: %w", err) return xerrors.Errorf("unmarshaling t.MsgRct: %w", err)
} }
}
// t.InvokedActor (types.ActorTrace) (struct)
{
b, err := cr.ReadByte()
if err != nil {
return err
}
if b != cbg.CborNull[0] {
if err := cr.UnreadByte(); err != nil {
return err
}
t.InvokedActor = new(ActorTrace)
if err := t.InvokedActor.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.InvokedActor pointer: %w", err)
}
}
} }
// t.GasCharges ([]*types.GasTrace) (slice) // t.GasCharges ([]*types.GasTrace) (slice)

View File

@ -4,8 +4,6 @@ import (
"encoding/json" "encoding/json"
"time" "time"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
@ -28,7 +26,11 @@ type MessageTrace struct {
ParamsCodec uint64 ParamsCodec uint64
GasLimit uint64 GasLimit uint64
ReadOnly bool ReadOnly bool
CodeCid cid.Cid }
type ActorTrace struct {
Id abi.ActorID
State Actor
} }
type ReturnTrace struct { type ReturnTrace struct {
@ -40,6 +42,7 @@ type ReturnTrace struct {
type ExecutionTrace struct { type ExecutionTrace struct {
Msg MessageTrace Msg MessageTrace
MsgRct ReturnTrace MsgRct ReturnTrace
InvokedActor *ActorTrace `json:",omitempty"`
GasCharges []*GasTrace `cborgen:"maxlen=1000000000"` GasCharges []*GasTrace `cborgen:"maxlen=1000000000"`
Subcalls []ExecutionTrace `cborgen:"maxlen=1000000000"` Subcalls []ExecutionTrace `cborgen:"maxlen=1000000000"`
} }

View File

@ -4878,16 +4878,27 @@ Response:
"Params": "Ynl0ZSBhcnJheQ==", "Params": "Ynl0ZSBhcnJheQ==",
"ParamsCodec": 42, "ParamsCodec": 42,
"GasLimit": 42, "GasLimit": 42,
"ReadOnly": true, "ReadOnly": true
"CodeCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}, },
"MsgRct": { "MsgRct": {
"ExitCode": 0, "ExitCode": 0,
"Return": "Ynl0ZSBhcnJheQ==", "Return": "Ynl0ZSBhcnJheQ==",
"ReturnCodec": 42 "ReturnCodec": 42
}, },
"InvokedActor": {
"Id": 1000,
"State": {
"Code": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Head": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Nonce": 42,
"Balance": "0",
"Address": "f01234"
}
},
"GasCharges": [ "GasCharges": [
{ {
"Name": "string value", "Name": "string value",
@ -4907,16 +4918,27 @@ Response:
"Params": "Ynl0ZSBhcnJheQ==", "Params": "Ynl0ZSBhcnJheQ==",
"ParamsCodec": 42, "ParamsCodec": 42,
"GasLimit": 42, "GasLimit": 42,
"ReadOnly": true, "ReadOnly": true
"CodeCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}, },
"MsgRct": { "MsgRct": {
"ExitCode": 0, "ExitCode": 0,
"Return": "Ynl0ZSBhcnJheQ==", "Return": "Ynl0ZSBhcnJheQ==",
"ReturnCodec": 42 "ReturnCodec": 42
}, },
"InvokedActor": {
"Id": 1000,
"State": {
"Code": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Head": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Nonce": 42,
"Balance": "0",
"Address": "f01234"
}
},
"GasCharges": [ "GasCharges": [
{ {
"Name": "string value", "Name": "string value",
@ -5118,16 +5140,27 @@ Response:
"Params": "Ynl0ZSBhcnJheQ==", "Params": "Ynl0ZSBhcnJheQ==",
"ParamsCodec": 42, "ParamsCodec": 42,
"GasLimit": 42, "GasLimit": 42,
"ReadOnly": true, "ReadOnly": true
"CodeCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}, },
"MsgRct": { "MsgRct": {
"ExitCode": 0, "ExitCode": 0,
"Return": "Ynl0ZSBhcnJheQ==", "Return": "Ynl0ZSBhcnJheQ==",
"ReturnCodec": 42 "ReturnCodec": 42
}, },
"InvokedActor": {
"Id": 1000,
"State": {
"Code": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Head": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Nonce": 42,
"Balance": "0",
"Address": "f01234"
}
},
"GasCharges": [ "GasCharges": [
{ {
"Name": "string value", "Name": "string value",
@ -5147,16 +5180,27 @@ Response:
"Params": "Ynl0ZSBhcnJheQ==", "Params": "Ynl0ZSBhcnJheQ==",
"ParamsCodec": 42, "ParamsCodec": 42,
"GasLimit": 42, "GasLimit": 42,
"ReadOnly": true, "ReadOnly": true
"CodeCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}, },
"MsgRct": { "MsgRct": {
"ExitCode": 0, "ExitCode": 0,
"Return": "Ynl0ZSBhcnJheQ==", "Return": "Ynl0ZSBhcnJheQ==",
"ReturnCodec": 42 "ReturnCodec": 42
}, },
"InvokedActor": {
"Id": 1000,
"State": {
"Code": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Head": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Nonce": 42,
"Balance": "0",
"Address": "f01234"
}
},
"GasCharges": [ "GasCharges": [
{ {
"Name": "string value", "Name": "string value",
@ -6518,16 +6562,27 @@ Response:
"Params": "Ynl0ZSBhcnJheQ==", "Params": "Ynl0ZSBhcnJheQ==",
"ParamsCodec": 42, "ParamsCodec": 42,
"GasLimit": 42, "GasLimit": 42,
"ReadOnly": true, "ReadOnly": true
"CodeCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}, },
"MsgRct": { "MsgRct": {
"ExitCode": 0, "ExitCode": 0,
"Return": "Ynl0ZSBhcnJheQ==", "Return": "Ynl0ZSBhcnJheQ==",
"ReturnCodec": 42 "ReturnCodec": 42
}, },
"InvokedActor": {
"Id": 1000,
"State": {
"Code": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Head": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Nonce": 42,
"Balance": "0",
"Address": "f01234"
}
},
"GasCharges": [ "GasCharges": [
{ {
"Name": "string value", "Name": "string value",
@ -6547,16 +6602,27 @@ Response:
"Params": "Ynl0ZSBhcnJheQ==", "Params": "Ynl0ZSBhcnJheQ==",
"ParamsCodec": 42, "ParamsCodec": 42,
"GasLimit": 42, "GasLimit": 42,
"ReadOnly": true, "ReadOnly": true
"CodeCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}, },
"MsgRct": { "MsgRct": {
"ExitCode": 0, "ExitCode": 0,
"Return": "Ynl0ZSBhcnJheQ==", "Return": "Ynl0ZSBhcnJheQ==",
"ReturnCodec": 42 "ReturnCodec": 42
}, },
"InvokedActor": {
"Id": 1000,
"State": {
"Code": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Head": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Nonce": 42,
"Balance": "0",
"Address": "f01234"
}
},
"GasCharges": [ "GasCharges": [
{ {
"Name": "string value", "Name": "string value",

View File

@ -6375,16 +6375,27 @@ Response:
"Params": "Ynl0ZSBhcnJheQ==", "Params": "Ynl0ZSBhcnJheQ==",
"ParamsCodec": 42, "ParamsCodec": 42,
"GasLimit": 42, "GasLimit": 42,
"ReadOnly": true, "ReadOnly": true
"CodeCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}, },
"MsgRct": { "MsgRct": {
"ExitCode": 0, "ExitCode": 0,
"Return": "Ynl0ZSBhcnJheQ==", "Return": "Ynl0ZSBhcnJheQ==",
"ReturnCodec": 42 "ReturnCodec": 42
}, },
"InvokedActor": {
"Id": 1000,
"State": {
"Code": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Head": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Nonce": 42,
"Balance": "0",
"Address": "f01234"
}
},
"GasCharges": [ "GasCharges": [
{ {
"Name": "string value", "Name": "string value",
@ -6404,16 +6415,27 @@ Response:
"Params": "Ynl0ZSBhcnJheQ==", "Params": "Ynl0ZSBhcnJheQ==",
"ParamsCodec": 42, "ParamsCodec": 42,
"GasLimit": 42, "GasLimit": 42,
"ReadOnly": true, "ReadOnly": true
"CodeCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}, },
"MsgRct": { "MsgRct": {
"ExitCode": 0, "ExitCode": 0,
"Return": "Ynl0ZSBhcnJheQ==", "Return": "Ynl0ZSBhcnJheQ==",
"ReturnCodec": 42 "ReturnCodec": 42
}, },
"InvokedActor": {
"Id": 1000,
"State": {
"Code": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Head": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Nonce": 42,
"Balance": "0",
"Address": "f01234"
}
},
"GasCharges": [ "GasCharges": [
{ {
"Name": "string value", "Name": "string value",
@ -6615,16 +6637,27 @@ Response:
"Params": "Ynl0ZSBhcnJheQ==", "Params": "Ynl0ZSBhcnJheQ==",
"ParamsCodec": 42, "ParamsCodec": 42,
"GasLimit": 42, "GasLimit": 42,
"ReadOnly": true, "ReadOnly": true
"CodeCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}, },
"MsgRct": { "MsgRct": {
"ExitCode": 0, "ExitCode": 0,
"Return": "Ynl0ZSBhcnJheQ==", "Return": "Ynl0ZSBhcnJheQ==",
"ReturnCodec": 42 "ReturnCodec": 42
}, },
"InvokedActor": {
"Id": 1000,
"State": {
"Code": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Head": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Nonce": 42,
"Balance": "0",
"Address": "f01234"
}
},
"GasCharges": [ "GasCharges": [
{ {
"Name": "string value", "Name": "string value",
@ -6644,16 +6677,27 @@ Response:
"Params": "Ynl0ZSBhcnJheQ==", "Params": "Ynl0ZSBhcnJheQ==",
"ParamsCodec": 42, "ParamsCodec": 42,
"GasLimit": 42, "GasLimit": 42,
"ReadOnly": true, "ReadOnly": true
"CodeCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}, },
"MsgRct": { "MsgRct": {
"ExitCode": 0, "ExitCode": 0,
"Return": "Ynl0ZSBhcnJheQ==", "Return": "Ynl0ZSBhcnJheQ==",
"ReturnCodec": 42 "ReturnCodec": 42
}, },
"InvokedActor": {
"Id": 1000,
"State": {
"Code": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Head": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Nonce": 42,
"Balance": "0",
"Address": "f01234"
}
},
"GasCharges": [ "GasCharges": [
{ {
"Name": "string value", "Name": "string value",
@ -8144,16 +8188,27 @@ Response:
"Params": "Ynl0ZSBhcnJheQ==", "Params": "Ynl0ZSBhcnJheQ==",
"ParamsCodec": 42, "ParamsCodec": 42,
"GasLimit": 42, "GasLimit": 42,
"ReadOnly": true, "ReadOnly": true
"CodeCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}, },
"MsgRct": { "MsgRct": {
"ExitCode": 0, "ExitCode": 0,
"Return": "Ynl0ZSBhcnJheQ==", "Return": "Ynl0ZSBhcnJheQ==",
"ReturnCodec": 42 "ReturnCodec": 42
}, },
"InvokedActor": {
"Id": 1000,
"State": {
"Code": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Head": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Nonce": 42,
"Balance": "0",
"Address": "f01234"
}
},
"GasCharges": [ "GasCharges": [
{ {
"Name": "string value", "Name": "string value",
@ -8173,16 +8228,27 @@ Response:
"Params": "Ynl0ZSBhcnJheQ==", "Params": "Ynl0ZSBhcnJheQ==",
"ParamsCodec": 42, "ParamsCodec": 42,
"GasLimit": 42, "GasLimit": 42,
"ReadOnly": true, "ReadOnly": true
"CodeCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}, },
"MsgRct": { "MsgRct": {
"ExitCode": 0, "ExitCode": 0,
"Return": "Ynl0ZSBhcnJheQ==", "Return": "Ynl0ZSBhcnJheQ==",
"ReturnCodec": 42 "ReturnCodec": 42
}, },
"InvokedActor": {
"Id": 1000,
"State": {
"Code": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Head": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Nonce": 42,
"Balance": "0",
"Address": "f01234"
}
},
"GasCharges": [ "GasCharges": [
{ {
"Name": "string value", "Name": "string value",

2
extern/filecoin-ffi vendored

@ -1 +1 @@
Subproject commit 4176a1e662e865834bfdc5861da921dc2d272b45 Subproject commit b715c9403faf919e95fdc702cd651e842f18d890

View File

@ -38,6 +38,7 @@ func main() {
types.EventEntry{}, types.EventEntry{},
// Tracing // Tracing
types.GasTrace{}, types.GasTrace{},
types.ActorTrace{},
types.MessageTrace{}, types.MessageTrace{},
types.ReturnTrace{}, types.ReturnTrace{},
types.ExecutionTrace{}, types.ExecutionTrace{},

8
go.sum
View File

@ -1821,6 +1821,7 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -1883,7 +1884,9 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@ -1909,6 +1912,7 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20180202135801-37707fdb30a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180202135801-37707fdb30a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -2014,6 +2018,7 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
@ -2022,6 +2027,7 @@ golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9sn
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -2033,6 +2039,7 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@ -2101,6 +2108,7 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 h1:Vve/L0v7CXXuxUmaMGIEK/dEeq7uiqb5qBgQrZzIE7E= golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 h1:Vve/L0v7CXXuxUmaMGIEK/dEeq7uiqb5qBgQrZzIE7E=
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@ -56,6 +56,11 @@ func buildTraces(traces *[]*ethtypes.EthTrace, parent *ethtypes.EthTrace, addr [
return nil return nil
} }
// Skip the trace if we never reached the point where we invoked this actor.
if et.InvokedActor == nil {
return nil
}
trace := &ethtypes.EthTrace{ trace := &ethtypes.EthTrace{
Action: ethtypes.EthTraceAction{ Action: ethtypes.EthTraceAction{
From: from, From: from,
@ -67,7 +72,7 @@ func buildTraces(traces *[]*ethtypes.EthTrace, parent *ethtypes.EthTrace, addr [
FilecoinFrom: et.Msg.From, FilecoinFrom: et.Msg.From,
FilecoinTo: et.Msg.To, FilecoinTo: et.Msg.To,
FilecoinMethod: et.Msg.Method, FilecoinMethod: et.Msg.Method,
FilecoinCodeCid: et.Msg.CodeCid, FilecoinCodeCid: et.InvokedActor.State.Code,
}, },
Result: ethtypes.EthTraceResult{ Result: ethtypes.EthTraceResult{
GasUsed: ethtypes.EthUint64(et.SumGas().TotalGas), GasUsed: ethtypes.EthUint64(et.SumGas().TotalGas),
@ -137,7 +142,7 @@ func buildTraces(traces *[]*ethtypes.EthTrace, parent *ethtypes.EthTrace, addr [
if parent.Action.FilecoinTo == builtin.InitActorAddr && if parent.Action.FilecoinTo == builtin.InitActorAddr &&
parent.Action.FilecoinMethod == builtin.MethodsInit.Exec && parent.Action.FilecoinMethod == builtin.MethodsInit.Exec &&
et.Msg.Method == builtin.MethodConstructor { et.Msg.Method == builtin.MethodConstructor {
log.Debugf("COND3 Native actor creation! method:%d, code:%s, height:%d", et.Msg.Method, et.Msg.CodeCid.String(), height) log.Debugf("COND3 Native actor creation! method:%d, code:%s, height:%d", et.Msg.Method, et.InvokedActor.State.Code.String(), height)
parent.SetCallType("create") parent.SetCallType("create")
parent.Action.To = to parent.Action.To = to
parent.Action.Input = []byte{0xFE} parent.Action.Input = []byte{0xFE}
@ -165,7 +170,7 @@ func buildTraces(traces *[]*ethtypes.EthTrace, parent *ethtypes.EthTrace, addr [
// TODO: We need to handle failures in contract creations and support resurrections on an existing but dead EVM actor) // TODO: We need to handle failures in contract creations and support resurrections on an existing but dead EVM actor)
if calledCreateOnEAM && eamCalledInitOnExec4 && initCreatedActor { if calledCreateOnEAM && eamCalledInitOnExec4 && initCreatedActor {
log.Debugf("COND4 EVM contract creation method:%d, code:%s, height:%d", et.Msg.Method, et.Msg.CodeCid.String(), height) log.Debugf("COND4 EVM contract creation method:%d, code:%s, height:%d", et.Msg.Method, et.InvokedActor.State.Code.String(), height)
if parent.Parent.Action.FilecoinMethod == builtin.MethodsEAM.Create { if parent.Parent.Action.FilecoinMethod == builtin.MethodsEAM.Create {
parent.Parent.SetCallType("create") parent.Parent.SetCallType("create")