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

Updates to use v4 multi-node DB setup #225

Merged

Conversation

prathamesh0
Copy link
Collaborator

@prathamesh0 prathamesh0 commented Apr 26, 2022

Part of https://github.com/vulcanize/issue_tracking/issues/16

  • Update ON CONFLICT clauses in insert statements to DO NOTHING
    • To be fixed in an upcoming PR
  • Use COALESCE to avoid possible NULL values when reading from database
  • Run tests using the v4 multi-node TimescaleDB setup

@prathamesh0 prathamesh0 force-pushed the pm-v4-schema-fixes branch 2 times, most recently from 88fc10e to 1a83ff5 Compare May 2, 2022 11:36
@prathamesh0 prathamesh0 force-pushed the pm-v4-schema-fixes branch from 2ef7dfe to d2c25c6 Compare May 11, 2022 10:40
@prathamesh0 prathamesh0 changed the base branch from v1.10.16-statediff-v4 to v1.10.17-statediff-v4 May 11, 2022 10:40
@prathamesh0 prathamesh0 changed the title [WIP] Fix database insert statements and assertion errors [WIP] Fix assertion errors and updates to use v4 schema May 11, 2022
@prathamesh0 prathamesh0 changed the title [WIP] Fix assertion errors and updates to use v4 schema [WIP] Updates to use v4 multi-node DB setup May 11, 2022
@prathamesh0 prathamesh0 changed the title [WIP] Updates to use v4 multi-node DB setup Updates to use v4 multi-node DB setup May 12, 2022
@ashwinphatak ashwinphatak merged commit cef1fc4 into cerc-io:v1.10.17-statediff-v4 May 12, 2022
@ashwinphatak ashwinphatak deleted the pm-v4-schema-fixes branch May 12, 2022 09:13
abdulrabbani00 pushed a commit that referenced this pull request Jun 27, 2022
commit dc8b5f0349377e790a6a35feaa52e784c0f1c316
Author: Abdul Rabbani <[email protected]>
Date:   Mon Jun 20 09:57:39 2022 -0400

    Duplicate job check

commit 867d0104c580cf28c6c4554f6ae327a6b5cdf051
Author: Abdul Rabbani <[email protected]>
Date:   Mon Jun 20 09:54:37 2022 -0400

    update db ref

commit ad6c51f749e7252e1ab590c0495b9f3bfb502bac
Merge: 0a531d011 d629c99
Author: Abdul Rabbani <[email protected]>
Date:   Mon Jun 20 09:52:19 2022 -0400

    Merge branch 'v1.10.19-statediff-v4' into feature/node_id_array

commit 0a531d011a85a6bb943cdc9c7f3213145a2951f0
Author: Abdul Rabbani <[email protected]>
Date:   Mon Jun 20 09:44:08 2022 -0400

    update DB ref

commit 21df2fbdbe5f0d5b975d9a30f569ea05c34f2135
Author: Abdul Rabbani <[email protected]>
Date:   Wed Jun 15 08:22:24 2022 -0400

    minor syntax change

commit 4e4d4c27a9cf0bd85a1b72121ca37df99403b6c2
Author: Abdul Rabbani <[email protected]>
Date:   Tue Jun 14 12:32:49 2022 -0400

    Update port for testing

commit 8e2dec1ffe73d48291598f5498cfa6273502093a
Author: Abdul Rabbani <[email protected]>
Date:   Tue Jun 14 12:24:26 2022 -0400

    Update compose files

commit aee387decd8bbc89adb4d112f9821f686b45fddc
Author: Abdul Rabbani <[email protected]>
Date:   Tue Jun 14 12:15:05 2022 -0400

    Add uniqueness

commit 1c1a460
Author: Abdul Rabbani <[email protected]>
Date:   Mon Jun 13 18:43:10 2022 -0400

    Update default config

commit fce04b5
Author: Abdul Rabbani <[email protected]>
Date:   Mon Jun 13 18:37:56 2022 -0400

    Use stack orchestrator properly

commit 573fdfd
Author: Abdul Rabbani <[email protected]>
Date:   Mon Jun 13 18:29:30 2022 -0400

    Update "file" and CICD

commit d2ee36d
Author: Abdul Rabbani <[email protected]>
Date:   Mon Jun 13 16:06:43 2022 -0400

    Update upsert for eth.header_cids

commit 8593cfd
Author: Abdul Rabbani <[email protected]>
Date:   Fri May 27 09:40:24 2022 -0400

    Update Lt condition

commit 10460f4
Author: Abdul Rabbani <[email protected]>
Date:   Fri May 27 09:24:46 2022 -0400

    Use correct DB and fix syntax

