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

Runtime error when making an external call to the same contract #1696

Closed
smarx opened this issue Nov 9, 2019 · 5 comments · Fixed by #2059
Closed

Runtime error when making an external call to the same contract #1696

smarx opened this issue Nov 9, 2019 · 5 comments · Fixed by #2059
Labels
bug Bug that shouldn't change language semantics when fixed.

Comments

@smarx
Copy link
Contributor

smarx commented Nov 9, 2019

This code makes it an error to make an external call to the same contract:

https://github.com/ethereum/vyper/blob/c296b2d7532d913103aad494b749f8179a3acddc/vyper/parser/external_call.py#L75

This is a surprising limitation. It doesn't seem to have a clear benefit, and it could be problematic. As an example, multisig wallets often use self-calls to perform administrative functions. This way the wallet owners have to agree to make a change like lowering the required threshold of signatures. In Vyper, this would produce a runtime error.

@fubuloubu
Copy link
Member

We originally wanted to avoid a recursion/stack-exhaustion kind of attack, but I think we relaxed that a bit by just making it unergonomic. If someone wants to write it that way, they can. Just be aware of how the mechanism could be abused.

@fubuloubu fubuloubu added the VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting label Nov 10, 2019
@charles-cooper
Copy link
Member

I think this should just be a compile-time error. I think our latest consensus was to refactor into a private function for these kinds of self calls (and never use public functions like solidity external functions)

@jacqueswww
Copy link
Contributor

Meeting Notes: Remove runtime-check as we have compile time check for this already, then document the behaviour.

@charles-cooper
Copy link
Member

cf. #1582 thanks @iamdefinitelyahuman !

@fubuloubu fubuloubu added bug Bug that shouldn't change language semantics when fixed. and removed VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting labels Jan 6, 2020
@fubuloubu fubuloubu mentioned this issue Jun 22, 2020
7 tasks
@fubuloubu
Copy link
Member

fubuloubu commented Jun 22, 2020

Meeting Notes: Remove assertion of dst != self.address in raw_call. Everything else is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that shouldn't change language semantics when fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants