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

More flexible dependencies, no cursor timeout, cache 4bytes #140

Merged
merged 7 commits into from
May 11, 2022

Conversation

kchojn
Copy link
Collaborator

@kchojn kchojn commented Apr 14, 2022

  • Make more flexible deps - ethtx is easier to install in other apps
  • No timeout for mongo cursor - some collections may sometimes require more time to search
  • Cache 4bytes resposne, if some transactions have a lot of guessed functions/events, it definitely speeds up ethtx!
  • Fix README mongo string

def get_address_semantics(self, chain_id, address) -> Optional[Dict]:
def get_address_semantics(
self, chain_id, address, *, cursor_timeout_millis=None
) -> Cursor:

Choose a reason for hiding this comment

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

if this return cursor, this can't be cache. If it's working, it's only because we got lucky because cache is getting all the data from this cursor. Could we add list(...) around returned value, and change type from Cursor, just to make it clear what is returned?

return self._signatures.find({"signature_hash": signature_hash})
def get_signature_semantics(
self, signature_hash: str, *, cursor_timeout_millis=None
) -> Cursor:

Choose a reason for hiding this comment

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

same as before

def get_contract_semantics(self, code_hash):
def get_contract_semantics(
self, code_hash, *, cursor_timeout_millis=None
) -> Cursor:

Choose a reason for hiding this comment

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

same as before

@kchojn
Copy link
Collaborator Author

kchojn commented Apr 28, 2022

@piotr-rudnik , maybe lets remove cache here, find_one returns Dict. In normal find, the cursor is also translated to list[dict]

@kchojn kchojn merged commit 06f55f2 into EthTx:master May 11, 2022
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.

2 participants