forked from cerc-io/ipld-eth-server
Rename sync command to fullSync
This commit is contained in:
parent
481988cb08
commit
d947c8f30a
@ -109,8 +109,8 @@ As mentioned above, VulcanizeDB's processes can be split into three categories:
|
|||||||
|
|
||||||
### Data syncing
|
### Data syncing
|
||||||
To provide data for transformations, raw Ethereum data must first be synced into VulcanizeDB.
|
To provide data for transformations, raw Ethereum data must first be synced into VulcanizeDB.
|
||||||
This is accomplished through the use of the `headerSync`, `sync`, or `coldImport` commands.
|
This is accomplished through the use of the `headerSync`, `fullSync`, or `coldImport` commands.
|
||||||
These commands are described in detail [here](documentation/sync.md).
|
These commands are described in detail [here](documentation/data-syncing.md).
|
||||||
|
|
||||||
### Data transformation
|
### Data transformation
|
||||||
Data transformation uses the raw data that has been synced into Postgres to filter out and apply transformations to
|
Data transformation uses the raw data that has been synced into Postgres to filter out and apply transformations to
|
||||||
|
@ -29,14 +29,14 @@ import (
|
|||||||
"github.com/vulcanize/vulcanizedb/utils"
|
"github.com/vulcanize/vulcanizedb/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
// syncCmd represents the sync command
|
// fullSyncCmd represents the fullSync command
|
||||||
var syncCmd = &cobra.Command{
|
var fullSyncCmd = &cobra.Command{
|
||||||
Use: "sync",
|
Use: "fullSync",
|
||||||
Short: "Syncs VulcanizeDB with local ethereum node",
|
Short: "Syncs VulcanizeDB with local ethereum node",
|
||||||
Long: `Syncs VulcanizeDB with local ethereum node. Populates
|
Long: `Syncs VulcanizeDB with local ethereum node. Populates
|
||||||
Postgres with blocks, transactions, receipts, and logs.
|
Postgres with blocks, transactions, receipts, and logs.
|
||||||
|
|
||||||
./vulcanizedb sync --starting-block-number 0 --config public.toml
|
./vulcanizedb fullSync --starting-block-number 0 --config public.toml
|
||||||
|
|
||||||
Expects ethereum node to be running and requires a .toml config:
|
Expects ethereum node to be running and requires a .toml config:
|
||||||
|
|
||||||
@ -49,14 +49,14 @@ Expects ethereum node to be running and requires a .toml config:
|
|||||||
ipcPath = "/Users/user/Library/Ethereum/geth.ipc"
|
ipcPath = "/Users/user/Library/Ethereum/geth.ipc"
|
||||||
`,
|
`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
sync()
|
fullSync()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(syncCmd)
|
rootCmd.AddCommand(fullSyncCmd)
|
||||||
|
|
||||||
syncCmd.Flags().Int64VarP(&startingBlockNumber, "starting-block-number", "s", 0, "Block number to start syncing from")
|
fullSyncCmd.Flags().Int64VarP(&startingBlockNumber, "starting-block-number", "s", 0, "Block number to start syncing from")
|
||||||
}
|
}
|
||||||
|
|
||||||
func backFillAllBlocks(blockchain core.BlockChain, blockRepository datastore.BlockRepository, missingBlocksPopulated chan int, startingBlockNumber int64) {
|
func backFillAllBlocks(blockchain core.BlockChain, blockRepository datastore.BlockRepository, missingBlocksPopulated chan int, startingBlockNumber int64) {
|
||||||
@ -67,20 +67,20 @@ func backFillAllBlocks(blockchain core.BlockChain, blockRepository datastore.Blo
|
|||||||
missingBlocksPopulated <- populated
|
missingBlocksPopulated <- populated
|
||||||
}
|
}
|
||||||
|
|
||||||
func sync() {
|
func fullSync() {
|
||||||
ticker := time.NewTicker(pollingInterval)
|
ticker := time.NewTicker(pollingInterval)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
blockChain := getBlockChain()
|
blockChain := getBlockChain()
|
||||||
lastBlock, err := blockChain.LastBlock()
|
lastBlock, err := blockChain.LastBlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("sync: Error getting last block: ", err)
|
log.Error("fullSync: Error getting last block: ", err)
|
||||||
}
|
}
|
||||||
if lastBlock.Int64() == 0 {
|
if lastBlock.Int64() == 0 {
|
||||||
log.Fatal("geth initial: state sync not finished")
|
log.Fatal("geth initial: state sync not finished")
|
||||||
}
|
}
|
||||||
if startingBlockNumber > lastBlock.Int64() {
|
if startingBlockNumber > lastBlock.Int64() {
|
||||||
log.Fatal("sync: starting block number > current block number")
|
log.Fatal("fullSync: starting block number > current block number")
|
||||||
}
|
}
|
||||||
|
|
||||||
db := utils.LoadPostgres(databaseConfig, blockChain.Node())
|
db := utils.LoadPostgres(databaseConfig, blockChain.Node())
|
||||||
@ -94,7 +94,7 @@ func sync() {
|
|||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
window, err := validator.ValidateBlocks()
|
window, err := validator.ValidateBlocks()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("sync: error in validateBlocks: ", err)
|
log.Error("fullSync: error in validateBlocks: ", err)
|
||||||
}
|
}
|
||||||
log.Info(window.GetString())
|
log.Info(window.GetString())
|
||||||
case <-missingBlocksPopulated:
|
case <-missingBlocksPopulated:
|
@ -23,7 +23,7 @@ Syncs block headers from a running Ethereum node into the VulcanizeDB table `hea
|
|||||||
```
|
```
|
||||||
- Alternatively, the ipc path can be passed as a flag instead `--client-ipcPath`.
|
- Alternatively, the ipc path can be passed as a flag instead `--client-ipcPath`.
|
||||||
|
|
||||||
## sync
|
## fullSync
|
||||||
Syncs blocks, transactions, receipts and logs from a running Ethereum node into VulcanizeDB tables named
|
Syncs blocks, transactions, receipts and logs from a running Ethereum node into VulcanizeDB tables named
|
||||||
`blocks`, `uncles`, `full_sync_transactions`, `full_sync_receipts` and `logs`.
|
`blocks`, `uncles`, `full_sync_transactions`, `full_sync_receipts` and `logs`.
|
||||||
- Queries the Ethereum node using RPC calls.
|
- Queries the Ethereum node using RPC calls.
|
||||||
@ -31,7 +31,7 @@ Syncs blocks, transactions, receipts and logs from a running Ethereum node into
|
|||||||
- Useful when you want to maintain a broad cache of what's happening on the blockchain.
|
- Useful when you want to maintain a broad cache of what's happening on the blockchain.
|
||||||
|
|
||||||
#### Usage
|
#### Usage
|
||||||
- Run `./vulcanizedb sync --config <config.toml> --starting-block-number <block-number>`
|
- Run `./vulcanizedb fullSync --config <config.toml> --starting-block-number <block-number>`
|
||||||
- The config file must be formatted as follows, and should contain an ipc path to a running Ethereum node:
|
- The config file must be formatted as follows, and should contain an ipc path to a running Ethereum node:
|
||||||
```toml
|
```toml
|
||||||
[database]
|
[database]
|
||||||
|
Loading…
Reference in New Issue
Block a user