commit 6a44b2e
Author: Abdul Rabbani <[email protected]>
Date:   Fri May 27 09:16:38 2022 -0400

    Update the read rows command.

commit 0a4079f
Author: Abdul Rabbani <[email protected]>
Date:   Fri May 27 09:03:57 2022 -0400

    Fix two tests

commit 07ce01d
Author: Abdul Rabbani <[email protected]>
Date:   Fri May 27 08:57:34 2022 -0400

    Update test for v4

commit 2bf46e9
Author: Abdul Rabbani <[email protected]>
Date:   Fri May 27 08:52:17 2022 -0400

    Update branch

commit 957013e
Author: Abdul Rabbani <[email protected]>
Date:   Fri May 27 08:50:52 2022 -0400

    Update the test

commit 1277fa1
Author: Abdul Rabbani <[email protected]>
Date:   Fri May 27 08:09:37 2022 -0400

    Update CI/CD and match v3

commit 6d5f4ac
Merge: af077d7 2ca7147
Author: Abdul Rabbani <[email protected]>
Date:   Fri May 27 08:08:52 2022 -0400

    Merge branch 'heads/v1.10.18-statediff-3.2.2' into v1.10.18-statediff-v4

commit 2ca7147
Merge: 51e8824 ab9e73a
Author: Abdul Rabbani <[email protected]>
Date:   Thu May 26 15:42:34 2022 -0400

    Merge pull request #233 from vulcanize/feature/cicd-improvements

    Feature/cicd improvements

commit ab9e73a
Author: Abdul Rabbani <[email protected]>
Date:   Thu May 26 15:19:50 2022 -0400

    Update readme.

commit 1884af3
Author: Abdul Rabbani <[email protected]>
Date:   Thu May 26 15:14:46 2022 -0400

    Update CICD

commit af077d7
Author: Abdul Rabbani <[email protected]>
Date:   Wed May 25 16:26:58 2022 -0400

    Update go.sum

commit cef5f08
Merge: ef8c9f2 de23cf9
Author: Abdul Rabbani <[email protected]>
Date:   Wed May 25 16:23:37 2022 -0400

    Merge tag 'v1.10.18' into v1.10.18-statediff-v4

commit 51e8824
Merge: 41faf71 de23cf9
Author: Abdul Rabbani <[email protected]>
Date:   Wed May 25 14:45:55 2022 -0400

    Merge tag 'v1.10.18' into v1.10.18-statediff-v3

commit 41faf71
Merge: 17d272d d57c260
Author: Abdul Rabbani <[email protected]>
Date:   Tue May 17 16:53:08 2022 -0400

    Merge pull request #229 from vulcanize/feature/cicd-update-docker

    Combine build and push for Docker

commit d57c260
Author: Abdul Rabbani <[email protected]>
Date:   Tue May 17 16:28:23 2022 -0400

    Combine build and push

commit ef8c9f2
Merge: 328ab95 2caedb0
Author: Ashwin Phatak <[email protected]>
Date:   Tue May 17 17:21:03 2022 +0530

    Merge pull request #228 from deep-stack/pm-single-node-changes

    Changes for using single-node v4 db schema

commit 2caedb0
Author: prathamesh0 <[email protected]>
Date:   Tue May 17 14:12:10 2022 +0530

    Changes for using single-node v4 db schema

commit 328ab95
Merge: cef1fc4 41c9ea0
Author: Ashwin Phatak <[email protected]>
Date:   Mon May 16 12:05:27 2022 +0530

    Merge pull request #227 from deep-stack/pm-v4-merge

    Merge branch 'v1.10.17-statediff-3.2.1' into v4

commit 41c9ea0
Author: prathamesh0 <[email protected]>
Date:   Mon May 16 11:37:31 2022 +0530

    Add new target branch for github actions

commit a6891a6
Merge: cef1fc4 17d272d
Author: prathamesh0 <[email protected]>
Date:   Mon May 16 10:52:45 2022 +0530

    Merge branch 'v1.10.17-statediff-3.2.1' into v4

commit 17d272d
Merge: 8316859 4318911
Author: Ashwin Phatak <[email protected]>
Date:   Fri May 13 16:09:34 2022 +0530

    Merge pull request #226 from deep-stack/ng-public-WatchedAddressesLeafKeys

    Export builder config param WatchedAddressesLeafKeys

commit 4318911
Author: nabarun <[email protected]>
Date:   Thu May 12 19:27:14 2022 +0530

    Move over helper function for loading chain config

commit aa3fa24
Author: nabarun <[email protected]>
Date:   Thu May 12 15:49:58 2022 +0530

    Implemented method to get private watchedAddressesLeafKeys

