cerc-io / ipld-eth-state-snapshot

Read-only mirror of https://git.vdb.to/cerc-io/ipld-eth-state-snapshot (Tool for inserting the entire state and storage tries into PG-IPFS)
https://git.vdb.to/cerc-io/ipld-eth-state-snapshot
GNU Affero General Public License v3.0
8 stars 4 forks source link

Update to use the new schemas #10

Closed i-norden closed 2 years ago

i-norden commented 2 years ago

Currently, this tool writes to the Postgres DB schema defined in https://github.com/vulcanize/ipld-eth-db/releases/tag/v2.0.0

We need to upgrade it to write the models defined in https://github.com/vulcanize/ipld-eth-db/releases/tag/v3.0.6

The primary difference between these schemas is that the new (v3) schema uses natural primary keys, based on unique deterministic fields (or combinations of fields) of the ethereum objects (e.g. header hash, tx hash, header hash + state path).

In addition, some new columns unrelated to primary keys have been added (coinbase in header_cids, value in transaction_cids) and some columns have been removed (base_fee in header_cids).

This snapshot tool only operates on header_cids, state_cids, and storage_cids tables so only the v2 => v3 changes to these tables need to be reflected here.

Steps:

  1. Update geth dependency to the v3 compatible version: https://github.com/vulcanize/go-ethereum/releases
  2. Adjust the publisher to write the new v3 models to Postgres (actually to csv files, see below).

NOTE: This work should be done on-top of the changes that enable writing the models out to a CSV for loading into Postgres by COPY FROM, aka https://github.com/vulcanize/ipld-eth-state-snapshot/issues/18.