This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
contracts: Allow contracts to dispatch calls into the runtime #9276
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
athei
added
A0-please_review
Pull request needs code review.
B7-runtimenoteworthy
C1-low
PR touches the given topic and has a low impact on builders.
D2-notlive 💤
PR contains changes in a runtime directory that is not deployed to a chain that requires an audit.
labels
Jul 5, 2021
shawntabrizi
reviewed
Jul 5, 2021
gui1117
reviewed
Jul 6, 2021
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.
apart from this abosrb_nested, which seems inacurate, everything else is good to me
gui1117
approved these changes
Jul 8, 2021
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.
looks good to me
cmichi
approved these changes
Jul 12, 2021
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, I'll create a follow-up for ink!.
4 tasks
bot merge |
Waiting for commit status. |
ghost
deleted the
at-call-runtime
branch
July 12, 2021 20:40
7 tasks
tash-2s
added a commit
to tash-2s/open-emoji-battler
that referenced
this pull request
Sep 23, 2021
it is more acculate: paritytech/substrate#9276
This pull request was closed.
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.
D2-notlive 💤
PR contains changes in a runtime directory that is not deployed to a chain that requires an audit.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Originally, contracts had the ability to dispatch calls into the runtime. However, without any mechanism to control which calls are allowed to be dispatched it was viewed as an attack vector and was removed.
With the introduction of origin filtering we can now re-introduce this functionality as
seal_call_runtime
. The users of this pallet are required to setpallet_contracts::Config::CallFilter
in order to determine which runtime calls are allowed to be called from contracts. A sane default is not to allow any calls here as doing so requires committing to some stability guarantees (see inline docs).In order to support post dispatch weight correction we need to pre-charge the static weight of a runtime call and adjust post dispatch. However, we recently abolished pre-charging because it introduced a bug where the returned
gas_consumed
can be an unsuitable value forgas_limit
of an subsequent call. To solve this issue this PR also introduces the concept of arequired_weight
which is different from theconsumed_weight
and is returned in addition to the existingconsumed_weight
when using the RPC so that the UI can display a proper gas estimation.@jacogr @Robbepop UIs should switch from
consumed_weight
torequired_weight
for gas estimation.Please note that this does not obsolete chain extensions. You can do more with chain extensions. Please see the inline docs for more information.
As always new APIs are marked as
__unstable__
until they are implemented in ink! and we are certain that we do not need further iterations.Removing the
Filter
implementation on()
Most of the code churn stems from a change that removes the
Filter
implementation on()
. It is replaced by explicitAllowAllFilter
andDenyAllFilter
types. This is also why we need a companion.polkadot companion: paritytech/polkadot#3420