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 bug, check for dunder #1303

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manticore/ethereum/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __getattribute__(self, name):
contract_account.add(1000)

"""
if not name.startswith('_'):
if not name.startswith('__'):
Copy link
Member

@disconnect3d disconnect3d Dec 17, 2018

Choose a reason for hiding this comment

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

This check is wrong - the __private attributes are a syntax sugar for _CLS__private where CLS is the name of the class where a method that uses __private is defined.

In [9]: class A:
   ...:     def foo_invoker(self):
   ...:         print("A.foo_invoker")
   ...:         self.__foo()
   ...:
   ...:     def __foo(self):
   ...:         print("A.foo")
   ...:
   ...:     def __getattribute__(self, attr):
   ...:         print(f"Getting {attr}")
   ...:         return object.__getattribute__(self, attr)
   ...:

In [10]: A().foo_invoker()
Getting foo_invoker
A.foo_invoker
Getting _A__foo
A.foo

Copy link
Member

@disconnect3d disconnect3d Dec 17, 2018

Choose a reason for hiding this comment

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

On the other hand, this would still need to check for all protected attributes (the one starting with _) that the EVMAccount/EVMContract defines.

I've proposed a better fix for the issue we want to fix in #1306.

self.__init_hashes()
if self._hashes is not None and name in self._hashes.keys():
def f(*args, signature: Optional[str]=None, caller=None, value=0, gas=0xffffffffffff, **kwargs):
Expand Down