Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frrist/receipt events schema #1132

Merged
merged 3 commits into from
Feb 15, 2023
Merged

Conversation

frrist
Copy link
Member

@frrist frrist commented Feb 11, 2023

Produces the below table (example from hyperspace-net):

height state_root message_cid event_index emitter flags key value
32996 bafy2bzacebvhhwlctzs2b77ostc6x4e2hv7c5ykuqgh42gyzfh24mxmlzl5aq bafy2bzaceawhcx5tdhyeafkv3cfd6ogmkzj5fttr56plez73tx64utcy5vra4 0 t01199 0x02 topic1 0x5820DDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF
32984 bafy2bzacecajda3rdpil6jpx2iwoqogyguucxctaritweptfct33uwr6rhvko bafy2bzacebylc3cikwj2kczwo2ds6fzzwpkqsgngrjkjiuy5pi55fi2u62wz6 0 t01199 0x02 topic1 0x5820DDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF
32912 bafy2bzaceb77msppzs74dub4zvanjbjfe7sfjrmnwthy5pqfh3egzsqur2jug bafy2bzaced3zznjfgszvzig5iyjfslovuqqgx34fj4ymukmcwauicnpwfgece 62 t01945 0x02 topic1 0x5820C3D58168C5AE7397731D063D5BBF3D657854427343F4C083240F7AACAA2D0F62
32912 bafy2bzaceb77msppzs74dub4zvanjbjfe7sfjrmnwthy5pqfh3egzsqur2jug bafy2bzaced3zznjfgszvzig5iyjfslovuqqgx34fj4ymukmcwauicnpwfgece 61 t01968 0x02 topic1 0x58208A6BDED414158F51D49528C98244F78FFCAE2F384110728CF2A8B93F438FAE1A
32912 bafy2bzaceb77msppzs74dub4zvanjbjfe7sfjrmnwthy5pqfh3egzsqur2jug bafy2bzaced3zznjfgszvzig5iyjfslovuqqgx34fj4ymukmcwauicnpwfgece 60 t01945 0x02 topic1 0x5820C3D58168C5AE7397731D063D5BBF3D657854427343F4C083240F7AACAA2D0F62

@frrist frrist self-assigned this Feb 11, 2023
Copy link
Contributor

@kasteph kasteph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@frrist frrist linked an issue Feb 15, 2023 that may be closed by this pull request
- track the value of EventRoots contained in message receipts.
@frrist frrist force-pushed the frrist/receipt-events-schema branch from e525fdd to be3f295 Compare February 15, 2023 20:46
@frrist frrist merged commit c24b57e into ntwk/hyperspacenet Feb 15, 2023
@frrist frrist deleted the frrist/receipt-events-schema branch February 15, 2023 21:12
frrist added a commit that referenced this pull request Feb 16, 2023
* feat: implement actor event task and schema

- track the value of EventRoots contained in message receipts.
@frrist frrist mentioned this pull request Feb 16, 2023
@raulk
Copy link
Member

raulk commented Feb 18, 2023

Nice.

Comment on lines +7 to +19
CREATE TABLE IF NOT EXISTS {{ .SchemaName | default "public"}}.actor_events (
height bigint NOT NULL,
state_root text NOT NULL,
event_index bigint NOT NULL,
message_cid text NOT NULL,

emitter text NOT NULL,
flags bytea NOT NULL,
key text NOT NULL,
value bytea NOT NULL,

PRIMARY KEY ("height", "state_root", "event_index", "message_cid")
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frrist is this tracking the new event schema which includes the codec? FIP-0049 was updated ~2 weeks ago to add a codec field (value 0x55, RAW) always.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add the codec value shortly, missed that in my initial implementation. Thanks for the pointer!

Comment on lines +88 to +92
evtArr, err := amt.LoadAMT(ctx, t.node.Store(), *rec.EventsRoot, amt.UseTreeBitWidth(types.EventAMTBitwidth))
if err != nil {
report.ErrorsDetected = fmt.Errorf("loading actor events amt (%s): %w", *rec.EventsRoot, err)
return nil, report, nil
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is capable of using Lotus APIs, you can now invoke the ChainGetEvents JSON-RPC operation with the events root CID. It will do the AMT handling on the server side.

Copy link
Member Author

@frrist frrist Feb 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup this has the full lotus API, in #1137 we call that instead, replacing the amt loading logic in this file with the lotus API method.

report.ErrorsDetected = fmt.Errorf("loading actor events amt (%s): %w", *rec.EventsRoot, err)
return nil, report, nil
}
var evt types.Event
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, if the dependencies are updated, this should already. be using the correct event schema (incl. codec). However, you might want to consider inserting the codec as well into the Lily table, although not a big deal since it's a fixed value 0x55 and we can always backfill once other values become possible.

frrist added a commit that referenced this pull request Feb 22, 2023
* feat: implement actor event task and schema

- track the value of EventRoots contained in message receipts.
frrist added a commit that referenced this pull request Feb 22, 2023
Terryhung pushed a commit that referenced this pull request Mar 3, 2023
* feat: implement actor event task and schema

- track the value of EventRoots contained in message receipts.
Terryhung pushed a commit that referenced this pull request Mar 3, 2023
birdychang pushed a commit that referenced this pull request Mar 8, 2023
* deps: update to lotus 1.20.0-rc2

* chore: update actor gen

- clean up types, remove lily actors types, replace with go-state-types

* Frrist/receipt events schema (#1132)

* feat: implement actor event task and schema

- track the value of EventRoots contained in message receipts.

* feat: implement message param schema and task

- create a table that records raw message parameters

* feat: track raw receipt return value

* fix schema index's after rebase on master

* fix: use builtin lotus method to get events

- it handles the case of legacy events

* fixup! Frrist/receipt events schema (#1132)

* deps: replace deprecated blocks package

- use github.com/ipfs/go-libipfs/blocks instead

* deps: update to v1.20.0 release

* feat: track verifreg actor claim HAMT changes (#1141)

* feat: track verified registry actor claim HAMT changes

- addresses request made here: https://github.com/protocol/pldw/issues/177#issuecomment-1372920524

* fix: correctly diff new actor version (#1145)

* fix: correctly diff new actor version

- closes #1144

* chore: remove unused metrics

* metric: track GettActorStateChanges duration

* feat: update lotus deps to support vm para/ret marshal (#1150)

- use lotus deps from filecoin-project/lotus#10372

* fix: resolve the duplication issue of db migration version

---------

Co-authored-by: Terry <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Actor Events Support
3 participants