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

Sigantures/Semantics bug fixes #59

Merged
merged 21 commits into from
Oct 12, 2021
Merged

Sigantures/Semantics bug fixes #59

merged 21 commits into from
Oct 12, 2021

Conversation

kchojn
Copy link
Collaborator

@kchojn kchojn commented Oct 11, 2021

  • added more types
  • fixed unknown args for empty guessed functions (empty arguments have been removed)
  • refactored semantic providers
  • added missing __init__ files for semantics
  • signature collection is now indexed
  • black code

"Semantics used in decoding %s: %s", tx_hash, ", ".join(used_semantics)
"Semantics used in decoding %s: %s",
tx_hash,
", ".join(used_semantics) if isinstance(used_semantics, list) else "",
Copy link
Contributor

Choose a reason for hiding this comment

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

This can only be a list or None, if it's none, there could be an information about this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed isinstance

ethtx/providers/semantic_providers/const.py Show resolved Hide resolved
Comment on lines 103 to 115
if MongoCollections.ADDRESSES not in self._db.list_collection_names():
self._addresses = self._db[MongoCollections.ADDRESSES]

if MongoCollections.CONTRACTS not in self._db.list_collection_names():
self._contracts = self._db[MongoCollections.CONTRACTS]

if MongoCollections.SIGNATURES not in self._db.list_collection_names():
self._signatures = self._db[MongoCollections.SIGNATURES]
self._signatures.create_index(
[("signature_hash", "TEXT"), ("name", "TEXT")],
background=True,
unique=False,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Take list_collection_names and put it in variable, instead of calling it 3 times.
  2. Why are those variables not initialized when collections are not in db?

Copy link
Contributor

Choose a reason for hiding this comment

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

and unique shouldn't be True?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Refactored. You are right, unique=True. They are initialized when collections are not in db.

Copy link
Contributor

Choose a reason for hiding this comment

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

Better, but still if collections are not in db, self._addresses self._contracts and self._signatures will be empty. Normally those collections would be created by mongo itself, here program will just fail if those are not created by user manually.

ethtx/providers/semantic_providers/repository.py Outdated Show resolved Hide resolved
ethtx/providers/semantic_providers/repository.py Outdated Show resolved Hide resolved
@kchojn kchojn merged commit 25164c2 into EthTx:master Oct 12, 2021
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

3 participants