goimports -w

This commit is contained in:
Ian Norden 2019-05-16 23:15:54 -05:00
parent 671a324294
commit 5ebe2243d8
42 changed files with 257 additions and 40 deletions

View File

@ -20,6 +20,8 @@ import (
"fmt"
"time"
"github.com/vulcanize/vulcanizedb/pkg/config"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"

View File

@ -22,6 +22,8 @@ import (
"strings"
"time"
"github.com/vulcanize/vulcanizedb/pkg/config"
"github.com/ethereum/go-ethereum/common"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

View File

@ -0,0 +1,69 @@
package integration
/* WIP
import (
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/ethclient"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/contract_watcher/shared/helpers/test_helpers"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
"github.com/vulcanize/vulcanizedb/pkg/ipfs"
"github.com/vulcanize/vulcanizedb/test_config"
"github.com/vulcanize/vulcanizedb/pkg/config"
"github.com/vulcanize/vulcanizedb/pkg/geth"
"github.com/vulcanize/vulcanizedb/pkg/geth/client"
rpc2 "github.com/vulcanize/vulcanizedb/pkg/geth/converters/rpc"
"github.com/vulcanize/vulcanizedb/pkg/geth/node"
)
var _ = Describe("IPFS Processor", func() {
var processor ipfs.SyncAndPublish
var err error
var db *postgres.DB
var bc core.BlockChain
var ec core.EthClient
var rc core.RpcClient
var quitChan chan bool
AfterEach(func() {
test_helpers.TearDown(db)
})
BeforeEach(func() {
db, bc, ec, rc = setup()
quitChan = make(chan bool)
processor, err = ipfs.NewIPFSProcessor("~/.ipfs", db, ec, rc, quitChan)
})
Describe("Process", func() {
It("Polls specified contract methods using contract's argument list", func() {
})
})
})
func setup() (*postgres.DB, core.BlockChain, core.EthClient, core.RpcClient) {
con := test_config.InfuraClient
infuraIPC := con.IPCPath
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)
db, err := postgres.NewDB(config.Database{
Hostname: "localhost",
Name: "vulcanize_private",
Port: 5432,
}, blockChain.Node())
Expect(err).NotTo(HaveOccurred())
return db, blockChain, ethClient, rpcClient
}
*/

View File

@ -125,4 +125,4 @@ func (watcher *EventWatcher) delegateLogs(errs chan error) {
} else {
watcher.delegateLogs(errs)
}
}
}

View File

@ -17,10 +17,11 @@
package config
import (
"strings"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/vulcanize/vulcanizedb/pkg/eth"
"strings"
)
// Config struct for generic contract transformer

View File