commit cef1fc4
Merge: de0954a 8a4583c
Author: Ashwin Phatak <[email protected]>
Date:   Thu May 12 14:43:06 2022 +0530

    Merge pull request #225 from deep-stack/pm-v4-schema-fixes

    Updates to use v4 multi-node DB setup

commit 24058dc
Author: nabarun <[email protected]>
Date:   Wed May 11 18:10:20 2022 +0530

    Export builder config param WatchedAddressesLeafKeys

commit 8a4583c
Author: prathamesh0 <[email protected]>
Date:   Wed May 11 16:15:53 2022 +0530

    Run tests using multi-node database setup

commit d2c25c6
Author: prathamesh0 <[email protected]>
Date:   Thu May 5 19:26:10 2022 +0530

    Update more test queries to use COALESCE

commit 6ae7719
Author: prathamesh0 <[email protected]>
Date:   Thu May 5 17:27:02 2022 +0530

    Use COALESCE to avoid possible NULL values from database

commit ecba34c
Author: prathamesh0 <[email protected]>
Date:   Mon May 2 17:08:01 2022 +0530

    Change ON CONFLICT clauses to do nothing

commit 9db8c59
Author: prathamesh0 <[email protected]>
Date:   Tue Apr 26 11:03:13 2022 +0530

    Update ipld-eth-db build configuration in docker-compose file

commit 8551aae
Author: prathamesh0 <[email protected]>
Date:   Thu Apr 21 17:43:58 2022 +0530

    Fix database insert statements according to v4 schema

commit d2144ca
Author: prathamesh0 <[email protected]>
Date:   Tue Apr 19 10:40:30 2022 +0530

    Fix assertion errors

commit de0954a
Merge: 4e73e17 8316859
Author: prathamesh0 <[email protected]>
Date:   Wed May 11 13:42:51 2022 +0530

    Merge latest v3 changes into v4

commit 8316859
Author: Abdul Rabbani <[email protected]>
Date:   Fri Apr 22 08:45:10 2022 -0400

    Remove `related-repository`

commit 4981011
Merge: e5824ec e6ac85f
Author: Abdul Rabbani <[email protected]>
Date:   Wed Apr 6 14:44:49 2022 -0400

    Merge pull request #222 from vulcanize/v1.10.17-statediff-v3.2.0

    Handle all breaking changes for the patch

commit e6ac85f
Author: Abdul Rabbani <[email protected]>
Date:   Wed Apr 6 13:51:03 2022 -0400

    Remove redundant deferences for pointers

commit 3477d35
Author: Abdul Rabbani <[email protected]>
Date:   Wed Apr 6 10:57:57 2022 -0400

    Handle all breaking changes for the patch

    The major change to integrate the patch has been:

    * Updating the arguments for `rlp.EncodeToBytes`. This function accepts interfaces, but since the last update, it is better to pass in a pointer to the function.
    * From the Ethereum Release Notes: "
    Compatibility note about `core/types`: For optimization purposes, `types.Header` and other types in this package now implement the `rlp.Encoder` interface. This change can cause incompatibilities because the new method is implemented with pointer receiver. Attempting to RLP-encode unadressable (i.e. non-pointer) values of type `Header` does not work anymore and will result in an error."
    * Instead of just updating all the headers. I have updated all parameters for the `rlp.EncodeToBytes` to be pointers instead of values.

    __Please take a close look at the updates__. The functions won't fail if a non-pointer is passed (in most cases), but we could be unexpected behaviors.

commit e5824ec
Merge: a7caed4 3ef54d3
Author: Abdul Rabbani <[email protected]>
Date:   Tue Apr 5 15:50:45 2022 -0400

    Merge pull request #221 from vulcanize/v1.10.17-statediff-v3.2.0

    Update a few go dependencies + GHA workflow

commit 3ef54d3
Author: Abdul Rabbani <[email protected]>
Date:   Tue Apr 5 15:49:41 2022 -0400

    Update a few go dependencies + GHA workflow

commit a7caed4
Merge: a9ab76c 25c9b49
Author: Abdul Rabbani <[email protected]>
Date:   Tue Apr 5 15:30:47 2022 -0400

    Merge tag 'v1.10.17' into v1.10.17-statediff-v3

commit a9ab76c
Merge: 2aaf6bc b351f8f
Author: Ashwin Phatak <[email protected]>
Date:   Tue Apr 5 14:21:19 2022 +0530

    Merge pull request #210 from deep-stack/pm-removed-storage-nodes

    Add diffs for storage nodes of destroyed contracts

commit b351f8f
Author: prathamesh0 <[email protected]>
Date:   Tue Apr 5 12:38:14 2022 +0530

    Increase timeout in a failing test

commit c21aa96
Author: prathamesh0 <[email protected]>
Date:   Tue Mar 22 18:04:19 2022 +0530

    Index Removed diffs without leaf keys if an account or storage node is moved

