diff --git a/model/fevm/trace.go b/model/fevm/trace.go index 7ba73bce..76eaf83e 100644 --- a/model/fevm/trace.go +++ b/model/fevm/trace.go @@ -38,7 +38,7 @@ type FEVMTrace struct { Method uint64 `pg:",notnull,use_zero"` // Method in readable name. ParsedMethod string `pg:",notnull"` - // ActorCode of To (receiver). + // ActorCode of To (receiver) as a CID. ActorCode string `pg:",notnull"` // ExitCode of message execution. ExitCode int64 `pg:",notnull,use_zero"` @@ -56,6 +56,10 @@ type FEVMTrace struct { ParamsCodec uint64 `pg:",notnull,use_zero"` // Returns codec. ReturnsCodec uint64 `pg:",notnull,use_zero"` + // Human-readable identifier of receiver (To). + ToActorName string `pg:",notnull"` + // Human-readable identifier of sender (From). + FromActorName string `pg:",notnull"` } func (f *FEVMTrace) Persist(ctx context.Context, s model.StorageBatch, version model.Version) error { diff --git a/schemas/v1/28_add_actor_names_to_fevm_traces.go b/schemas/v1/28_add_actor_names_to_fevm_traces.go new file mode 100644 index 00000000..ec3bd2a2 --- /dev/null +++ b/schemas/v1/28_add_actor_names_to_fevm_traces.go @@ -0,0 +1,17 @@ +package v1 + +func init() { + patches.Register( + 28, + ` + ALTER TABLE {{ .SchemaName | default "public"}}.fevm_traces + ADD COLUMN IF NOT EXISTS "to_actor_name" text NOT NULL; + + ALTER TABLE {{ .SchemaName | default "public"}}.fevm_traces + ADD COLUMN IF NOT EXISTS "from_actor_name" text NOT NULL; + + COMMENT ON COLUMN {{ .SchemaName | default "public"}}.fevm_traces.to_actor_name IS 'Fully-versioned human-readable identifier of receiver (To).'; + COMMENT ON COLUMN {{ .SchemaName | default "public"}}.fevm_traces.from_actor_name IS 'Fully-versioned human-readable identifier of receiver (From).'; +`, + ) +} diff --git a/tasks/fevm/trace/task.go b/tasks/fevm/trace/task.go index 01188c0d..227ce60e 100644 --- a/tasks/fevm/trace/task.go +++ b/tasks/fevm/trace/task.go @@ -118,11 +118,24 @@ func (t *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut continue } for _, child := range util.GetChildMessagesOf(parentMsg) { - toCode, _ := getActorCode(ctx, child.Message.To) + fromCode, _ := getActorCode(ctx, child.Message.From) + var fromActorCode string + if !fromCode.Equals(cid.Undef) { + fromActorCode, _, err = util.ActorNameAndFamilyFromCode(fromCode) + if err != nil { + errs = append(errs, err) + } + } - toActorCode := "" + toCode, _ := getActorCode(ctx, child.Message.To) + actorCode := "" + var toActorCode string if !toCode.Equals(cid.Undef) { - toActorCode = toCode.String() + actorCode = toCode.String() + toActorCode, _, err = util.ActorNameAndFamilyFromCode(toCode) + if err != nil { + errs = append(errs, err) + } } fromEthAddress := getEthAddress(child.Message.From) toEthAddress := getEthAddress(child.Message.To) @@ -139,13 +152,15 @@ func (t *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut To: toEthAddress, Value: child.Message.Value.String(), ExitCode: int64(child.Receipt.ExitCode), - ActorCode: toActorCode, + ActorCode: actorCode, Method: uint64(child.Message.Method), Index: child.Index, Params: ethtypes.EthBytes(child.Message.Params).String(), Returns: ethtypes.EthBytes(child.Receipt.Return).String(), ParamsCodec: child.Message.ParamsCodec, ReturnsCodec: child.Receipt.ReturnCodec, + ToActorName: toActorCode, + FromActorName: fromActorCode, } // only parse params and return of successful messages since unsuccessful messages don't return a parseable value.