-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Make System Events Private from the Runtime #9619
Conversation
if <frame_system::Pallet<T>>::events() | ||
// | ||
// We can read the events here because offchain worker doesn't affect PoV. | ||
if <frame_system::Pallet<T>>::read_events_i_know_what_i_am_doing() |
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.
writing a small note here to make it a new issue: This can actually be removed. While it is an offchain read with no PoV consequence or time limit, we can achieve the same by storing the previous phase in some offchain storage, and then checking the new phase here. Whenever previous_phase != Off && new_phase == Off
we call unsigned::kill_ocw_solution::<T>();
.
As far as understand reading events is ok as long as it is done after the first removal in But this PR also solve this problem. |
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.
code is good to me, but doc should be improved IMO, and maybe we can actually read events without leaking into PoV, as long as they were removed before, but I'm not sure and in general I would advise not to read them inside the consensus runtime code.
bot merge |
Trying merge. |
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.
Pls help
This is right, reading from the overlay doesn't include anything into the PoV. |
what is your question ? |
We do not want to allow any Pallet to accidentally read from the events deposited into the runtime.
Doing so can have a huge impact on the PoV size of a block, and currently this is a very easy way to shoot yourself in the foot as a Parachain.
This PR removes the "easy" access to the storage item outside of tests and benchmarking.
polkadot companion: paritytech/polkadot#3712