commit 9917e6c
Author: prathamesh0 <[email protected]>
Date:   Thu Mar 17 18:04:20 2022 +0530

    Fix linting errors

commit 8436543
Author: prathamesh0 <[email protected]>
Date:   Wed Mar 16 11:44:01 2022 +0530

    Update indexer unit tests

commit a14745d
Author: nabarun <[email protected]>
Date:   Tue Mar 15 19:22:09 2022 +0530

    Updated unit tests for changes in builder

commit 4855d93
Author: prathamesh0 <[email protected]>
Date:   Tue Mar 15 17:10:26 2022 +0530

    Index Removed storage diffs on contract destruction

commit 2aaf6bc
Merge: c8b68db 52df346
Author: Ashwin Phatak <[email protected]>
Date:   Tue Apr 5 09:33:51 2022 +0530

    Merge pull request #212 from deep-stack/pm-watched-addresses-v3

    Statediff API (v3) to change addresses watched in direct indexing mode

commit 52df346
Author: prathamesh0 <[email protected]>
Date:   Mon Mar 21 18:03:48 2022 +0530

    Create file for watched addresses only when required

commit 7103123
Author: prathamesh0 <[email protected]>
Date:   Mon Mar 21 14:34:12 2022 +0530

    Add indexer unit tests for loading watched addresses

commit e752646
Author: prathamesh0 <[email protected]>
Date:   Fri Mar 18 19:49:41 2022 +0530

    Add file mode indexer unit tests for watched address methods

commit a7f9354
Author: prathamesh0 <[email protected]>
Date:   Fri Mar 18 18:29:15 2022 +0530

    Implement watch address indexer methods for file mode

commit 12b9f50
Author: prathamesh0 <[email protected]>
Date:   Thu Mar 17 10:49:18 2022 +0530

    Update context used in watch address indexer functions

commit 750e44e
Author: prathamesh0 <[email protected]>
Date:   Wed Mar 16 20:14:44 2022 +0530

    Add builder test for removal of watched addresses

commit f3761ef
Author: prathamesh0 <[email protected]>
Date:   Wed Mar 16 20:10:06 2022 +0530

    Add a fix in builder for removal of a non-watched address

commit 7f38afe
Author: prathamesh0 <[email protected]>
Date:   Wed Mar 16 19:25:10 2022 +0530

    Add tests for the API to change addresses being watched

commit af4dbed
Author: prathamesh0 <[email protected]>
Date:   Wed Mar 16 19:01:55 2022 +0530

    Add tests for indexer methods used to change addresses being watched

commit 8fc2c09
Author: prathamesh0 <[email protected]>
Date:   Wed Mar 16 18:43:39 2022 +0530

    Add placeholder indexer methods for file and dump modes

commit 9b234ef
Author: prathamesh0 <[email protected]>
Date:   Wed Mar 16 15:35:33 2022 +0530

    Statediff API to change addresses being watched in direct indexing

commit c8b68db
Merge: 3045068 d24a49e
Author: Abdul Rabbani <[email protected]>
Date:   Thu Mar 31 14:38:59 2022 -0400

    Merge pull request #217 from vulcanize/feature/known-gaps

    Feature/known gaps

commit d24a49e
Author: Abdul Rabbani <[email protected]>
Date:   Thu Mar 31 14:14:34 2022 -0400

    Add Workflow dispatch for docker builds

commit 102f874
Author: Abdul Rabbani <[email protected]>
Date:   Thu Mar 31 14:11:57 2022 -0400

    Update known_gaps table name

commit 359799d
Author: Abdul Rabbani <[email protected]>
Date:   Thu Mar 31 14:02:30 2022 -0400

    Update docker compose

commit 2e836e8
Author: Abdul Rabbani <[email protected]>
Date:   Thu Mar 31 11:37:01 2022 -0400

    PR Updates as per Ian's request

commit a60d5a0
Author: Abdul Rabbani <[email protected]>
Date:   Wed Mar 30 17:30:19 2022 -0400

    Code Clean Up

commit fc6a937
Author: Abdul Rabbani <[email protected]>
Date:   Wed Mar 30 12:53:44 2022 -0400

    Add Prometheus metrics and write SQL file if it has data.

commit b960661
Author: Abdul Rabbani <[email protected]>
Date:   Tue Mar 29 16:45:26 2022 -0400

    Refactor: Decouple knownGaps and Indexer

    This commit decouples knownGaps and Indexer. All knownGaps logic is in its own file. This makes testing and maintainability easier.

    We have also removed all efforts to check the `lastProcessedblock` - This is because we won't ever run into this issue (hyptothetically), because geth won't let it happen.

