Minor tweaks to events types

This commit is contained in:
Rod Vagg 2024-02-08 17:05:55 +11:00
parent bb311dd0d8
commit 256f0b004b
7 changed files with 35 additions and 23 deletions

Binary file not shown.

Binary file not shown.

View File

@ -31,7 +31,7 @@ type SubActorEventFilter struct {
type ActorEventFilter struct { type ActorEventFilter struct {
// Matches events from one of these actors, or any actor if empty. // Matches events from one of these actors, or any actor if empty.
// For now, this MUST be a Filecoin address. // For now, this MUST be a Filecoin address.
Addresses []address.Address `json:"addresses"` Addresses []address.Address `json:"addresses,omitempty"`
// Matches events with the specified key/values, or all events if empty. // Matches events with the specified key/values, or all events if empty.
// If the value is an empty slice, the filter will match on the key only, accepting any value. // If the value is an empty slice, the filter will match on the key only, accepting any value.
@ -51,10 +51,22 @@ type ActorEventFilter struct {
} }
type ActorEvent struct { type ActorEvent struct {
Entries []EventEntry // Event entries in log form.
EmitterAddr address.Address // f4 address of emitter Entries []EventEntry `json:"entries"`
Reverted bool
Height abi.ChainEpoch // Filecoin address of the actor that emitted this event.
TipSetKey cid.Cid // tipset that contained the message EmitterAddr address.Address `json:"emitter"`
MsgCid cid.Cid // cid of message that produced event
// Reverted is set to true if the message that produced this event was reverted because of a network re-org
// in that case, the event should be considered as reverted as well.
Reverted bool `json:"reverted"`
// Height of the tipset that contained the message that produced this event.
Height abi.ChainEpoch `json:"height"`
// CID of the tipset that contained the message that produced this event.
TipSetCid cid.Cid `json:"tipsetCid"`
// CID of message that produced this event.
MsgCid cid.Cid `json:"msgCid"`
} }

View File

@ -32,7 +32,7 @@ func TestActorEventJson(t *testing.T) {
EmitterAddr: randomF4Addr(t, rng), EmitterAddr: randomF4Addr(t, rng),
Reverted: false, Reverted: false,
Height: 1001, Height: 1001,
TipSetKey: randomCid(t, rng), TipSetCid: randomCid(t, rng),
MsgCid: randomCid(t, rng), MsgCid: randomCid(t, rng),
} }

View File

@ -3421,7 +3421,7 @@ Response:
```json ```json
[ [
{ {
"Entries": [ "entries": [
{ {
"Flags": 7, "Flags": 7,
"Key": "string value", "Key": "string value",
@ -3429,13 +3429,13 @@ Response:
"Value": "Ynl0ZSBhcnJheQ==" "Value": "Ynl0ZSBhcnJheQ=="
} }
], ],
"EmitterAddr": "f01234", "emitter": "f01234",
"Reverted": true, "reverted": true,
"Height": 10101, "height": 10101,
"TipSetKey": { "tipsetCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}, },
"MsgCid": { "msgCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
} }
} }
@ -8859,7 +8859,7 @@ Inputs:
Response: Response:
```json ```json
{ {
"Entries": [ "entries": [
{ {
"Flags": 7, "Flags": 7,
"Key": "string value", "Key": "string value",
@ -8867,13 +8867,13 @@ Response:
"Value": "Ynl0ZSBhcnJheQ==" "Value": "Ynl0ZSBhcnJheQ=="
} }
], ],
"EmitterAddr": "f01234", "emitter": "f01234",
"Reverted": true, "reverted": true,
"Height": 10101, "height": 10101,
"TipSetKey": { "tipsetCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}, },
"MsgCid": { "msgCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
} }
} }

View File

@ -527,7 +527,7 @@ func buildActorEventsFromMessages(ctx context.Context, t *testing.T, node v1api.
EmitterAddr: addr, EmitterAddr: addr,
Reverted: false, Reverted: false,
Height: ts.Height(), Height: ts.Height(),
TipSetKey: tsCid, TipSetCid: tsCid,
MsgCid: m.Cid, MsgCid: m.Cid,
}) })
} }

View File

@ -175,7 +175,7 @@ func (a *ActorEvent) SubscribeActorEvents(ctx context.Context, f *types.SubActor
EmitterAddr: ce.EmitterAddr, EmitterAddr: ce.EmitterAddr,
Reverted: ce.Reverted, Reverted: ce.Reverted,
Height: ce.Height, Height: ce.Height,
TipSetKey: c, TipSetCid: c,
MsgCid: ce.MsgCid, MsgCid: ce.MsgCid,
} }
@ -215,7 +215,7 @@ func getCollected(ctx context.Context, f *filter.EventFilter) ([]*types.ActorEve
EmitterAddr: e.EmitterAddr, EmitterAddr: e.EmitterAddr,
Reverted: e.Reverted, Reverted: e.Reverted,
Height: e.Height, Height: e.Height,
TipSetKey: c, TipSetCid: c,
MsgCid: e.MsgCid, MsgCid: e.MsgCid,
} }