Compare commits

...
7 Commits
Author SHA1 Message Date
Abdul Rabbani afe207445a Merge pull request #27 from vulcanize/feature/update-go-geth-sharding
Feature/update go geth sharding
2022-05-31 13:23:55 -04:00
Abdul Rabbani f029bb323f Update dependencies 2022-05-31 13:23:08 -04:00
Abdul Rabbani 169229b86c Merge branch 'master' into feature/update-go-geth-sharding 2022-05-31 13:19:27 -04:00
Ashwin Phatak c8813448e9 Merge pull request #22 from deep-stack/pm-v4-schema-updates
Update to use v4 schema
2022-05-12 16:42:01 +05:30
prathamesh bce89d43da Update module path for v4 2022-05-11 19:09:31 +05:30
prathamesh 54f5f4cd9c Upgrade dependencies 2022-05-11 19:05:10 +05:30
prathamesh a42ad0441b Update tests to use v4 schema 2022-05-11 18:58:22 +05:30
7 changed files with 15 additions and 14 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
validator "github.com/vulcanize/eth-ipfs-state-validator/v3/pkg"
validator "github.com/vulcanize/eth-ipfs-state-validator/v4/pkg"
)
// validateTrieCmd represents the validateTrie command
+2 -2
View File
@@ -1,4 +1,4 @@
module github.com/vulcanize/eth-ipfs-state-validator/v3
module github.com/vulcanize/eth-ipfs-state-validator/v4
go 1.18
@@ -18,7 +18,7 @@ require (
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.4.0
github.com/spf13/viper v1.11.0
github.com/vulcanize/ipfs-ethdb/v3 v3.0.3
github.com/vulcanize/ipfs-ethdb/v4 v4.0.1-alpha
)
require (
+2 -2
View File
@@ -1542,8 +1542,8 @@ github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
github.com/vulcanize/ipfs-ethdb/v3 v3.0.3 h1:KyNMtSKZk2ZuU+mwAv/SdNEeigFkCxvsTDqxHDpwUL8=
github.com/vulcanize/ipfs-ethdb/v3 v3.0.3/go.mod h1:hi3c5YadpoJc0A6Du9OzEAhGxtk0S1pTSAY/rApvuA0=
github.com/vulcanize/ipfs-ethdb/v4 v4.0.1-alpha h1:VxZONVJMxAC6vLhmlQsC3zhmY0D2A3DUoGAn8az6pXY=
github.com/vulcanize/ipfs-ethdb/v4 v4.0.1-alpha/go.mod h1:K2ayGLsvsHcm+4A9oD3mwMLElNjw7yn70h+KXo6JdrU=
github.com/wangjia184/sortedset v0.0.0-20160527075905-f5d03557ba30/go.mod h1:YkocrP2K2tcw938x9gCOmT5G5eCD6jsTz0SZuyAqwIE=
github.com/warpfork/go-testmark v0.3.0 h1:Q81c4u7hT+BR5kNfNQhEF0VT2pmL7+Kk0wD+ORYl7iA=
github.com/warpfork/go-testmark v0.3.0/go.mod h1:jhEf8FVxd+F17juRubpmut64NEG6I2rgkUhlcqqXwE0=
+1 -1
View File
@@ -18,7 +18,7 @@ package main
import (
"github.com/sirupsen/logrus"
"github.com/vulcanize/eth-ipfs-state-validator/v3/cmd"
"github.com/vulcanize/eth-ipfs-state-validator/v4/cmd"
)
func main() {
+2 -2
View File
@@ -29,14 +29,14 @@ import (
)
// PublishRaw derives a cid from raw bytes and provided codec and multihash type, and writes it to the db tx
func PublishRaw(tx *sqlx.Tx, codec, mh uint64, raw []byte) (string, error) {
func PublishRaw(tx *sqlx.Tx, codec, mh uint64, raw []byte, blockNumber uint64) (string, error) {
c, err := RawdataToCid(codec, raw, mh)
if err != nil {
return "", err
}
dbKey := dshelp.MultihashToDsKey(c.Hash())
prefixedKey := blockstore.BlockPrefix.String() + dbKey.String()
_, err = tx.Exec(`INSERT INTO public.blocks (key, data) VALUES ($1, $2) ON CONFLICT (key) DO NOTHING`, prefixedKey, raw)
_, err = tx.Exec(`INSERT INTO public.blocks (key, data, block_number) VALUES ($1, $2, $3) ON CONFLICT DO NOTHING`, prefixedKey, raw, blockNumber)
return c.String(), err
}
+2 -2
View File
@@ -28,8 +28,8 @@ import (
"github.com/jmoiron/sqlx"
"github.com/mailgun/groupcache/v2"
ipfsethdb "github.com/vulcanize/ipfs-ethdb/v3"
pgipfsethdb "github.com/vulcanize/ipfs-ethdb/v3/postgres"
ipfsethdb "github.com/vulcanize/ipfs-ethdb/v4"
pgipfsethdb "github.com/vulcanize/ipfs-ethdb/v4/postgres"
)
// Validator is used for validating Ethereum state and storage tries on PG-IPFS
+5 -4
View File
@@ -30,11 +30,12 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
validator "github.com/vulcanize/eth-ipfs-state-validator/v3/pkg"
pgipfsethdb "github.com/vulcanize/ipfs-ethdb/v3/postgres"
validator "github.com/vulcanize/eth-ipfs-state-validator/v4/pkg"
pgipfsethdb "github.com/vulcanize/ipfs-ethdb/v4/postgres"
)
var (
blockNumber = uint64(1)
contractAddr = common.HexToAddress("0xaE9BEa628c4Ce503DcFD7E305CaB4e29E7476592")
slot0StorageValue = common.Hex2Bytes("94703c4b2bd70c169f5717101caee543299fc946c7")
slot1StorageValue = common.Hex2Bytes("01")
@@ -302,11 +303,11 @@ func loadTrie(stateNodes, storageNodes [][]byte) {
tx, err := db.Beginx()
Expect(err).ToNot(HaveOccurred())
for _, node := range stateNodes {
_, err := validator.PublishRaw(tx, cid.EthStateTrie, multihash.KECCAK_256, node)
_, err := validator.PublishRaw(tx, cid.EthStateTrie, multihash.KECCAK_256, node, blockNumber)
Expect(err).ToNot(HaveOccurred())
}
for _, node := range storageNodes {
_, err := validator.PublishRaw(tx, cid.EthStorageTrie, multihash.KECCAK_256, node)
_, err := validator.PublishRaw(tx, cid.EthStorageTrie, multihash.KECCAK_256, node, blockNumber)
Expect(err).ToNot(HaveOccurred())
}
err = tx.Commit()