commit fc341a9
Author: Abdul Rabbani <[email protected]>
Date:   Mon Mar 28 15:00:29 2022 -0400

    ** Write to file if you can't write to DB

    This commit contains many new features:

    1. Write the insert statement to file if there is an error when trying to write to DB.
    2. Test the write to DB and write to file features in unit tests. They work as expected.
    3. Insert logic for calling the knownGaps function (untested).

    This PR makes a major change to the way statediff is started. Unless it is started in `file` mode, it will create a `file` indexer. This indexer will be used for writing errors to disk.

commit f566aa7
Author: Abdul Rabbani <[email protected]>
Date:   Fri Mar 25 16:50:43 2022 -0400

    % Checkpoint - Added the feature to write to File if writing to DB errors out. NOT TESTED

commit f6ff20e
Author: Abdul Rabbani <[email protected]>
Date:   Fri Mar 25 09:54:36 2022 -0400

    Handle All Gaps within Geth

    Including an updated doc which keeps track of events in this PR.

commit 4e73e17
Merge: 6b74310 1e64f48
Author: Ian Norden <[email protected]>
Date:   Thu Mar 24 10:10:35 2022 -0500

    Merge pull request #211 from vulcanize/v1.10.16-statediff-4.0.0

    update sql indexer to use new v4 schema

commit 1e64f48
Author: i-norden <[email protected]>
Date:   Thu Mar 24 10:09:48 2022 -0500

    update unit tests

commit 7bc4c75
Author: i-norden <[email protected]>
Date:   Thu Mar 24 08:01:26 2022 -0500

    update file writing mode

commit 1a3a63d
Author: Abdul Rabbani <[email protected]>
Date:   Wed Mar 23 14:03:35 2022 -0400

    Find Gaps and at them to `known_gaps`

    This contains all the logic needed to add a gap to the `known_gaps` table.

    We can now add this code to various parts of the application to calculate if a gap has occured.

commit ce66532
Author: Abdul Rabbani <[email protected]>
Date:   Tue Mar 22 15:49:30 2022 -0400

    Improve Testing for Insert, add a query function

commit 73f46a5
Author: Abdul Rabbani <[email protected]>
Date:   Tue Mar 22 11:52:35 2022 -0400

    Remove the need to pass a transaction when upserting to known_gaps

    Thanks Ian :D

commit bca12f9
Author: Abdul Rabbani <[email protected]>
Date:   Mon Mar 21 17:43:15 2022 -0400

    Delete geth-linux-amd64

commit 921538b
Author: Abdul Rabbani <[email protected]>
Date:   Mon Mar 21 16:28:13 2022 -0400

    Function To Add entry to `known_gaps`

    This commit contains all the code needed to update the `known_gaps` table. It uses a generic function `PushKnownGaps` to insert gaps to the database.

    The current test is very "basic." All it does it insert a dummy gap into the database. As long as their is no error it will return succesfully.

    I have also removed the foundry subfolder. I am using the `related-repository` setup for testing.

commit 3045068
Merge: 53c1322 333dd3f
Author: Abdul Rabbani <[email protected]>
Date:   Fri Mar 18 09:44:12 2022 -0400

    Merge pull request #205 from vulcanize/feature/155-waitForSync

    Add a flag to start processing statediff if we are caught up to the head of the chain

commit 333dd3f
Author: Abdul Rabbani <[email protected]>
Date:   Fri Mar 18 08:29:36 2022 -0400

    Updates as Per Ian's comments

    1. Fix some naming inconsistencies.
    2. `GetSyncStatus` returns a bool
    3. `Start` handles any `errors` from the `WaitingForSync` function.
    4. Add a sleep for the `while` loop.
    5. Fix test based on a conditional that would never be met.

commit 9775355
Author: i-norden <[email protected]>
Date:   Thu Mar 17 07:17:04 2022 -0500

    update sql indexer to use new v4 schema that denormalizes by block_number for the purposes of partitioning & sharding

commit c5a3697
Author: Abdul Rabbani <[email protected]>
Date:   Thu Mar 10 13:33:00 2022 -0500

    Fix lint errors

commit f468636
Author: Abdul Rabbani <[email protected]>
Date:   Thu Mar 10 13:24:06 2022 -0500

    Update param --> parameter to fix conflicting names

commit e409059
Author: Abdul Rabbani <[email protected]>
Date:   Thu Mar 10 13:04:25 2022 -0500

    Add a flag to start processing statediff if we are caught up to the head of the chain

commit 53c1322
Merge: 6b74310 e4c4514
Author: Abdul Rabbani <[email protected]>
Date:   Wed Mar 16 14:48:33 2022 -0400

    Merge pull request #209 from vulcanize/feature/update-foundry

    Basic updates, add prints and variables