@ -17,11 +17,12 @@
package config_test
import (
"os"
"path/filepath"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/config"
"os"
"path/filepath"
)
var allDifferentPathsConfig = config.Plugin{

View File

@ -20,6 +20,8 @@ import (
"io/ioutil"
"testing"
"github.com/sirupsen/logrus"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sirupsen/logrus"

View File

@ -20,6 +20,8 @@ import (
"io/ioutil"
"testing"
"github.com/sirupsen/logrus"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sirupsen/logrus"

View File

@ -20,6 +20,8 @@ import (
"io/ioutil"
"testing"
"github.com/sirupsen/logrus"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sirupsen/logrus"

View File

@ -20,6 +20,8 @@ import (
"io/ioutil"
"testing"
"github.com/sirupsen/logrus"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sirupsen/logrus"

View File

@ -20,6 +20,8 @@ import (
"io/ioutil"
"testing"
"github.com/sirupsen/logrus"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sirupsen/logrus"

View File

@ -20,6 +20,8 @@ import (
"io/ioutil"
"testing"
"github.com/sirupsen/logrus"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sirupsen/logrus"

View File

@ -20,6 +20,8 @@ import (
"fmt"
"strings"
"github.com/vulcanize/vulcanizedb/pkg/contract_watcher/shared/types"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"

View File

@ -20,6 +20,8 @@ import (
"io/ioutil"
"testing"
"github.com/sirupsen/logrus"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sirupsen/logrus"

View File

@ -17,9 +17,10 @@
package core
import (
"github.com/ethereum/go-ethereum/common"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/core/types"
)

View File

@ -18,6 +18,7 @@ package ethereum
import (
"fmt"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/sirupsen/logrus"

View File

@ -19,9 +19,10 @@ package postgres_test
import (
"testing"
log "github.com/sirupsen/logrus"
"io/ioutil"
log "github.com/sirupsen/logrus"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

View File

@ -18,11 +18,12 @@ package repositories_test
import (
"bytes"
"math/big"
"strconv"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
"math/big"
"strconv"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

View File

@ -17,9 +17,10 @@
package repositories_test
import (
"github.com/vulcanize/vulcanizedb/pkg/fakes"
"sort"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/core"

View File

@ -18,6 +18,7 @@ package repositories
import (
"database/sql"
"github.com/jmoiron/sqlx"
"github.com/sirupsen/logrus"
"github.com/vulcanize/vulcanizedb/libraries/shared/repository"

View File

@ -17,10 +17,11 @@
package repositories_test
import (
"github.com/sirupsen/logrus"
"io/ioutil"
"testing"
"github.com/sirupsen/logrus"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

View File

@ -18,11 +18,12 @@ package client
import (
"context"
"math/big"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"math/big"
)
type EthClient struct {

View File

@ -18,11 +18,12 @@ package cold_import
import (
"errors"
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/crypto"
"github.com/vulcanize/vulcanizedb/pkg/fs"
"strings"
)
const (

View File

@ -18,6 +18,7 @@ package cold_import_test
import (
"errors"
"github.com/ethereum/go-ethereum/common"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

View File

@ -17,11 +17,12 @@
package cold_db
import (
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/core"
"golang.org/x/sync/errgroup"
"strings"
)
type ColdDbTransactionConverter struct{}

View File

@ -18,6 +18,7 @@ package common_test
import (
"bytes"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"

View File

@ -20,11 +20,12 @@ import (
"bytes"
"context"
"fmt"
"github.com/ethereum/go-ethereum/common/hexutil"
"log"
"math/big"
"strings"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp"

View File

@ -22,6 +22,8 @@ import (
"strconv"
"strings"
"strings"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/p2p"
log "github.com/sirupsen/logrus"

View File

@ -17,9 +17,10 @@
package fakes
import (
"github.com/ethereum/go-ethereum/common"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/core/types"
. "github.com/onsi/gomega"

View File

@ -20,9 +20,10 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
log "github.com/sirupsen/logrus"
"io/ioutil"
"testing"
log "github.com/sirupsen/logrus"
)
func init() {

View File

@ -17,11 +17,12 @@
package history_test
import (
"math/big"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
"github.com/vulcanize/vulcanizedb/pkg/history"
"math/big"
)
var _ = Describe("Populating blocks", func() {

View File

@ -18,6 +18,7 @@ package history
import (
"fmt"
log "github.com/sirupsen/logrus"
"github.com/vulcanize/vulcanizedb/pkg/core"
)

View File

@ -20,9 +20,10 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"math/big"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
"github.com/vulcanize/vulcanizedb/pkg/history"
"math/big"
)
var _ = Describe("Validation window", func() {

View File

@ -98,7 +98,6 @@ func (i *Processor) Process(wg *sync.WaitGroup) error {
case err = <-sub.Err():
log.Error(err)
case <-i.QuitChan:
println("quiting")
log.Info("quiting IPFSProcessor")
wg.Done()
return

17
pkg/ipfs/retreiver.go Normal file
View File

@ -0,0 +1,17 @@
// VulcanizeDB
// Copyright © 2019 Vulcanize
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package ipfs

View File

@ -18,6 +18,7 @@ package plugin
import (
"errors"
"github.com/vulcanize/vulcanizedb/pkg/config"
"github.com/vulcanize/vulcanizedb/pkg/plugin/builder"
"github.com/vulcanize/vulcanizedb/pkg/plugin/manager"

View File

@ -19,13 +19,15 @@ package manager
import (
"database/sql"
"fmt"
"github.com/lib/pq"
"github.com/pressly/goose"
"github.com/vulcanize/vulcanizedb/pkg/config"
"github.com/vulcanize/vulcanizedb/pkg/plugin/helpers"
"io/ioutil"
"os"
"path/filepath"
"github.com/lib/pq"
"github.com/pressly/goose"
"github.com/vulcanize/vulcanizedb/pkg/config"
"github.com/vulcanize/vulcanizedb/pkg/plugin/helpers"
)
// Interface for managing the db migrations for plugin transformers

View File

@ -14,18 +14,18 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package mocks
package rpc
import "github.com/vulcanize/vulcanizedb/pkg/ipfs"
// CIDRepository is the underlying struct for the Repository interface
type CIDRepository struct {
PassedCIDPayload *ipfs.CIDPayload
ReturnErr error
type Client interface {
}
// Index indexes a cidPayload in Postgres
func (repo *CIDRepository) Index(cidPayload *ipfs.CIDPayload) error {
repo.PassedCIDPayload = cidPayload
return repo.ReturnErr
type RpcClient struct {
}
func NewRpcClient() *RpcClient {
return &RpcClient{}
}
func (rpcc *RpcClient) Dial() error {
return nil
}

31
pkg/rpc/server.go Normal file
View File

@ -0,0 +1,31 @@
// VulcanizeDB
// Copyright © 2019 Vulcanize
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package rpc
type Server interface {
}
type RpcServer struct {
}
func NewRpcServer() *RpcServer {
return &RpcServer{}
}
func (rpcs *RpcServer) Serve() error {
return nil
}

59
pkg/rpc/subscription.go Normal file
View File

@ -0,0 +1,59 @@
// VulcanizeDB
// Copyright © 2019 Vulcanize
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package rpc
// Subscription
type Subscription struct {
}
// Params are set by the client to tell the server how to filter that is fed into their subscription
type Params struct {
HeaderFilter struct {
Off bool
StartingBlock int64
EndingBlock int64 // set to 0 or a negative value to have no ending block
Uncles bool
}
TrxFilter struct {
Off bool
StartingBlock int64
EndingBlock int64
Src string
Dst string
}
ReceiptFilter struct {
Off bool
StartingBlock int64
EndingBlock int64
Topic0s []string
}
StateFilter struct {
Off bool
StartingBlock int64
EndingBlock int64
Address string // is converted to state key by taking its keccak256 hash
LeafsOnly bool
}
StorageFilter struct {
Off bool
StartingBlock int64
EndingBlock int64
Address string
StorageKey string
LeafsOnly bool
}
}

View File

@ -17,12 +17,13 @@
package utils
import (
"github.com/jmoiron/sqlx"
"github.com/sirupsen/logrus"
"math/big"
"os"
"path/filepath"
"github.com/jmoiron/sqlx"
"github.com/sirupsen/logrus"
"github.com/vulcanize/vulcanizedb/pkg/config"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"

View File

@ -18,7 +18,6 @@ package statediff
import (
"context"
"sync"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
@ -35,15 +34,12 @@ const APIVersion = "0.0.1"
// are produced by a full node
type PublicStateDiffAPI struct {
sds IService
mu sync.Mutex
}
// NewPublicStateDiffAPI create a new state diff websocket streaming service.
func NewPublicStateDiffAPI(sds IService) *PublicStateDiffAPI {
return &PublicStateDiffAPI{
sds: sds,
mu: sync.Mutex{},
}
}