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

fix: Prevent calling contract functions from outside the contract #980

Merged
merged 3 commits into from
Mar 16, 2023

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Mar 13, 2023

Related issue(s)

Resolves #955

Description

Summary of changes

Prevents referencing items defined within a contract's scope from outside of a contract. Note that this currently will still allow calling these functions within another contract in the same program.

Dependency additions / changes

Test additions / changes

Updated contracts test to no longer reference contract functions within main.

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Documentation needs

  • This PR requires documentation updates when merged.

Additional context

@jfecher jfecher changed the title Prevent calling contract functions from outside the contract fix: Prevent calling contract functions from outside the contract Mar 14, 2023
Copy link
Contributor

@kevaundray kevaundray left a comment

Choose a reason for hiding this comment

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

LGTM - one small nit

@jfecher jfecher added this pull request to the merge queue Mar 16, 2023
Merged via the queue into master with commit 21360e3 Mar 16, 2023
@jfecher jfecher deleted the jf/contract-calling branch March 16, 2023 21:28
@critesjosh
Copy link
Contributor

@jfecher I see this required docs updates. What pages need updating and what info should I add/remove?

@jfecher
Copy link
Contributor Author

jfecher commented Mar 23, 2023

@critesjosh I don't believe we have contracts documented at all in the book yet. Once we do, we'll need to add a note that you cannot call these contract functions from outside a contract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Disallow methods not in a contract scope to call methods in contract scope
3 participants