commit e4c4514
Author: Abdul Rabbani <[email protected]>
Date:   Wed Mar 16 14:47:31 2022 -0400

    Basic updates, add prints and variables

commit 6b74310
Merge: f4b7bd4 0d70b7c
Author: Abdul Rabbani <[email protected]>
Date:   Wed Mar 16 08:04:02 2022 -0400

    Merge pull request #208 from vulcanize/feature/gh-208-add-foundry

    Add Foundry for Manual Integration Testing

commit 0d70b7c
Author: Abdul Rabbani <[email protected]>
Date:   Tue Mar 15 16:18:50 2022 -0400

    Fix Linter

commit df55a62
Author: Abdul Rabbani <[email protected]>
Date:   Mon Mar 14 15:16:12 2022 -0400

    Working Foundry

commit 90c8985
Author: Abdul Rabbani <[email protected]>
Date:   Mon Mar 14 13:16:03 2022 -0400

    forge install: ds-test

commit 4704c44
Author: Abdul Rabbani <[email protected]>
Date:   Fri Mar 11 17:30:34 2022 -0500

    Starting point for Foundry

    I still need to finish it up, but geth runs properly.

commit f4b7bd4
Author: i-norden <[email protected]>
Date:   Wed Feb 16 14:46:25 2022 -0600

    add new target branch for github actions

