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

Setting Permission to accept all methods and contracts is not working #1036

Merged
merged 2 commits into from
Apr 27, 2023

Conversation

luc10921
Copy link
Collaborator

Summary or solution description
Calling a native smart contract after using the import wildcards was overwriting it. Also added/changed some tests to check this situation.

How to Reproduce

from boa3.builtin.compile_time import NeoMetadata, metadata, public
from boa3.builtin.nativecontract.neo import NEO
@public
def main() -> int:
return NEO.totalSupply()
@metadata
def permissions_manifest() -> NeoMetadata:
meta = NeoMetadata()
meta.add_permission(contract='*', methods='*')
return meta

Tests

def test_metadata_info_permissions_wildcard(self):
path, _ = self.get_deploy_file_paths('MetadataInfoPermissionsWildcard.py')
output, manifest = self.compile_and_save(path.replace('nef', 'py'))
self.assertIn('permissions', manifest)
self.assertIsInstance(manifest['permissions'], list)
self.assertEqual(len(manifest['permissions']), 1)
self.assertIn({"contract": "*", "methods": "*"}, manifest['permissions'])
runner = NeoTestRunner(runner_id=self.method_name())
invoke = runner.call_contract(path, 'main')
runner.execute()
self.assertEqual(VMState.HALT, runner.vm_state, msg=runner.error)
self.assertEqual(invoke.result, 100_000_000) # NEO total supply

Platform:

  • OS: Windows 10 x64
  • Python version: Python 3.8

@luc10921 luc10921 requested a review from meevee98 April 26, 2023 17:38
@luc10921 luc10921 self-assigned this Apr 26, 2023
@lllwvlvwlll
Copy link
Member

@coveralls
Copy link
Collaborator

coveralls commented Apr 26, 2023

Coverage Status

Coverage: 91.376% (+0.02%) from 91.356% when pulling 3779e3f on CU-864efbt1b into 62ae97e on development.

@meevee98 meevee98 merged commit 6fa8a68 into development Apr 27, 2023
@melanke melanke deleted the CU-864efbt1b branch May 5, 2023 16:38
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.

None yet

4 participants