-
-
Notifications
You must be signed in to change notification settings - Fork 819
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
feat[lang]: protect external calls with keyword #2938
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #2938 +/- ##
==========================================
+ Coverage 85.23% 85.36% +0.12%
==========================================
Files 92 92
Lines 13949 14031 +82
Branches 3130 3141 +11
==========================================
+ Hits 11889 11977 +88
+ Misses 1565 1560 -5
+ Partials 495 494 -1 ☔ View full report in Codecov by Sentry. |
breaking change, wait until 0.4.0 |
for now i'm putting in the behavior as warning instead of an exception |
fix: ExtCall inherits from Call remove parse_Call from stmt.py, merge into expr.py
await
keyword@classmethod | ||
def handle_external_call(cls, expr, context): | ||
# TODO fix cyclic import | ||
from vyper.builtins._signatures import BuiltinFunctionT |
Check notice
Code scanning / CodeQL
Cyclic import Note
vyper.builtins._signatures
also rewrite some `assert_compile_failed` to `pytest.raises()` as we go along
fix await test
compiling @external
def foo():
s: String[2] = staticcall staticcall concat('a', 'b')
return yields:
see: |
I assume this is the type of err that the description is alluding to: interface I:
def foo() -> uint256: view
def bar(a: uint256): payable
event E:
a: uint256
@external
@payable
def foo(_target: address) -> uint256:
log E(staticcall I(_target).foo())
return 1 yields:
|
compiling: d: DynArray[uint256, 10]
interface I:
def foo() -> DynArray[uint256, 10]: view
@external
def bar(t: address) -> uint256:
for i: uint256 in staticcall I(t).foo():
self.d.append(i)
return 1 yields:
|
compiling: d: DynArray[uint256, 10]
interface I:
def foo() -> DynArray[uint256, 10]: view
def bar() -> uint256: payable
@external
def bar(t: address) -> uint256:
for i: uint256 in range(extcall I(t).bar(), bound=10):
self.d.append(i)
return 1 yields:
|
related: interface I:
def ohfak() -> decimal: view
@external
def bar(t: address):
k: decimal = sqrt(staticcall I(t).ohfak())
return yields:
|
seems unrelated -- there's a |
this is a bug on master too, not a regression in this PR |
the non-unique symbol panics are related to known bugs i think, not regressions |
What I did
implement #2856
settled on extcall+staticcall to distinguish between calls which can have side effects and not.
.parent
property to VyperNodesassert_compile_failed
topytest.raises()
as i went along(note: wait until after v0.3.4)
How I did it
How to verify it
see new tests
Commit message
Description for the changelog
Cute Animal Picture