-
Notifications
You must be signed in to change notification settings - Fork 75
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
Conversation
ethtx/decoders/decoder_service.py
Outdated
"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 "", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed isinstance
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, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Take list_collection_names and put it in variable, instead of calling it 3 times.
- Why are those variables not initialized when collections are not in db?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
__init__
files for semanticssignature
collection is now indexedblack
code