-
Notifications
You must be signed in to change notification settings - Fork 683
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
On the deprecation of checkInherents #2841
Comments
cc @paritytech/parachains-core |
I think the best solution we have is to set a boolean storage that verifies that the inherent has run. However this needs to be documented properly for the substrate framework as without this a collator can intentionally not include one of the inherents and the relay will never complain. |
Actually, the only thing we need is to verify that all mandatory inherents are included, and this check is generated by the macro I think that the macro |
Yes indeed. I originally thought that this issue is only about parachains, but we need to lockdown the inherent order and requirements indeed. |
I've just looked at this PR and it doesn't seem to include a check that the mandatory inherents are present. As a block builder, being forced to order inherents isn't enough; I can "forget" one anyway. |
If the |
And undocumented, on moonbeam and tanssi we have a mandatory inherent that dosn't use this ugly trick, so we rely only on |
"Mandatory" is actually a bad name, since it is used to describe different things:
Executive interprets it in the sense of
But IIUC then with my MR and when using |
This is actually the only correct solution for this issue. Inherent checking is only an optional "task" that is currently executed by all Substrate nodes, but actually should only be done by validators. While for parachains it would also mean that you should check it at The proper way forward should be that all inherents are required. If certain inherents are optional, they should be changed to make the data they carry an optional and not just omit them. |
That's not quite true: the DispatchClass is also used to determine whether or not to insert the extrinsic, depending on how much space is left in the block. Even if an extrinsic is Infallible, it may well not be included in the block if there's no room (if on_initialize takes up the whole palce, for example).
The problem is that is_inherent_required is not called by default, although it should be for all inherents.
It has to be documented, because we didn't know about it, fortunately we realized it through extensive testing, but we almost pushed a major flaw into production.
This would solve the problem and simplify the framework, so I'm all for it. |
We have recently started to adapt our codebase (both in Tanssi and Moonbeam) to asynchronous backing and we noticed that the CheckInherents trait is being deprecated, and in fact, it has disappeared from most of the cumulus runtimes in the
register_validate_block
macro:polkadot-sdk/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs
Line 1624 in cad9479
However both moonbeam and tanssi have additional inherents, e.g., to verify block authorship, to inject randomness or to inject additional state proofs.
What we realized when removing this
checkInherents
is that a malicious author could decide not to inject one of the inherents (e.g., the inherent that validates block authorship) and the relay would still accept it, while the rest of the network would reject it because they would fail importing the block.Our question goes in the direction of: why is
checkInherents
being deprecated? I knowparachain-system
now has theConsensusHook
trait that can be used to verify a set of things in theset_validation_data
inherent but what happens with those inherents that required an additional argument to be injected? (e.g., an additional state proof)The text was updated successfully, but these errors were encountered: