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

Better error for when origin filter prevent the call to be dispatched #10134

Merged
merged 9 commits into from
Nov 2, 2021

Conversation

gui1117
Copy link
Contributor

@gui1117 gui1117 commented Oct 31, 2021

Fix #9951

Breaking change

The error returned when the filter in the origin prevent the call to be dispatched was BadOrigin, it is now frame_system::Error::CallFiltered.

Description

Currently when a call fail to be dispatched because the origin filter prevents it, then the error returned is BadOrigin.

This is lots of people confused, thinking it is the origin caller which is wrong, but it is actually the origin filter. (I understand that saying that the origin is made of 2 part the caller and the filter is maybe already a bad naming from my side).

Anyhow this PR will do that we return a new variant CallFiltered which have a corresponding description in the metadata:

		/// The call has a bad origin, the origin filter prevent the call to be dispatched.

We can make the message even more descriptive if wanted.

cc @gilescope

@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Oct 31, 2021
@gui1117 gui1117 added B3-apinoteworthy 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 labels Oct 31, 2021
frame/system/src/lib.rs Outdated Show resolved Hide resolved
gui1117 and others added 2 commits October 31, 2021 20:53
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
@gui1117 gui1117 requested a review from athei as a code owner November 1, 2021 10:32
@gui1117
Copy link
Contributor Author

gui1117 commented Nov 1, 2021

bot merge

@paritytech-processbot
Copy link

Waiting for commit status.

@paritytech-processbot
Copy link

Merge cancelled due to error. Error: Waiting on code owner review from athei.

frame/contracts/src/exec.rs Outdated Show resolved Hide resolved
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
@gui1117
Copy link
Contributor Author

gui1117 commented Nov 2, 2021

bot merge

@paritytech-processbot
Copy link

Waiting for commit status.

@paritytech-processbot
Copy link

Merge cancelled due to error. Error: Checks failed for a169ea9

@gui1117
Copy link
Contributor Author

gui1117 commented Nov 2, 2021

bot merge

@paritytech-processbot
Copy link

Waiting for commit status.

@paritytech-processbot
Copy link

Merge cancelled due to error. Error: Checks failed for 6453c10

@gui1117
Copy link
Contributor Author

gui1117 commented Nov 2, 2021

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 635c187 into master Nov 2, 2021
@paritytech-processbot paritytech-processbot bot deleted the gui-better-error-on-failing-filter branch November 2, 2021 14:20
grishasobol pushed a commit to gear-tech/substrate that referenced this pull request Mar 28, 2022
…paritytech#10134)

* better error

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* remove unused

* fix error

* fmt

* fix tests

* fmt

* Update frame/contracts/src/exec.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* fix typo

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
…paritytech#10134)

* better error

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* remove unused

* fix error

* fmt

* fix tests

* fmt

* Update frame/contracts/src/exec.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* fix typo

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. 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.

BaseCallFilter returns BadOrigin error
4 participants