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

feat: RPC for returning scale-encoded System events #4638

Merged
merged 4 commits into from
Mar 15, 2024

Conversation

syan095
Copy link
Contributor

@syan095 syan095 commented Mar 13, 2024

Pull Request

Closes: PRO-1185

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have updated documentation where appropriate.

Summary:

Created a RPC call that returns System events (In EventRecord) scale encoded.
Changed the original get_events rpc to return event records instead of just the Raw events

@syan095
Copy link
Contributor Author

syan095 commented Mar 13, 2024

The returned data is Vec<frame_system::Event> in scale-encoded bytes format (hex encoded).
{"jsonrpc":"2.0","result":["5c00c255053000020000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c000000824bf665798c0000"],"id":1}%

It does not include extra information in the EventRecord. Let me know if we want to include the event record as well, I can change this.

Copy link

codecov bot commented Mar 13, 2024

Codecov Report

Attention: Patch coverage is 5.55556% with 34 lines in your changes are missing coverage. Please review.

Project coverage is 72%. Comparing base (88d68d3) to head (af62c05).
Report is 9 commits behind head on main.

Files Patch % Lines
state-chain/custom-rpc/src/lib.rs 0% 18 Missing ⚠️
state-chain/runtime/src/lib.rs 0% 0 Missing and 13 partials ⚠️
state-chain/runtime/src/runtime_apis.rs 40% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #4638   +/-   ##
=====================================
- Coverage     72%     72%   -0%     
=====================================
  Files        414     414           
  Lines      68288   68312   +24     
  Branches   68288   68312   +24     
=====================================
+ Hits       49046   49056   +10     
- Misses     16852   16855    +3     
- Partials    2390    2401   +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dandanlen
Copy link
Collaborator

Pretty sure we need the EventRecord here too. This is what allows us to correlate the event (for example ExtrinsicSuccess) with the extrinsic that triggered it.

instead of just the event.

Refactored the CustomRuntimeApi::get_events() function to remove duplicates.
@syan095
Copy link
Contributor Author

syan095 commented Mar 14, 2024

Pretty sure we need the EventRecord here too. This is what allows us to correlate the event (for example ExtrinsicSuccess) with the extrinsic that triggered it.

Done.
I took the chance to change the get_events rpc call to return EventRecord as well.

Copy link
Collaborator

@dandanlen dandanlen left a comment

Choose a reason for hiding this comment

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

Just one comment 👌

state-chain/custom-rpc/src/lib.rs Outdated Show resolved Hide resolved
@syan095 syan095 requested a review from dandanlen March 14, 2024 22:00
@dandanlen dandanlen merged commit be7b312 into main Mar 15, 2024
43 checks passed
@dandanlen dandanlen deleted the feature/system-event-rpc branch March 15, 2024 10:18
syan095 added a commit that referenced this pull request Mar 22, 2024
…tation

* origin/main:
  feat: support account deletion (#4314)
  fix: cf_pools_environment rpc encoding (#4674)
  fix: submission watcher could confuse/lose track of submissions (#4667)
  fix(github_actions/release_checks): update confusing runtime spec version check 🤦‍♂️ (#4672)
  feat: fix log messages, evm chain specific (#4652)
  fix: remove cfe events migration (#4671)
  chore: run CI on `nscloud` runners 🚀 (#4505)
  logging: lp-api panic in submission watcher  (#4664)
  chore(localnet): append timestamp to log files 🪵 (#4660)
  fix(chainflip-broker-api): replace u128 with U256 (#4656)
  fix: remove unused cli command line options (#4644)
  chore: revert addition of cargo make (#4659)
  fix: correct cfe-events pallet version (#4658)
  chore: update systemd config to match 1.4 version 🚀 (#4655)
  fix: publish `chainflip-engine1.3` to debian packages 🐞 (#4653)
  Remove aptly check from publish workflow (#4650)
  fix: more try-runtime unwraps. (#4648)
  feat: RPC for returning scale-encoded System events (#4638)
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.

2 participants