-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Emit events for inter contract calls #12136
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be super great is to have additional log::debug
output for those events. This would make it way easier for contract devs to debug their contracts. Or maybe just log::debug
any event emitted by the pallet? That would actually be best, then we'd also be able to see contract events.
Hi @athei does this pr affects on
|
No. This doesn't touch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! So many possibilites, could even use the new storage layout metadata (once it lands) to track changes in storage before and after these events.
These things can be read by a client. Just outputting them to the console would seriously clutter the output. |
bot merge |
Thanks for letting me know @athei ! I forwarded the info/PR to the Subsquid guys which requested this feature! |
* Add topics to contract events * Add `Call` events * Fix compilation for no_std * Added docs
Currently, there is no way for off-chain tooling to track inter contract calls without adding custom events as the existing events only inform about whole extrinsics (call stacks). This is problematic for general purpose tools like dashboards that are not tailored towards specific contracts. This PR changes this by emitting an event whenever a contract was successfully called. Successfully because events are rolled back as storage changes on failure. We argue that rolled back calls "didn't happen" anyways as they do not lave any trace on-chain except incurred costs.
Please not that we do not include the input or output of those calls on purpose as this would include a variable overhead that we do not want to enforce for every single contract. Authors need to emit custom events in case this is needed.
Additionally, we add topics to all events so that clients have an easier time to subscribe to stuff they are interested in without needing to download each block.
Needed for paritytech/polkadot-sdk#120
@achimcc I think you asked for this some time ago?