-
Notifications
You must be signed in to change notification settings - Fork 20
421 optimise indexer transaction receipt storage #423
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
421 optimise indexer transaction receipt storage #423
Conversation
| return b58encode(signature).decode("utf-8") | ||
|
|
||
| def create_slot_sig(self, max_slot): | ||
| slot = randint(0, max_slot) |
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.
random slot makes test fail "randomly"
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.
======================================================================
FAIL: test_query (proxy.testing.test_trx_receipts_storage.TestTrxReceiptsStorage)
Test get_trxs method workds as expected
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/proxy/testing/test_trx_receipts_storage.py", line 63, in test_query
self.assertEqual(retrieved_trxs[0][0], start_slot)
AssertionError: 35 != 34
----------------------------------------------------------------------
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.
Thank you! This is due to probabilistic reasons: sometimes generated data not contains any transaction for given slot. In average, it will exist only two transaction for every given slot with current generation parameters (100 trxs in 50 slots randomly), but in reality there a cases when there are no transactions for given slot at all. Actually, testing expression must cover such cases, so I changed it.
| max_slot = max(max_slot, slot) | ||
| if slot < self.latest_processed_slot: | ||
| break | ||
| if trx['transaction']['message']['instructions'] is not None: |
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.
from ..common_neon.utils import get_from_dict
...
get_from_dict(trx, 'transaction', 'message', 'instructions')| cur.execute(f'SELECT 1 FROM {self.table_name} WHERE slot = %s AND signature = %s', (slot, signature,)) | ||
| return cur.fetchone() is not None | ||
|
|
||
| def get_trxs(self, start_slot = 0, reverse = 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.
Annotations?
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.
You don't need extra spaces around = according to PEP8
def get_trxs(self, start_slot=0, reverse=False):
* #409 indexer optomizations * #409 catch exceptiopns * #409 add airdropper and faucet artifacts * #409 remove unused variables * #409 return`self.last_slot` to `IndexerBase` class * #409 merge SQLDict and SQLDictBinKey classes to one * #409 remove debug log * #409 add metrics * 421 optimise indexer transaction receipt storage (#423) * Create TrxReceiptsStorage * Use new container in indexer and airdropper * Fix bug * Fix assertions in tests, use random start_slot Co-authored-by: Ivan Loboda <[email protected]> Co-authored-by: ivandzen <[email protected]> Co-authored-by: Ivan Loboda <[email protected]>
No description provided.