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

External contract calls cannot be used internally #386

Merged

Conversation

DavidKnott
Copy link
Contributor

- What I did

I added a check to external contract calls so that they can't be used internally.

- How I did it

I did this by checking that the external_address != current_address.

- How to verify it

Look at the test I wrote.

- Description for the changelog

None

- Cute Animal Picture

image

def bar() -> num:
return 1

def _expr(x: address) -> num:
Copy link
Member

Choose a reason for hiding this comment

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

What's the difference between _stmt and _expr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed this.

"""
t.s = t.Chain()
c = get_contract(contract)
c._expr(t.a1)
Copy link
Member

Choose a reason for hiding this comment

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

This should fail because we passed an account address instead of a contract address IMO.
Maybe insert assert x.is_contract in the underlying module for using external contracts?

Copy link
Contributor Author

@DavidKnott DavidKnott Oct 8, 2017

Choose a reason for hiding this comment

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

I added in a codesize check to make sure it throws if the contract doesn't exist.

@DavidKnott DavidKnott force-pushed the improve-external-contract-calls branch from a34de85 to a27236f Compare October 8, 2017 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants