From d3e172d9ab685585fbbe8e5599fc682a3ffcae88 Mon Sep 17 00:00:00 2001 From: Ian Norden Date: Thu, 14 Mar 2019 15:07:39 -0500 Subject: [PATCH] remove references to infura token except for in infura.toml so that tests will continue to pass on CI --- README.md | 16 +++++++++++++--- cmd/contractWatcher.go | 2 +- environments/example.toml | 4 ++-- environments/infura.toml | 8 ++++---- environments/private.toml | 8 ++++---- environments/public.toml.example | 10 +++++----- .../shared/getter/getter_test.go | 5 +++-- .../shared/helpers/test_helpers/database.go | 18 +++--------------- 8 files changed, 35 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index e9787b6c..381db3e1 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ This command takes a config of the form: port = 5432 [client] - ipcPath = "https://mainnet.infura.io/J5Vd2fRtGsw0zZ0Ov3BL" + ipcPath = "path_to_ethjson_rpc" [contract] network = "" @@ -248,9 +248,19 @@ The 'method' and 'event' identifiers are tacked onto the end of the table names Example: -Running `./vulcanizedb contractWatcher --config=./environments/example.toml --mode=light` +Modify `./environments/example.toml` to replace `"path_to_ethjson_rpc"` with a path that points to an ethjson_rpc endpoint (e.g. a local geth node ipc path or an Infura url). +This endpoint should be for an archival eth node if we want to perform method polling as this configuration is currently set up to do. To work with a non-archival full node, +remove the `balanceOf` method from the `0x8dd5fbce2f6a956c3022ba3663759011dd51e73e` (TrueUSD) contract. -Runs our contract watcher in light mode, configured to watch the contracts specified in the config file. Note that +If you are operating a light sync vDB, run: + + `./vulcanizedb contractWatcher --config=./environments/example.toml --mode=light` + +If instead you are operating a full sync vDB and provided an archival node IPC path, run in full mode: + + `./vulcanizedb contractWatcher --config=./environments/example.toml --mode=full` + +This will run the contractWatcher and configures it to watch the contracts specified in the config file. Note that by default we operate in `light` mode but the flag is included here to demonstrate its use. The example config we link to in this example watches two contracts, the ENS Registry (0x314159265dD8dbb310642f98f50C066173C1259b) and TrueUSD (0x8dd5fbCe2F6a956C3022bA3663759011Dd51e73E). diff --git a/cmd/contractWatcher.go b/cmd/contractWatcher.go index 9305249f..cfdfd7d9 100644 --- a/cmd/contractWatcher.go +++ b/cmd/contractWatcher.go @@ -46,7 +46,7 @@ Requires a .toml config file: port = 5432 [client] - ipcPath = "https://mainnet.infura.io/J5Vd2fRtGsw0zZ0Ov3BL" + ipcPath = "path_to_ethjson_rpc" [contract] network = "" diff --git a/environments/example.toml b/environments/example.toml index 66522f05..9d253390 100644 --- a/environments/example.toml +++ b/environments/example.toml @@ -1,10 +1,10 @@ [database] - name = "vulcanize_infura" + name = "vulcanize_public" hostname = "localhost" port = 5432 [client] - ipcPath = "https://mainnet.infura.io/J5Vd2fRtGsw0zZ0Ov3BL" + ipcPath = "path_to_ethjson_rpc" [contract] network = "" diff --git a/environments/infura.toml b/environments/infura.toml index 095e747d..d9afd385 100644 --- a/environments/infura.toml +++ b/environments/infura.toml @@ -1,7 +1,7 @@ [database] -name = "vulcanize_public" -hostname = "localhost" -port = 5432 + name = "vulcanize_public" + hostname = "localhost" + port = 5432 [client] -ipcPath = "https://mainnet.infura.io/J5Vd2fRtGsw0zZ0Ov3BL" \ No newline at end of file + ipcPath = "https://mainnet.infura.io/J5Vd2fRtGsw0zZ0Ov3BL" \ No newline at end of file diff --git a/environments/private.toml b/environments/private.toml index 30382733..83f80f7b 100644 --- a/environments/private.toml +++ b/environments/private.toml @@ -1,7 +1,7 @@ [database] -name = "vulcanize_private" -hostname = "localhost" -port = 5432 + name = "vulcanize_private" + hostname = "localhost" + port = 5432 [client] -ipcPath = "http://127.0.0.1:7545" \ No newline at end of file + ipcPath = "http://127.0.0.1:7545" diff --git a/environments/public.toml.example b/environments/public.toml.example index 1e748bfb..52f8a2d1 100644 --- a/environments/public.toml.example +++ b/environments/public.toml.example @@ -1,8 +1,8 @@ [database] -name = "vulcanize_public" -hostname = "localhost" -port = 5432 + name = "vulcanize_public" + hostname = "localhost" + port = 5432 [client] -ipcPath = -levelDbPath = \ No newline at end of file + ipcPath = + levelDbPath = diff --git a/pkg/contract_watcher/shared/getter/getter_test.go b/pkg/contract_watcher/shared/getter/getter_test.go index c84560ce..0f5d7cb6 100644 --- a/pkg/contract_watcher/shared/getter/getter_test.go +++ b/pkg/contract_watcher/shared/getter/getter_test.go @@ -28,15 +28,16 @@ import ( "github.com/vulcanize/vulcanizedb/pkg/geth/client" rpc2 "github.com/vulcanize/vulcanizedb/pkg/geth/converters/rpc" "github.com/vulcanize/vulcanizedb/pkg/geth/node" + "github.com/vulcanize/vulcanizedb/test_config" ) var _ = Describe("Interface Getter", func() { Describe("GetAbi", func() { It("Constructs and returns a custom abi based on results from supportsInterface calls", func() { expectedABI := `[` + constants.AddrChangeInterface + `,` + constants.NameChangeInterface + `,` + constants.ContentChangeInterface + `,` + constants.AbiChangeInterface + `,` + constants.PubkeyChangeInterface + `]` - + con := test_config.InfuraClient + infuraIPC := con.IPCPath blockNumber := int64(6885696) - infuraIPC := "https://mainnet.infura.io/v3/b09888c1113640cc9ab42750ce750c05" rawRpcClient, err := rpc.Dial(infuraIPC) Expect(err).NotTo(HaveOccurred()) rpcClient := client.NewRpcClient(rawRpcClient, infuraIPC) diff --git a/pkg/contract_watcher/shared/helpers/test_helpers/database.go b/pkg/contract_watcher/shared/helpers/test_helpers/database.go index 69ed26a3..7c297bef 100644 --- a/pkg/contract_watcher/shared/helpers/test_helpers/database.go +++ b/pkg/contract_watcher/shared/helpers/test_helpers/database.go @@ -34,6 +34,7 @@ import ( "github.com/vulcanize/vulcanizedb/pkg/geth/client" rpc2 "github.com/vulcanize/vulcanizedb/pkg/geth/converters/rpc" "github.com/vulcanize/vulcanizedb/pkg/geth/node" + "github.com/vulcanize/vulcanizedb/test_config" ) type TransferLog struct { @@ -106,22 +107,9 @@ type Owner struct { Address string `db:"returned"` } -func SetupBC() core.BlockChain { - infuraIPC := "https://mainnet.infura.io/v3/b09888c1113640cc9ab42750ce750c05" - rawRpcClient, err := rpc.Dial(infuraIPC) - Expect(err).NotTo(HaveOccurred()) - rpcClient := client.NewRpcClient(rawRpcClient, infuraIPC) - ethClient := ethclient.NewClient(rawRpcClient) - blockChainClient := client.NewEthClient(ethClient) - node := node.MakeNode(rpcClient) - transactionConverter := rpc2.NewRpcTransactionConverter(ethClient) - blockChain := geth.NewBlockChain(blockChainClient, rpcClient, node, transactionConverter) - - return blockChain -} - func SetupDBandBC() (*postgres.DB, core.BlockChain) { - infuraIPC := "https://mainnet.infura.io/v3/b09888c1113640cc9ab42750ce750c05" + con := test_config.InfuraClient + infuraIPC := con.IPCPath rawRpcClient, err := rpc.Dial(infuraIPC) Expect(err).NotTo(HaveOccurred()) rpcClient := client.NewRpcClient(rawRpcClient, infuraIPC)