commit 3aead03
Author: Elizabeth <[email protected]>
Date:   Mon Jan 28 15:31:01 2019 -0600

    Statediffing geth

    * Write state diff to CSV (#2)

    * port statediff from https://github.com/jpmorganchase/quorum/blob/9b7fd9af8082795eeeb6863d9746f12b82dd5078/statediff/statediff.go; minor fixes

    * integrating state diff extracting, building, and persisting into geth processes

    * work towards persisting created statediffs in ipfs; based off github.com/vulcanize/eth-block-extractor

    * Add a state diff service

    * Remove diff extractor from blockchain

    * Update imports

    * Move statediff on/off check to geth cmd config

    * Update starting state diff service

    * Add debugging logs for creating diff

    * Add statediff extractor and builder tests and small refactoring

    * Start to write statediff to a CSV

    * Restructure statediff directory

    * Pull CSV publishing methods into their own file

    * Reformatting due to go fmt

    * Add gomega to vendor dir

    * Remove testing focuses

    * Update statediff tests to use golang test pkg

    instead of ginkgo

    - builder_test
    - extractor_test
    - publisher_test

    * Use hexutil.Encode instead of deprecated common.ToHex

    * Remove OldValue from DiffBigInt and DiffUint64 fields

    * Update builder test

    * Remove old storage value from updated accounts

    * Remove old values from created/deleted accounts

    * Update publisher to account for only storing current account values

    * Update service loop and fetching previous block

    * Update testing

    - remove statediff ginkgo test suite file
    - move mocks to their own dir

    * Updates per go fmt

    * Updates to tests

    * Pass statediff mode and path in through cli

    * Return filename from publisher

    * Remove some duplication in builder

    * Remove code field from state diff output

    this is the contract byte code, and it can still be obtained by querying
    the db by the codeHash

    * Consolidate acct diff structs for updated & updated/deleted accts

    * Include block number in csv filename

    * Clean up error logging

    * Cleanup formatting, spelling, etc

    * Address PR comments

    * Add contract address and storage value to csv

    * Refactor accumulating account row in csv publisher

    * Add DiffStorage struct

    * Add storage key to csv

    * Address PR comments

    * Fix publisher to include rows for accounts that don't have store updates

    * Update builder test after merging in release/1.8

    * Update test contract to include storage on contract intialization

    - so that we're able to test that storage diffing works for created and
    deleted accounts (not just updated accounts).

    * Factor out a common trie iterator method in builder

    * Apply goimports to statediff

    * Apply gosimple changes to statediff

    * Gracefully exit geth command(#4)

    * Statediff for full node (#6)

    * Open a trie from the in-memory database

    * Use a node's LeafKey as an identifier instead of the address

    It was proving difficult to find look the address up from a given path
    with a full node (sometimes the value wouldn't exist in the disk db).
    So, instead, for now we are using the node's LeafKey with is a Keccak256
    hash of the address, so if we know the address we can figure out which
    LeafKey it matches up to.

    * Make sure that statediff has been processed before pruning

    * Use blockchain stateCache.OpenTrie for storage diffs

    * Clean up log lines and remove unnecessary fields from builder

    * Apply go fmt changes

    * Add a sleep to the blockchain test

    * refactoring/reorganizing packages

    * refactoring statediff builder and types and adjusted to relay proofs and paths (still need to make this optional)

    * refactoring state diff service and adding api which allows for streaming state diff payloads over an rpc websocket subscription

    * make proofs and paths optional + compress service loop into single for loop (may be missing something here)

    * option to process intermediate nodes

    * make state diff rlp serializable

    * cli parameter to limit statediffing to select account addresses + test

    * review fixes and fixes for issues ran into in integration

    * review fixes; proper method signature for api; adjust service so that statediff processing is halted/paused until there is at least one subscriber listening for the results

    * adjust buffering to improve stability; doc.go; fix notifier
    err handling

    * relay receipts with the rest of the data + review fixes/changes

    * rpc method to get statediff at specific block; requires archival node or the block be within the pruning range

    * fix linter issues

    * include total difficulty to the payload

    * fix state diff builder: emit actual leaf nodes instead of value nodes; diff on the leaf not on the value; emit correct path for intermediate nodes

    * adjust statediff builder tests to changes and extend to test intermediate nodes; golint

    * add genesis block to test; handle block 0 in StateDiffAt

    * rlp files for mainnet blocks 0-3, for tests

    * builder test on mainnet blocks

    * common.BytesToHash(path) => crypto.Keaccak256(hash) in builder; BytesToHash produces same hash for e.g. []byte{} and []byte{\x00} - prefix \x00 steps are inconsequential to the hash result

    * complete tests for early mainnet blocks

    * diff type for representing deleted accounts

    * fix builder so that we handle account deletions properly and properly diff storage when an account is moved to a new path; update params

    * remove cli params; moving them to subscriber defined

    * remove unneeded bc methods

    * update service and api; statediffing params are now defined by user through api rather than by service provider by cli

    * update top level tests

    * add ability to watch specific storage slots (leaf keys) only

    * comments; explain logic

    * update mainnet blocks test

    * update api_test.go

    * storage leafkey filter test

    * cleanup chain maker

    * adjust chain maker for tests to add an empty account in block1 and switch to EIP-158 afterwards (now we just need to generate enough accounts until one causes the empty account to be touched and removed post-EIP-158 so we can simulate and test that process...); also added 2 new blocks where more contract storage is set and old slots are set to zero so they are removed so we can test that

    * found an account whose creation causes the empty account to be moved to a new path; this should count as 'touching; the empty account and cause it to be removed according to eip-158... but it doesn't

    * use new contract in unit tests that has self-destruct ability, so we can test eip-158 since simply moving an account to new path doesn't count as 'touchin' it

    * handle storage deletions

    * tests for eip-158 account removal and storage value deletions; there is one edge case left to test where we remove 1 account when only two exist such that the remaining account is moved up and replaces the root branch node

    * finish testing known edge cases

    * add endpoint to fetch all state and storage nodes at a given blockheight; useful for generating a recent atate cache/snapshot that we can diff forward from rather than needing to collect all diffs from genesis

    * test for state trie builder

    * if statediffing is on, lock tries in triedb until the statediffing service signals they are done using them

    * fix mock blockchain; golint; bump patch

    * increase maxRequestContentLength; bump patch

    * log the sizes of the state objects we are sending

    * CI build (#20)

    * CI: run build on PR and on push to master

    * CI: debug building geth

    * CI: fix coping file

    * CI: fix coping file v2

    * CI: temporary upload file to release asset

    * CI: get release upload_url by tag, upload asset to current relase

    * CI: fix tag name

    * fix ci build on statediff_at_anyblock-1.9.11 branch

    * fix publishing assets in release

    * use context deadline for timeout in eth_call

    * collect and emit codehash=>code mappings for state objects

    * subscription endpoint for retrieving all the codehash=>code mappings that exist at provided height

    * Implement WriteStateDiffAt

    * Writes state diffs directly to postgres

    * Adds CLI flags to configure PG

    * Refactors builder output with callbacks

    * Copies refactored postgres handling code from ipld-eth-indexer

    * rename PostgresCIDWriter.{index->upsert}*

    * rm unused

    * output code & codehash iteratively

    * had to rf some types for this

    * prometheus metrics output

    * duplicate recent eth-indexer changes

    * migrations and metrics...

    * [wip] prom.Init() here? another CLI flag?

    * tidy & DRY

    * statediff WriteLoop service + CLI flag

    * [wip] update test mocks

    * todo - do something meaningful to test write loop

    * logging

    * use geth log

    * port tests to go testing

    * drop ginkgo/gomega

    * fix and cleanup tests

    * fail before defer statement

    * delete vendor/ dir

    * fixes after rebase onto 1.9.23

    * fix API registration

    * use golang 1.15.5 version (#34)

    * bump version meta; add 0.0.11 branch to actions

    * bump version meta; update github actions workflows

    * statediff: refactor metrics

    * Remove redundant statediff/indexer/prom tooling and use existing
    prometheus integration.

    * "indexer" namespace for metrics

    * add reporting loop for db metrics

    * doc

    * metrics for statediff stats

    * metrics namespace/subsystem = statediff/{indexer,service}

    * statediff: use a worker pool (for direct writes)

    * fix test

    * fix chain event subscription

    * log tweaks

    * func name

    * unused import

    * intermediate chain event channel for metrics

    * update github actions; linting

    * add poststate and status to receipt ipld indexes

    * stateDiffFor endpoints for fetching or writing statediff object by blockhash; bump statediff version

    * fixes after rebase on to v1.10.1

    * update github actions and version meta; go fmt

    * add leaf key to removed 'nodes'

    * include Postgres migrations and schema

    * service documentation

    * touching up

    * update github actions after rebase

    * fix connection leak (misplaced defer) and perform proper rollback on errs

    * improve error logging; handle PushBlock internal err

    * build docker image and publish it to Docker Hub on release

    * add access list tx to unit tests

    * MarshalBinary and UnmarshalBinary methods for receipt

    * fix error caused by 2718 by using MarshalBinary instead of EncodeRLP methods

    * ipld encoding/decoding tests

    * update TxModel; add AccessListElementModel

    * index tx type and access lists

    * add access list metrics

    * unit tests for tx_type and access list table

    * unit tests for receipt marshal/unmarshal binary methods

    * improve documentation of the encoding methods

    * fix issue identified in linting

    * update github actions and version meta after rebase

    * unit test that fails undeterministically on eip2930 txs, giving same error we are seeing in prod

    * Include genesis block state diff.

    * documentation on versioning, rebasing, releasing; bump version meta

    * Add geth and statediff unit test to CI.

    * Set pgpassword in env.

    * Added comments.

    * Add new major branch to github action.

    * Add support for Dynamic txn(EIP-1559).

    * Update version meta to 0.0.24

    * Verify block base fee in test.

    * Fix base_fee type and add backward compatible test.

    * Remove type definition for AccessListElementModel

    * Change basefee to int64/bigint.

    * block and uncle reward in PoA network = 0  (#87)

    * in PoA networks there is no block and uncle rewards

    * bump meta version

    * (cherry picked from commit b64ca14)

    * Use Ropsten to test block reward.

    * Add Makefile target to build static linux binaries.

    * Strip symbol tables from static binaries.

    * Fix block_fee to support NULL values.

    * bump version meta.

    * Add new major branch to github action.

    * rename doc.go to README.md

    * Create a seperate table for storing logs

    * Bump statediff version to 0.0.26.

    * add btree index to state/storage_cids.node_type; updated schema

    * Dedup receipt data.

    * Fix linter errors.

    * Address comments.

    * Bump statediff version to 0.0.27.

    * new cli flag for initializing db first time service is ran

    * only write Removed node ipld block (on db init) and reuse constant cid and mhkey

    * test new handling of Removed nodes; don't require init flag

    * log metrics

    * Add new major branch to github action.

    * Fix build.

    * Update golang version in CI.

    * Use ipld-eth-db in testing.

    * Remove migration from repo.

    * Add new major branch to github action.

    *Use `GetTd` instead of `GetTdByHash`
    ethereum@6289137

    * Add new major branch to github action.

    * Report DB metrics

    * batch inserts to public.blocks

    * v2 => v3  major refactor

    * fixes and cli integration for new options

    * update example command in readme

    * ashwin's fix for failing pgx unit test

    * update to use new schema; fix pgx driver

    * indexer that writes sql stmts out to a file

    * cli integration

    * fix unit tests

    * use node_id as PK/FK

    * misc fixes/adjustments

    * update README

    * cleanup; more unit tests

    * basefee is big.Int, it won't always fit in int64

    * adjust for schema updates

    * finish unit tests

    * test harnest for arbitrary mainnet blocks and receipts

    * cache problematic block locally for quicker testing/easier CI testing

    * fix issue with log/logTrie processing

    * remove some unecessary hashing operations

    * handle edge case

    * add more 'bad blocks' to mainnet_tests

    * increase file write buffer size

    * increase buffer further

    * fix rct trie multicodec type

    * extend testing

    * log trie fk fix

    * bump statediff meta version; use db v0.3.0 in compose

    * skip file writing tests in CI, for now

    * prevent parallel execution of tests in different pkgs (suspect this is what causes our deadlock to show up only in CI test env)
    adjust write buffering

    * fix rct unit tests

    * fix README formatting

    * port retry on deadlock detection feature

    * new workflow on-'master' targets

    * update version meta

    * improve test coverage for logs

    * fix possible race condition

    * fix CI

    * check tx pool state at end of unit tests

    * better logging of rollbacks and dead lock retries
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