Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Remove CanAuthorWith trait #12213

Merged
merged 13 commits into from
Sep 13, 2022
Merged

Conversation

michalkucharczyk
Copy link
Contributor

@michalkucharczyk michalkucharczyk commented Sep 8, 2022

CanAuthotWith trait removed. Also all dependencies, parameters, type parameters were removed. This is related to removal of native runtime. (#10966)

polkadot companion: paritytech/polkadot#5986
cumulus companion: paritytech/cumulus#1609

CanAuthotWith trait removed. Also all dependencies, parameters, type
paramers were removed. This is related to removal of native runtime.
@michalkucharczyk michalkucharczyk changed the title Remove CanAuthorWith trait #10966 Remove CanAuthorWith trait Sep 8, 2022
@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Sep 8, 2022
@michalkucharczyk michalkucharczyk added A3-in_progress Pull request is in progress. No review needed at this stage. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. and removed A0-please_review Pull request needs code review. labels Sep 8, 2022
@michalkucharczyk michalkucharczyk added the D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit label Sep 9, 2022
Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

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

Not familiar, but looks good. And welcome 🎩!

@davxy davxy requested a review from a team September 12, 2022 16:23
Copy link
Member

@davxy davxy left a comment

Choose a reason for hiding this comment

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

LGTM

@davxy davxy requested a review from a team September 12, 2022 16:24
@michalkucharczyk
Copy link
Contributor Author

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 3449fb0 into master Sep 13, 2022
@paritytech-processbot paritytech-processbot bot deleted the mku-remove-canauthorwith branch September 13, 2022 12:19
altonen pushed a commit that referenced this pull request Sep 14, 2022
* Remove CanAuthorWith trait

CanAuthotWith trait removed. Also all dependencies, parameters, type
paramers were removed. This is related to removal of native runtime.

* Remove commented code

* Fix code formatting

* trigger CI job

* trigger CI job

* trigger CI job

* trigger CI job

* trigger CI job

* trigger CI job

* trigger CI job
@@ -1036,16 +1027,6 @@ where
create_inherent_data_providers: CIDP::InherentDataProviders,
execution_context: ExecutionContext,
) -> Result<(), Error<Block>> {
if let Err(e) = self.can_author_with.can_author_with(&block_id) {
Copy link
Member

Choose a reason for hiding this comment

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

Shoudn't there still be runtime API compatibility check before calling check_inherents_with_context?

Copy link
Member

Choose a reason for hiding this comment

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

The runtime api should be compatible and this should always have returned Ok(()) for Polkadot.

Copy link
Member

Choose a reason for hiding this comment

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

Why does aura verifier have this check then?

if self
.client
.runtime_api()
.has_api_with::<dyn BlockBuilderApi<B>, _>(
&BlockId::Hash(parent_hash),
|v| v >= 2,
)

The runtime api should be compatible and this should always have returned Ok(()) for Polkadot.

Except it did not when the state was not available. E.g. when importing historical blocks after the warp sync. These blocks are not executed at all and there's no parent state to call the runtime on.

Copy link
Member

Choose a reason for hiding this comment

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

Why does aura verifier have this check then?

I mean it is compatible or better, we at least check and skip if it is not compatible. I don't see any problem there? Especially nothing that would have been solved by can_author_with.

Except it did not when the state was not available. E.g. when importing historical blocks after the warp sync. These blocks are not executed at all and there's no parent state to call the runtime on.

This sounds like the bug, however I wonder how this worked before? Because can_author_with should not have protected you against trying to call into a non available state?

Copy link
Member

Choose a reason for hiding this comment

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

can_author_with returns an error when there's no state. And the code above simply checked for any error. I'll make a PR to skip this check if the block is imported with no execution.

ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* Remove CanAuthorWith trait

CanAuthotWith trait removed. Also all dependencies, parameters, type
paramers were removed. This is related to removal of native runtime.

* Remove commented code

* Fix code formatting

* trigger CI job

* trigger CI job

* trigger CI job

* trigger CI job

* trigger CI job

* trigger CI job

* trigger CI job
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A3-in_progress Pull request is in progress. No review needed at this stage. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants