diff --git a/CHANGELOG.md b/CHANGELOG.md index 5da284702..88ccfa971 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,52 @@ ## 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 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. diff --git a/api/docgen/docgen.go b/api/docgen/docgen.go index e4574d157..00e938c6e 100644 --- a/api/docgen/docgen.go +++ b/api/docgen/docgen.go @@ -153,13 +153,14 @@ func init() { addExample(map[verifreg.ClaimId]verifreg.Claim{}) addExample(map[string]int{"name": 42}) 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{ Msg: ExampleValue("init", reflect.TypeOf(types.MessageTrace{}), nil).(types.MessageTrace), 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{ "t026363": ExampleValue("init", reflect.TypeOf(api.MarketDeal{}), nil).(api.MarketDeal), }) @@ -208,7 +209,6 @@ func init() { si := uint64(12) addExample(&si) addExample(retrievalmarket.DealID(5)) - addExample(abi.ActorID(1000)) addExample(map[string]cid.Cid{}) addExample(map[string][]api.SealedRef{ "98000": { diff --git a/build/openrpc/full.json.gz b/build/openrpc/full.json.gz index 0f5a23788..0779bc451 100644 Binary files a/build/openrpc/full.json.gz and b/build/openrpc/full.json.gz differ diff --git a/build/openrpc/gateway.json.gz b/build/openrpc/gateway.json.gz index 04cbbbe5d..6571430bc 100644 Binary files a/build/openrpc/gateway.json.gz and b/build/openrpc/gateway.json.gz differ diff --git a/chain/types/cbor_gen.go b/chain/types/cbor_gen.go index a097c72de..ba84c1e50 100644 --- a/chain/types/cbor_gen.go +++ b/chain/types/cbor_gen.go @@ -2410,7 +2410,83 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) { 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 { if t == nil { @@ -2474,13 +2550,6 @@ func (t *MessageTrace) MarshalCBOR(w io.Writer) error { if err := cbg.WriteBool(w, t.ReadOnly); err != nil { 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 } @@ -2503,7 +2572,7 @@ func (t *MessageTrace) UnmarshalCBOR(r io.Reader) (err error) { 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") } @@ -2615,18 +2684,6 @@ func (t *MessageTrace) UnmarshalCBOR(r io.Reader) (err error) { default: 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 } @@ -2764,7 +2821,7 @@ func (t *ReturnTrace) UnmarshalCBOR(r io.Reader) (err error) { return nil } -var lengthBufExecutionTrace = []byte{132} +var lengthBufExecutionTrace = []byte{133} func (t *ExecutionTrace) MarshalCBOR(w io.Writer) error { if t == nil { @@ -2788,6 +2845,11 @@ func (t *ExecutionTrace) MarshalCBOR(w io.Writer) error { return err } + // t.InvokedActor (types.ActorTrace) (struct) + if err := t.InvokedActor.MarshalCBOR(cw); err != nil { + return err + } + // t.GasCharges ([]*types.GasTrace) (slice) if len(t.GasCharges) > 1000000000 { return xerrors.Errorf("Slice value in field t.GasCharges was too long") @@ -2839,7 +2901,7 @@ func (t *ExecutionTrace) UnmarshalCBOR(r io.Reader) (err error) { 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") } @@ -2860,6 +2922,25 @@ func (t *ExecutionTrace) UnmarshalCBOR(r io.Reader) (err error) { 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) diff --git a/chain/types/execresult.go b/chain/types/execresult.go index 4556f7b88..99bbb6ece 100644 --- a/chain/types/execresult.go +++ b/chain/types/execresult.go @@ -4,8 +4,6 @@ import ( "encoding/json" "time" - "github.com/ipfs/go-cid" - "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/exitcode" @@ -28,7 +26,11 @@ type MessageTrace struct { ParamsCodec uint64 GasLimit uint64 ReadOnly bool - CodeCid cid.Cid +} + +type ActorTrace struct { + Id abi.ActorID + State Actor } type ReturnTrace struct { @@ -38,10 +40,11 @@ type ReturnTrace struct { } type ExecutionTrace struct { - Msg MessageTrace - MsgRct ReturnTrace - GasCharges []*GasTrace `cborgen:"maxlen=1000000000"` - Subcalls []ExecutionTrace `cborgen:"maxlen=1000000000"` + Msg MessageTrace + MsgRct ReturnTrace + InvokedActor *ActorTrace `json:",omitempty"` + GasCharges []*GasTrace `cborgen:"maxlen=1000000000"` + Subcalls []ExecutionTrace `cborgen:"maxlen=1000000000"` } func (et ExecutionTrace) SumGas() GasTrace { diff --git a/documentation/en/api-v0-methods.md b/documentation/en/api-v0-methods.md index a799db39c..f9c7d5a1b 100644 --- a/documentation/en/api-v0-methods.md +++ b/documentation/en/api-v0-methods.md @@ -4878,16 +4878,27 @@ Response: "Params": "Ynl0ZSBhcnJheQ==", "ParamsCodec": 42, "GasLimit": 42, - "ReadOnly": true, - "CodeCid": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + "ReadOnly": true }, "MsgRct": { "ExitCode": 0, "Return": "Ynl0ZSBhcnJheQ==", "ReturnCodec": 42 }, + "InvokedActor": { + "Id": 1000, + "State": { + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Head": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Nonce": 42, + "Balance": "0", + "Address": "f01234" + } + }, "GasCharges": [ { "Name": "string value", @@ -4907,16 +4918,27 @@ Response: "Params": "Ynl0ZSBhcnJheQ==", "ParamsCodec": 42, "GasLimit": 42, - "ReadOnly": true, - "CodeCid": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + "ReadOnly": true }, "MsgRct": { "ExitCode": 0, "Return": "Ynl0ZSBhcnJheQ==", "ReturnCodec": 42 }, + "InvokedActor": { + "Id": 1000, + "State": { + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Head": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Nonce": 42, + "Balance": "0", + "Address": "f01234" + } + }, "GasCharges": [ { "Name": "string value", @@ -5118,16 +5140,27 @@ Response: "Params": "Ynl0ZSBhcnJheQ==", "ParamsCodec": 42, "GasLimit": 42, - "ReadOnly": true, - "CodeCid": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + "ReadOnly": true }, "MsgRct": { "ExitCode": 0, "Return": "Ynl0ZSBhcnJheQ==", "ReturnCodec": 42 }, + "InvokedActor": { + "Id": 1000, + "State": { + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Head": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Nonce": 42, + "Balance": "0", + "Address": "f01234" + } + }, "GasCharges": [ { "Name": "string value", @@ -5147,16 +5180,27 @@ Response: "Params": "Ynl0ZSBhcnJheQ==", "ParamsCodec": 42, "GasLimit": 42, - "ReadOnly": true, - "CodeCid": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + "ReadOnly": true }, "MsgRct": { "ExitCode": 0, "Return": "Ynl0ZSBhcnJheQ==", "ReturnCodec": 42 }, + "InvokedActor": { + "Id": 1000, + "State": { + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Head": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Nonce": 42, + "Balance": "0", + "Address": "f01234" + } + }, "GasCharges": [ { "Name": "string value", @@ -6517,16 +6561,27 @@ Response: "Params": "Ynl0ZSBhcnJheQ==", "ParamsCodec": 42, "GasLimit": 42, - "ReadOnly": true, - "CodeCid": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + "ReadOnly": true }, "MsgRct": { "ExitCode": 0, "Return": "Ynl0ZSBhcnJheQ==", "ReturnCodec": 42 }, + "InvokedActor": { + "Id": 1000, + "State": { + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Head": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Nonce": 42, + "Balance": "0", + "Address": "f01234" + } + }, "GasCharges": [ { "Name": "string value", @@ -6546,16 +6601,27 @@ Response: "Params": "Ynl0ZSBhcnJheQ==", "ParamsCodec": 42, "GasLimit": 42, - "ReadOnly": true, - "CodeCid": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + "ReadOnly": true }, "MsgRct": { "ExitCode": 0, "Return": "Ynl0ZSBhcnJheQ==", "ReturnCodec": 42 }, + "InvokedActor": { + "Id": 1000, + "State": { + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Head": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Nonce": 42, + "Balance": "0", + "Address": "f01234" + } + }, "GasCharges": [ { "Name": "string value", diff --git a/documentation/en/api-v1-unstable-methods.md b/documentation/en/api-v1-unstable-methods.md index 049f54773..e728b111f 100644 --- a/documentation/en/api-v1-unstable-methods.md +++ b/documentation/en/api-v1-unstable-methods.md @@ -6406,16 +6406,27 @@ Response: "Params": "Ynl0ZSBhcnJheQ==", "ParamsCodec": 42, "GasLimit": 42, - "ReadOnly": true, - "CodeCid": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + "ReadOnly": true }, "MsgRct": { "ExitCode": 0, "Return": "Ynl0ZSBhcnJheQ==", "ReturnCodec": 42 }, + "InvokedActor": { + "Id": 1000, + "State": { + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Head": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Nonce": 42, + "Balance": "0", + "Address": "f01234" + } + }, "GasCharges": [ { "Name": "string value", @@ -6435,16 +6446,27 @@ Response: "Params": "Ynl0ZSBhcnJheQ==", "ParamsCodec": 42, "GasLimit": 42, - "ReadOnly": true, - "CodeCid": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + "ReadOnly": true }, "MsgRct": { "ExitCode": 0, "Return": "Ynl0ZSBhcnJheQ==", "ReturnCodec": 42 }, + "InvokedActor": { + "Id": 1000, + "State": { + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Head": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Nonce": 42, + "Balance": "0", + "Address": "f01234" + } + }, "GasCharges": [ { "Name": "string value", @@ -6646,16 +6668,27 @@ Response: "Params": "Ynl0ZSBhcnJheQ==", "ParamsCodec": 42, "GasLimit": 42, - "ReadOnly": true, - "CodeCid": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + "ReadOnly": true }, "MsgRct": { "ExitCode": 0, "Return": "Ynl0ZSBhcnJheQ==", "ReturnCodec": 42 }, + "InvokedActor": { + "Id": 1000, + "State": { + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Head": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Nonce": 42, + "Balance": "0", + "Address": "f01234" + } + }, "GasCharges": [ { "Name": "string value", @@ -6675,16 +6708,27 @@ Response: "Params": "Ynl0ZSBhcnJheQ==", "ParamsCodec": 42, "GasLimit": 42, - "ReadOnly": true, - "CodeCid": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + "ReadOnly": true }, "MsgRct": { "ExitCode": 0, "Return": "Ynl0ZSBhcnJheQ==", "ReturnCodec": 42 }, + "InvokedActor": { + "Id": 1000, + "State": { + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Head": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Nonce": 42, + "Balance": "0", + "Address": "f01234" + } + }, "GasCharges": [ { "Name": "string value", @@ -8197,16 +8241,27 @@ Response: "Params": "Ynl0ZSBhcnJheQ==", "ParamsCodec": 42, "GasLimit": 42, - "ReadOnly": true, - "CodeCid": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + "ReadOnly": true }, "MsgRct": { "ExitCode": 0, "Return": "Ynl0ZSBhcnJheQ==", "ReturnCodec": 42 }, + "InvokedActor": { + "Id": 1000, + "State": { + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Head": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Nonce": 42, + "Balance": "0", + "Address": "f01234" + } + }, "GasCharges": [ { "Name": "string value", @@ -8226,16 +8281,27 @@ Response: "Params": "Ynl0ZSBhcnJheQ==", "ParamsCodec": 42, "GasLimit": 42, - "ReadOnly": true, - "CodeCid": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + "ReadOnly": true }, "MsgRct": { "ExitCode": 0, "Return": "Ynl0ZSBhcnJheQ==", "ReturnCodec": 42 }, + "InvokedActor": { + "Id": 1000, + "State": { + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Head": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Nonce": 42, + "Balance": "0", + "Address": "f01234" + } + }, "GasCharges": [ { "Name": "string value", diff --git a/extern/filecoin-ffi b/extern/filecoin-ffi index be911fcd5..b715c9403 160000 --- a/extern/filecoin-ffi +++ b/extern/filecoin-ffi @@ -1 +1 @@ -Subproject commit be911fcd56251d5477756893881ed2bac5d01657 +Subproject commit b715c9403faf919e95fdc702cd651e842f18d890 diff --git a/gen/main.go b/gen/main.go index 447822893..f1fe3876a 100644 --- a/gen/main.go +++ b/gen/main.go @@ -39,6 +39,7 @@ func main() { types.EventEntry{}, // Tracing types.GasTrace{}, + types.ActorTrace{}, types.MessageTrace{}, types.ReturnTrace{}, types.ExecutionTrace{}, diff --git a/go.sum b/go.sum index a0dd82780..c8b976710 100644 --- a/go.sum +++ b/go.sum @@ -1798,6 +1798,7 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1840,6 +1841,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.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.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= 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= @@ -1902,7 +1904,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-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.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.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= 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= @@ -1928,6 +1932,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-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.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/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180202135801-37707fdb30a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2029,6 +2034,8 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc 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.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/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -2037,6 +2044,8 @@ 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.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.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -2048,6 +2057,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.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.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/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2116,6 +2126,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.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= 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/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/node/impl/full/eth_trace.go b/node/impl/full/eth_trace.go index 9d24394d7..123d96fe1 100644 --- a/node/impl/full/eth_trace.go +++ b/node/impl/full/eth_trace.go @@ -56,6 +56,11 @@ func buildTraces(traces *[]*ethtypes.EthTrace, parent *ethtypes.EthTrace, addr [ return nil } + // Skip the trace if we never reached the point where we invoked this actor. + if et.InvokedActor == nil { + return nil + } + trace := ðtypes.EthTrace{ Action: ethtypes.EthTraceAction{ From: from, @@ -67,7 +72,7 @@ func buildTraces(traces *[]*ethtypes.EthTrace, parent *ethtypes.EthTrace, addr [ FilecoinFrom: et.Msg.From, FilecoinTo: et.Msg.To, FilecoinMethod: et.Msg.Method, - FilecoinCodeCid: et.Msg.CodeCid, + FilecoinCodeCid: et.InvokedActor.State.Code, }, Result: ethtypes.EthTraceResult{ 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 && parent.Action.FilecoinMethod == builtin.MethodsInit.Exec && 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.Action.To = to 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) 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 { parent.Parent.SetCallType("create")