Skip to content
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

Allow calling proxy.proxy from smart contracts in moonbase #2148

Merged
merged 5 commits into from
Mar 8, 2023

Conversation

tmpolaczyk
Copy link
Contributor

@tmpolaczyk tmpolaczyk commented Mar 6, 2023

What does it do?

Allows smart contracts to call Proxy.proxy and Proxy.proxy_force_type. This only affects the moonbase runtime.

Allows precompiles to call Proxy.proxy (only batch precompile by default, which was already defined but not working).

Rename proxy_force_type to proxyForceType.

Related to #2098

@tmpolaczyk tmpolaczyk added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited breaking Needs to be mentioned in breaking changes labels Mar 6, 2023
@nanocryk
Copy link
Contributor

nanocryk commented Mar 6, 2023

Can we also remove this section in this PR, and add tests to ensure calls from users/contracts/precompiles behave as expected?

@tmpolaczyk
Copy link
Contributor Author

So do we want to allow proxy calls from any kind of precompile?

@@ -173,7 +173,7 @@ type MoonbasePrecompilesAt<R> = (
AddressU64<2059>,
ProxyPrecompile<R>,
(
CallableByContract<OnlyIsProxy<R>>,
CallableByContract<OnlyIsProxyAndProxy<R>>,
SubcallWithMaxNesting<0>,
// Batch is the only precompile allowed to call Proxy.
CallableByPrecompile<OnlyFrom<AddressU64<2056>>>,
Copy link
Contributor

@nanocryk nanocryk Mar 6, 2023

Choose a reason for hiding this comment

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

Do do we want to allow proxy calls from any kind of precompile?

No, it just conflicts with the filters declared with the PrecompileSetBuilder. No idea why this check is still done in the precompile, as it was necessary before we had opt-in checks in PrecompileSetBuilder.

This was actually preventing the batch precompile from being able to
call proxy precompile
proxy.proxy can be called from smart contracts and allowed precompiles
@tmpolaczyk tmpolaczyk merged commit d39e593 into master Mar 8, 2023
@tmpolaczyk tmpolaczyk deleted the tomasz-call-proxy-proxy-from-sc branch March 8, 2023 11:04
@notlesh notlesh added D1-audited👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited and removed D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Apr 26, 2023
imstar15 pushed a commit to AvaProtocol/moonbeam that referenced this pull request May 16, 2023
…foundation#2148)

* allow calling proxy.proxy from smart contracts in moonbase

* Remove redundant is_precompile check

* Rename proxy_force_type to proxyForceType

* Compile contracts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes D1-audited👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants