Vdb 269- fetch logs by hash (#122)

* Upgrade geth from 1.8.15 to 1.8.18

* Update vat_tune to use shared repository methods

* Query blockchain by block hash instead of block number range

* Remove hash validation from repositories

* Fix vow flog integration test

* Update README Travis build sticker

* Update constants formatting per go fmt

* Update EthPublicKeyParser.ParsePublicKey to use discv5.PubkeyID method

* Address PR comments
This commit is contained in:
Elizabeth
2018-11-21 09:30:00 -06:00
committed by GitHub
parent b19e77e419
commit 128d20c9bf
1328 changed files with 25044 additions and 210977 deletions
@@ -15,7 +15,6 @@
package shared_behaviors
import (
"github.com/ethereum/go-ethereum/common"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/core"
@@ -24,7 +23,6 @@ import (
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
"github.com/vulcanize/vulcanizedb/pkg/transformers/factories"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
"github.com/vulcanize/vulcanizedb/test_config"
"math/rand"
@@ -103,35 +101,6 @@ func SharedRepositoryCreateBehaviors(inputs *CreateBehaviorInputs) {
Expect(err.Error()).To(ContainSubstring("pq: duplicate key value violates unique constraint"))
})
Describe("when log's block hash does not match associated header's block hash", func() {
var (
differentHeaderID int64
err error
)
BeforeEach(func() {
differentHeader := fakes.FakeHeader
differentHeader.BlockNumber = fakes.FakeHeader.BlockNumber + 1
differentHeader.Hash = common.BytesToHash(append(fakes.FakeHash.Bytes(), 1)).String()
differentHeaderID, err = headerRepository.CreateOrUpdateHeader(differentHeader)
Expect(err).NotTo(HaveOccurred())
err = repository.Create(differentHeaderID, []interface{}{logEventModel})
})
It("returns error", func() {
Expect(err).To(HaveOccurred())
Expect(err).To(MatchError(shared.ErrHeaderMismatch))
})
It("removes header", func() {
var headerIDs []int64
err = db.Select(&headerIDs, `SELECT id FROM public.headers`)
Expect(err).NotTo(HaveOccurred())
Expect(headerIDs).NotTo(ContainElement(differentHeaderID))
})
})
It("allows for multiple log events of the same type in one transaction if they have different log indexes", func() {
err = repository.Create(headerID, []interface{}{logEventModel})
Expect(err).NotTo(HaveOccurred())