Skip to content

Commit

Permalink
Minor tweaks to events types
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Feb 13, 2024
1 parent 08f1af8 commit 8303b77
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 23 deletions.
Binary file modified build/openrpc/full.json.gz
Binary file not shown.
Binary file modified build/openrpc/gateway.json.gz
Binary file not shown.
26 changes: 19 additions & 7 deletions chain/types/actor_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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"`
}
2 changes: 1 addition & 1 deletion chain/types/actor_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}

Expand Down
24 changes: 12 additions & 12 deletions documentation/en/api-v1-unstable-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -3423,21 +3423,21 @@ Response:
```json
[
{
"Entries": [
"entries": [
{
"Flags": 7,
"Key": "string value",
"Codec": 42,
"Value": "Ynl0ZSBhcnJheQ=="
}
],
"EmitterAddr": "f01234",
"Reverted": true,
"Height": 10101,
"TipSetKey": {
"emitter": "f01234",
"reverted": true,
"height": 10101,
"tipsetCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"MsgCid": {
"msgCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}
Expand Down Expand Up @@ -8816,21 +8816,21 @@ Inputs:
Response:
```json
{
"Entries": [
"entries": [
{
"Flags": 7,
"Key": "string value",
"Codec": 42,
"Value": "Ynl0ZSBhcnJheQ=="
}
],
"EmitterAddr": "f01234",
"Reverted": true,
"Height": 10101,
"TipSetKey": {
"emitter": "f01234",
"reverted": true,
"height": 10101,
"tipsetCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"MsgCid": {
"msgCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}
Expand Down
2 changes: 1 addition & 1 deletion itests/direct_data_onboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}
Expand Down
4 changes: 2 additions & 2 deletions node/impl/full/actor_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -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,
}

Expand Down

0 comments on commit 8303b77

Please sign in to comment.