-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add tracing logic in pallet macro for hooks and dispatchables #8305
Conversation
Does it make sense to add some tests to show how the traces in the new macro compare with the old macro? |
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.
Test would be nice, but since I think we can and should drop support for decl_
in the next release, fine without it as well.
cc @insipx |
If someone is relying on this stuff, we need a test for this. |
I can't find any test for now, I think I can do something similar to https://github.com/paritytech/substrate/blob/master/primitives/api/test/tests/runtime_calls.rs#L220 |
I agree that test should be better but considering decl_module doesn't test them either, I think it can be move to another PR/issue: paritytech/polkadot-sdk#333 |
Yeah that also works. But the issue is okay for now. |
Just wanted to document here a difference with the spans from old vs new macro I noticed:
new macro targets: Guillaume mentioned offline using something like <T::PalletInfo as frame_support::traits::PalletInfo>::name::<#pallet_ident<#type_use_gen>>() to see if that gets the correct target name. I am going to give that a go. |
if need the pallet name better to trace it explicitly instead of just tracing: |
I am out of the loop on who is relying on these traces and why we need tests? I mean tests are great, but are people taking a dependency on trace information to trigger some workflows? |
@shawntabrizi As of now, the current designs for balance reconciliation (and general state change auditing) rely on tracking DB read/writes via traces. A fragile approach, but it is the current approach. Also to follow up on my earlier comments, I am happy with this PR as is. Tests are nice but given the current status quo I don't think they should be a blocker. |
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.
lgtm
Co-authored-by: David <dvdplm@gmail.com>
bot merge |
Waiting for commit status. |
Checks failed; merge aborted. |
bot merge |
Checks failed; merge aborted. |
…tech#8305) * span in hooks * add span for dispatchable * Update frame/support/src/lib.rs * Update frame/support/src/lib.rs Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: David <dvdplm@gmail.com>
Fix #8303
decl_module add some tracing logic. This tracing is now also expanded in pallet macro.
Note that the tracing slightly differ between dispatchables from decl_module as the logic of the dispatchable function is not changed in the pallet macro.
Instead the trace is entered in the
UnfilteredDispatch
implementation (which is the implementation called when dispatching an extrinsic)