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 {
// Matches events from one of these actors, or any actor if empty.
// 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.
// 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 {
Entries []EventEntry
EmitterAddr address.Address // f4 address of emitter
Reverted bool
Height abi.ChainEpoch
TipSetKey cid.Cid // tipset that contained the message
MsgCid cid.Cid // cid of message that produced event
// Event entries in log form.
Entries []EventEntry `json:"entries"`
// Filecoin address of the actor that emitted this event.
EmitterAddr address.Address `json:"emitter"`
// 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),
Reverted: false,
Height: 1001,
TipSetKey: randomCid(t, rng),
TipSetCid: randomCid(t, rng),
MsgCid: randomCid(t, rng),
}

View File

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

View File

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

View File

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