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

Implement L2 transactions downloader #423

Merged
merged 34 commits into from Jul 25, 2023

Conversation

torztomasz
Copy link
Contributor

Resolves L2B-1449

@linear
Copy link

linear bot commented Jul 13, 2023

L2B-1449 Write Live Transaction Downloader

Write an agent that will use LiveTransactionClient from L2B-1442 to constantly check for incoming live transactions or their alternatives. Transactions are indexed by internal ApexId so always ask for subsequent transactions.

Important - locking the table

There will be two processes writing to l2 transactions table: feeder gateway downloader that does it as a part of SyncService and live transaction downloader which is implemented as part of this story. To make sure they don't update the tabe at the same time use a lock:

  • once data is downloaded and you're ready to perform database operations, start a new transaction(!) issue: LOCK <l2_transactions_table_name> IN ROW EXCLUSIVE MODE;
  • this will keep the table readable but not writable
  • do all operations as part of that transaction(!!!!)
  • if a second process tries to do the same, it will wait on that LOCK command until the running transaction finishes.

Acceptance Criteria

  • The downloader uses a separate async process (not connected with sync done by *SyncService)
  • Use locking in both, see the "Important" not above
  • When adding live transaction, and transaction with this id already exists in the table, skip it (do nothing)
  • Update process that downloads transactions from feeder gateway so that it removes all (live) transactions with IDs that are going to be added by this feeder update.
  • Database locking needs to be tested.

@torztomasz torztomasz changed the title Implement-l2-transactions-downloader Implement L2 transactions downloader Jul 13, 2023
@torztomasz torztomasz marked this pull request as ready for review July 20, 2023 09:15
@torztomasz torztomasz force-pushed the implement-l2-transactions-downloader branch from 57e1e86 to 03bf0af Compare July 21, 2023 08:50
@torztomasz torztomasz temporarily deployed to apex-goerli July 25, 2023 12:18 Inactive
@torztomasz torztomasz temporarily deployed to apex-goerli July 25, 2023 12:41 Inactive
@adamiak adamiak added this pull request to the merge queue Jul 25, 2023
Merged via the queue into master with commit 4a8f884 Jul 25, 2023
4 checks passed
@adamiak adamiak deleted the implement-l2-transactions-downloader branch July 25, 2023 19:07
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

2 participants