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

Cache: Change to ReceiptAPI model #994

Open
1 task
NotPeopling2day opened this issue Aug 18, 2022 · 0 comments
Open
1 task

Cache: Change to ReceiptAPI model #994

NotPeopling2day opened this issue Aug 18, 2022 · 0 comments
Labels
category: refactor Refactor of existing code or process size: 2 pieces Relatively easy, but requires some thought

Comments

@NotPeopling2day
Copy link
Contributor

NotPeopling2day commented Aug 18, 2022

Overview

We want to use the RecieptAPI model for our cache records. The TransactionAPI base model can be several different transaction types, whereas the ReceiptAPI model is singular and is post-transaction making it more stable and a better candidate for data analysis

Specification

  • Refactor cache to use ReceiptAPI model in it's database schema (updating the Query plugin system as well)

Dependencies

ReceiptAPI Refactor

@NotPeopling2day NotPeopling2day added the category: feature New feature or request label Aug 18, 2022
fubuloubu added a commit to johnson2427/ape that referenced this issue Aug 18, 2022
@NotPeopling2day NotPeopling2day added size: 3 pieces Moderately challenging, well-defined, may require a bit of research category: refactor Refactor of existing code or process and removed category: feature New feature or request labels Aug 18, 2022
fubuloubu added a commit that referenced this issue Aug 18, 2022
* feat: added cache query

* chore: reformatting following pre-commit

* fix: mypy issues

* fix: used more secure way to query the database, and removed TODO

* fix: mypy and flake8 issues

* chore: clean up of docstrings

* fix: blocks database structure, need to work on updating by column

* feat: moved init_db and purge_db functionality to CacheQueryProvider

* feat: handles missing columns, database not existing, no nullable data to database, multiple databases depending on provider

* chore: pre-commit

* fix: cannot import Column from sqlalchemy.types, fixed this in models to remove warning

* chore: linting

* fix: added sqlalchemy to setup.py

* feat: removed schemas.py, no need for pydantic here, can go to the API's and build these models. Can add separate schemas later down the road.

* feat: allow to cache all data during query no matter what column you query

* mypy issue

* removed breakpoint

* removed TODO columns are no longer going to be handled in the update of cache

* moving DefaultQueryProvider back into managers/query.py

* type ignore for logger due to mypy

* fix: fixed query so it doesn't default to cache

* chore: type ignore issue

* fix: importing logger from ape.logging

* fix: isort issue

* feat: simplified logic in estimate_block_query

* fix: docs build issue

* fix: docs issue

* fix: importing logger mistake

* refactor: simplify logic in ape_cache query.py

* feat: caching data added

* fix: mypy issues

* fix: isort and mypy

* fix: mypy

* fix: documentation for `update_cache`

* fix: mypy

* fix: mypy

* fix: type in update cache

* fix: type in update cache

* fix: remove ignore

* feat: added transactions cache

* feat: created singledispatch for cache

* refactor: remove ContractEvents for now

* fix: cache was failing

* feat: added contract_events table to caching system

* fix: mypy

* refactor: remove print

* feat: major upgrade to CacheQueryProvider

* fix: mypy issue and linters

* fix: remove print

* feat: added raises

* fix: added missing argument to cache_query

* feat: added test and set logger to error

* feat: removed type ignore for sqlalchemy imports and added cache.md

* fix: fixed markdowns and fixed issue where db was being created without init

* fix: pytest failure because of raises in database_file method

* fix: misspelling in index.md

* fix: query manager was not using iterators

* refactor: major update to how cache provider works

* refactor: update ape cache cli to match

* feat: query is operating as expected

* fix: caching issue of integers being too large

* fix: type hint

* fix: isort

* fix: mypy

* fix: mypy

* fix: mypy

* fix: mypy

* fix: mypy for the last time please

* feat: added suggestions

* fix: formatting markdown and managers.query

* fix: suggested changes from fubu

* feat: adding errors to logging for QueryEngine

* fix: mypy and added type ignore to perform_query

* fix: num_transactions in the blocks table is now integer

* fix: CacheQuery docstring

* fix: show warnings instead of errors when db is not inited

* feat: add url for information on QueryEngineError

* feat: add url for information on QueryEngineError

* feat: add url for information on QueryEngineError

* fix: remove breakpoint

* feat: moved try for update_cache inside of the with statement

* feat: adding txn_hash and signature to Transactions

* feat: removed breakpoint

* fix: docstring

* feat: this would be a breaking change

* fix: cache markdown

* fix: remove bytes from transaction api

* refactor: remove type ignore

* refactor: raise message fix

* refactor: revert transaction api back to original form

* refactor: remove any from typing

* feat: getting all data for transactions

* fix: breakpoint removal

* feat: transaction cache full operational

* fix: type ignores for properties from transaction api

* fix: solve missing data by setting to None

* fix: unused import

* fix: mypy issue with table columns

* fix: black

* fix: wrong order of arguments for estimate query call

* fix: fetch estimate properly in CacheQueryProvider

* fix: wrong estimates in DefaultQueryProvider

estimates fixed for BlockTransactionQuery and ContractEventsQuery

* fix: unable to unpack the two different returns here

* fix: linters

* fix: blocks queries properly

* refactor: replace info with success messages

* refactor: adding singledispatchmethod for perform_query

* feat: transactions and blocks fully operational

* feat: handle individual column queries for blocks

* fix: mypy

* feat: properly calculate query time in DefaultQueryProvider

* feat: one liner for the estimate of query

* fix: cache init and purge messages in test

* fix: HexBytesString schema type doesn't handle string inputs

* fix: updates to ape_ethereum.Block to ensure that values always exist

also added some notes to describe this behavior

* fix: docstring format in HexByteString

* feat: added docstrings to all cli methods for ape cache

* feat: added beta release note to cache markdown file

* fix: query and purge docstrings

* fix: need to convert hash and parent hash to hex in decode_block

* fix: models must return bytes properly from new data type

* refactor: docstrings added to ape_cache.query and cleaned

* fix; database_connection should not be hidden

* fix: mypy issue

* fix: added minor changes to documentation

* fix: comments and some logic tweaks

* fix: perform_transaction_query uses a map

* feat: remove perform_query_clause

* fix: add required to network_option for init and purge

* refactor: raise Error instead of returning None when no cache clause

* feat: better bypass of database when corrupted or not initialized

* fix(HACK): bypass BlockAPI.transactions requests until #994

* fix: bypass database connection whenever connected to local

Co-authored-by: Just some guy <3859395+fubuloubu@users.noreply.github.com>
@NotPeopling2day NotPeopling2day added size: 2 pieces Relatively easy, but requires some thought and removed size: 3 pieces Moderately challenging, well-defined, may require a bit of research labels Aug 18, 2022
@fubuloubu fubuloubu mentioned this issue Feb 4, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: refactor Refactor of existing code or process size: 2 pieces Relatively easy, but requires some thought
Projects
None yet
Development

No branches or pull requests

1 participant