From f83ab82424bafaa12cf2e0c3a9b7bc14c81aa75a Mon Sep 17 00:00:00 2001 From: i-norden Date: Tue, 11 Apr 2023 10:03:27 -0500 Subject: [PATCH 01/18] use types/models exported from vdb geth --- pkg/types/node_type.go | 18 +++------- pkg/types/publisher.go | 8 +++-- pkg/types/schema.go | 76 ---------------------------------------- pkg/types/table.go | 79 ------------------------------------------ 4 files changed, 10 insertions(+), 171 deletions(-) delete mode 100644 pkg/types/schema.go delete mode 100644 pkg/types/table.go diff --git a/pkg/types/node_type.go b/pkg/types/node_type.go index ce63835..d72fcf6 100644 --- a/pkg/types/node_type.go +++ b/pkg/types/node_type.go @@ -17,23 +17,13 @@ package types import ( "fmt" - - "github.com/ethereum/go-ethereum/common" ) -// node for holding trie node information -type Node struct { - NodeType nodeType - Path []byte - Key common.Hash - Value []byte -} - -// nodeType for explicitly setting type of node -type nodeType int +// NodeType for explicitly setting type of node +type NodeType int const ( - Branch nodeType = iota + Branch NodeType = iota Extension Leaf Removed @@ -41,7 +31,7 @@ const ( ) // CheckKeyType checks what type of key we have -func CheckKeyType(elements []interface{}) (nodeType, error) { +func CheckKeyType(elements []interface{}) (NodeType, error) { if len(elements) > 2 { return Branch, nil } diff --git a/pkg/types/publisher.go b/pkg/types/publisher.go index d7e26f2..f34fc32 100644 --- a/pkg/types/publisher.go +++ b/pkg/types/publisher.go @@ -3,15 +3,19 @@ package types import ( "math/big" + "github.com/ethereum/go-ethereum/statediff/indexer/models" + "github.com/ipfs/go-cid" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) type Publisher interface { PublishHeader(header *types.Header) error - PublishStateNode(node *Node, headerID string, height *big.Int, tx Tx) error - PublishStorageNode(node *Node, headerID string, height *big.Int, statePath []byte, tx Tx) error + PublishStateLeafNode(node *models.StateNodeModel, tx Tx) error + PublishStorageLeafNode(node *models.StorageNodeModel, tx Tx) error PublishCode(height *big.Int, codeHash common.Hash, codeBytes []byte, tx Tx) error + PublishIPLD(c cid.Cid, raw []byte, height *big.Int, tx Tx) (string, error) BeginTx() (Tx, error) PrepareTxForBatch(tx Tx, batchSize uint) (Tx, error) } diff --git a/pkg/types/schema.go b/pkg/types/schema.go deleted file mode 100644 index c3307c6..0000000 --- a/pkg/types/schema.go +++ /dev/null @@ -1,76 +0,0 @@ -package types - -var TableIPLDBlock = Table{ - `public.blocks`, - []column{ - {"block_number", bigint}, - {"key", text}, - {"data", bytea}, - }, - "ON CONFLICT (key, block_number) DO NOTHING", -} - -var TableNodeInfo = Table{ - Name: `public.nodes`, - Columns: []column{ - {"genesis_block", varchar}, - {"network_id", varchar}, - {"node_id", varchar}, - {"client_name", varchar}, - {"chain_id", integer}, - }, -} - -var TableHeader = Table{ - "eth.header_cids", - []column{ - {"block_number", bigint}, - {"block_hash", varchar}, - {"parent_hash", varchar}, - {"cid", text}, - {"td", numeric}, - {"node_id", varchar}, - {"reward", numeric}, - {"state_root", varchar}, - {"tx_root", varchar}, - {"receipt_root", varchar}, - {"uncles_hash", varchar}, - {"bloom", bytea}, - {"timestamp", numeric}, - {"mh_key", text}, - {"times_validated", integer}, - {"coinbase", varchar}, - }, - "ON CONFLICT (block_hash, block_number) DO UPDATE SET (parent_hash, cid, td, node_id, reward, state_root, tx_root, receipt_root, uncles_hash, bloom, timestamp, mh_key, times_validated, coinbase) = (EXCLUDED.parent_hash, EXCLUDED.cid, EXCLUDED.td, EXCLUDED.node_id, EXCLUDED.reward, EXCLUDED.state_root, EXCLUDED.tx_root, EXCLUDED.receipt_root, EXCLUDED.uncles_hash, EXCLUDED.bloom, EXCLUDED.timestamp, EXCLUDED.mh_key, eth.header_cids.times_validated + 1, EXCLUDED.coinbase)", -} - -var TableStateNode = Table{ - "eth.state_cids", - []column{ - {"block_number", bigint}, - {"header_id", varchar}, - {"state_leaf_key", varchar}, - {"cid", text}, - {"state_path", bytea}, - {"node_type", integer}, - {"diff", boolean}, - {"mh_key", text}, - }, - "ON CONFLICT (header_id, state_path, block_number) DO UPDATE SET (state_leaf_key, cid, node_type, diff, mh_key) = (EXCLUDED.state_leaf_key, EXCLUDED.cid, EXCLUDED.node_type, EXCLUDED.diff, EXCLUDED.mh_key)", -} - -var TableStorageNode = Table{ - "eth.storage_cids", - []column{ - {"block_number", bigint}, - {"header_id", varchar}, - {"state_path", bytea}, - {"storage_leaf_key", varchar}, - {"cid", text}, - {"storage_path", bytea}, - {"node_type", integer}, - {"diff", boolean}, - {"mh_key", text}, - }, - "ON CONFLICT (header_id, state_path, storage_path, block_number) DO UPDATE SET (storage_leaf_key, cid, node_type, diff, mh_key) = (EXCLUDED.storage_leaf_key, EXCLUDED.cid, EXCLUDED.node_type, EXCLUDED.diff, EXCLUDED.mh_key)", -} diff --git a/pkg/types/table.go b/pkg/types/table.go deleted file mode 100644 index 2a1f1e4..0000000 --- a/pkg/types/table.go +++ /dev/null @@ -1,79 +0,0 @@ -package types - -import ( - "fmt" - "strings" -) - -type colType int - -const ( - integer colType = iota - boolean - bigint - numeric - bytea - varchar - text -) - -type column struct { - name string - typ colType -} -type Table struct { - Name string - Columns []column - ConflictClause string -} - -func (tbl *Table) ToCsvRow(args ...interface{}) []string { - var row []string - for i, col := range tbl.Columns { - row = append(row, col.typ.formatter()(args[i])) - } - return row -} - -func (tbl *Table) ToInsertStatement() string { - var colnames, placeholders []string - for i, col := range tbl.Columns { - colnames = append(colnames, col.name) - placeholders = append(placeholders, fmt.Sprintf("$%d", i+1)) - } - return fmt.Sprintf( - "INSERT INTO %s (%s) VALUES (%s) %s", - tbl.Name, strings.Join(colnames, ", "), strings.Join(placeholders, ", "), tbl.ConflictClause, - ) -} - -type colfmt = func(interface{}) string - -func sprintf(f string) colfmt { - return func(x interface{}) string { return fmt.Sprintf(f, x) } -} - -func (typ colType) formatter() colfmt { - switch typ { - case integer: - return sprintf("%d") - case boolean: - return func(x interface{}) string { - if x.(bool) { - return "t" - } - return "f" - } - case bigint: - return sprintf("%s") - case numeric: - return sprintf("%d") - case bytea: - return sprintf(`\x%x`) - case varchar: - return sprintf("%s") - case text: - return sprintf("%s") - } - panic("unreachable") -} From f1a980f37cb11d960b24bc6d4f01fa2eba866512 Mon Sep 17 00:00:00 2001 From: i-norden Date: Tue, 11 Apr 2023 10:03:37 -0500 Subject: [PATCH 02/18] update direct pg publisher --- pkg/snapshot/pg/publisher.go | 98 +++++++++++++++++------------------- 1 file changed, 47 insertions(+), 51 deletions(-) diff --git a/pkg/snapshot/pg/publisher.go b/pkg/snapshot/pg/publisher.go index 57ed773..df6a42e 100644 --- a/pkg/snapshot/pg/publisher.go +++ b/pkg/snapshot/pg/publisher.go @@ -17,26 +17,27 @@ package pg import ( "context" - "fmt" "math/big" "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/statediff/indexer/models" + "github.com/lib/pq" + "github.com/ipfs/go-cid" - blockstore "github.com/ipfs/go-ipfs-blockstore" - dshelp "github.com/ipfs/go-ipfs-ds-help" "github.com/multiformats/go-multihash" "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" - "github.com/cerc-io/ipld-eth-state-snapshot/pkg/prom" - snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/statediff/indexer/database/sql" "github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres" "github.com/ethereum/go-ethereum/statediff/indexer/ipld" - "github.com/ethereum/go-ethereum/statediff/indexer/shared" + "github.com/ethereum/go-ethereum/statediff/indexer/shared/schema" + + "github.com/cerc-io/ipld-eth-state-snapshot/pkg/prom" + snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" ) var _ snapt.Publisher = (*publisher)(nil) @@ -101,10 +102,14 @@ func (tx pubTx) publishRaw(codec uint64, raw []byte, height *big.Int) (cid, pref } func (tx pubTx) publishIPLD(c cid.Cid, raw []byte, height *big.Int) (string, error) { - dbKey := dshelp.MultihashToDsKey(c.Hash()) - prefixedKey := blockstore.BlockPrefix.String() + dbKey.String() - _, err := tx.Exec(snapt.TableIPLDBlock.ToInsertStatement(), height.Uint64(), prefixedKey, raw) - return prefixedKey, err + _, err := tx.Exec(schema.TableIPLDBlock.ToInsertStatement(false), height.Uint64(), c.String(), raw) + return c.String(), err +} + +// PublishIPLD writes an IPLD to the ipld.blocks blockstore +func (p *publisher) PublishIPLD(c cid.Cid, raw []byte, height *big.Int, snapTx snapt.Tx) (string, error) { + tx := snapTx.(pubTx) + return tx.publishIPLD(c, raw, height) } // PublishHeader writes the header to the ipfs backing pg datastore and adds secondary indexes in the header_cids table @@ -130,29 +135,27 @@ func (p *publisher) PublishHeader(header *types.Header) (err error) { return err } - mhKey := shared.MultihashKeyFromCID(headerNode.Cid()) - _, err = tx.Exec(snapt.TableHeader.ToInsertStatement(), header.Number.Uint64(), header.Hash().Hex(), - header.ParentHash.Hex(), headerNode.Cid().String(), "0", p.db.NodeID(), "0", + _, err = tx.Exec(schema.TableHeader.ToInsertStatement(false), header.Number.Uint64(), header.Hash().Hex(), + header.ParentHash.Hex(), headerNode.Cid().String(), "0", pq.StringArray([]string{p.db.NodeID()}), "0", header.Root.Hex(), header.TxHash.Hex(), header.ReceiptHash.Hex(), header.UncleHash.Hex(), - header.Bloom.Bytes(), header.Time, mhKey, 0, header.Coinbase.String()) + header.Bloom.Bytes(), header.Time, header.Coinbase.String()) return err } -// PublishStateNode writes the state node to the ipfs backing datastore and adds secondary indexes in the state_cids table -func (p *publisher) PublishStateNode(node *snapt.Node, headerID string, height *big.Int, snapTx snapt.Tx) error { - var stateKey string - if !snapt.IsNullHash(node.Key) { - stateKey = node.Key.Hex() - } - +// PublishStateLeafNode writes the state leaf node to eth.state_cids +func (p *publisher) PublishStateLeafNode(stateNode *models.StateNodeModel, snapTx snapt.Tx) error { tx := snapTx.(pubTx) - stateCIDStr, mhKey, err := tx.publishRaw(ipld.MEthStateTrie, node.Value, height) - if err != nil { - return err - } - - _, err = tx.Exec(snapt.TableStateNode.ToInsertStatement(), - height.Uint64(), headerID, stateKey, stateCIDStr, node.Path, node.NodeType, false, mhKey) + _, err := tx.Exec(schema.TableStateNode.ToInsertStatement(false), + stateNode.BlockNumber, + stateNode.HeaderID, + stateNode.StateKey, + stateNode.CID, + true, + stateNode.Balance, + stateNode.Nonce, + stateNode.CodeHash, + stateNode.StorageRoot, + stateNode.Removed) if err != nil { return err } @@ -165,21 +168,18 @@ func (p *publisher) PublishStateNode(node *snapt.Node, headerID string, height * return err } -// PublishStorageNode writes the storage node to the ipfs backing pg datastore and adds secondary indexes in the storage_cids table -func (p *publisher) PublishStorageNode(node *snapt.Node, headerID string, height *big.Int, statePath []byte, snapTx snapt.Tx) error { - var storageKey string - if !snapt.IsNullHash(node.Key) { - storageKey = node.Key.Hex() - } - +// PublishStorageLeafNode writes the storage leaf node to eth.storage_cids +func (p *publisher) PublishStorageLeafNode(storageNode *models.StorageNodeModel, snapTx snapt.Tx) error { tx := snapTx.(pubTx) - storageCIDStr, mhKey, err := tx.publishRaw(ipld.MEthStorageTrie, node.Value, height) - if err != nil { - return err - } - - _, err = tx.Exec(snapt.TableStorageNode.ToInsertStatement(), - height.Uint64(), headerID, statePath, storageKey, storageCIDStr, node.Path, node.NodeType, false, mhKey) + _, err := tx.Exec(schema.TableStorageNode.ToInsertStatement(false), + storageNode.BlockNumber, + storageNode.HeaderID, + storageNode.StateKey, + storageNode.StorageKey, + storageNode.CID, + true, + storageNode.Value, + storageNode.Removed) if err != nil { return err } @@ -194,15 +194,11 @@ func (p *publisher) PublishStorageNode(node *snapt.Node, headerID string, height // PublishCode writes code to the ipfs backing pg datastore func (p *publisher) PublishCode(height *big.Int, codeHash common.Hash, codeBytes []byte, snapTx snapt.Tx) error { - // no codec for code, doesn't matter though since blockstore key is multihash-derived - mhKey, err := shared.MultihashKeyFromKeccak256(codeHash) - if err != nil { - return fmt.Errorf("error deriving multihash key from codehash: %v", err) - } + c := ipld.Keccak256ToCid(ipld.RawBinary, codeHash.Bytes()) tx := snapTx.(pubTx) - if _, err = tx.Exec(snapt.TableIPLDBlock.ToInsertStatement(), height.Uint64(), mhKey, codeBytes); err != nil { - return fmt.Errorf("error publishing code IPLD: %v", err) + if _, err := tx.publishIPLD(c, codeBytes, height); err != nil { + return err } // increment code node counter. From ead007f159818b096aad062e78d7b132c1c09e70 Mon Sep 17 00:00:00 2001 From: i-norden Date: Tue, 11 Apr 2023 10:21:43 -0500 Subject: [PATCH 03/18] update csv file publisher --- pkg/snapshot/file/publisher.go | 138 +++++++++++++++++---------------- pkg/snapshot/pg/publisher.go | 36 +++++---- 2 files changed, 96 insertions(+), 78 deletions(-) diff --git a/pkg/snapshot/file/publisher.go b/pkg/snapshot/file/publisher.go index 63b9c54..943d18f 100644 --- a/pkg/snapshot/file/publisher.go +++ b/pkg/snapshot/file/publisher.go @@ -21,38 +21,41 @@ import ( "math/big" "os" "path/filepath" + "strconv" "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/lib/pq" + "github.com/ipfs/go-cid" - blockstore "github.com/ipfs/go-ipfs-blockstore" - dshelp "github.com/ipfs/go-ipfs-ds-help" "github.com/multiformats/go-multihash" "github.com/sirupsen/logrus" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/statediff/indexer/ipld" + "github.com/ethereum/go-ethereum/statediff/indexer/models" + nodeinfo "github.com/ethereum/go-ethereum/statediff/indexer/node" + "github.com/ethereum/go-ethereum/statediff/indexer/shared/schema" + "github.com/cerc-io/ipld-eth-state-snapshot/pkg/prom" snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" - "github.com/ethereum/go-ethereum/statediff/indexer/ipld" - nodeinfo "github.com/ethereum/go-ethereum/statediff/indexer/node" - "github.com/ethereum/go-ethereum/statediff/indexer/shared" ) var _ snapt.Publisher = (*publisher)(nil) var ( // tables written once per block - perBlockTables = []*snapt.Table{ - &snapt.TableIPLDBlock, - &snapt.TableNodeInfo, - &snapt.TableHeader, + perBlockTables = []*schema.Table{ + &schema.TableIPLDBlock, + &schema.TableNodeInfo, + &schema.TableHeader, } // tables written during state iteration - perNodeTables = []*snapt.Table{ - &snapt.TableIPLDBlock, - &snapt.TableStateNode, - &snapt.TableStorageNode, + perNodeTables = []*schema.Table{ + &schema.TableIPLDBlock, + &schema.TableStateNode, + &schema.TableStorageNode, } ) @@ -101,12 +104,12 @@ func newFileWriter(path string) (ret fileWriter, err error) { return } -func (tx fileWriters) write(tbl *snapt.Table, args ...interface{}) error { +func (tx fileWriters) write(tbl *schema.Table, args ...interface{}) error { row := tbl.ToCsvRow(args...) return tx[tbl.Name].Write(row) } -func makeFileWriters(dir string, tables []*snapt.Table) (fileWriters, error) { +func makeFileWriters(dir string, tables []*schema.Table) (fileWriters, error) { if err := os.MkdirAll(dir, 0755); err != nil { return nil, err } @@ -160,21 +163,24 @@ func (p *publisher) BeginTx() (snapt.Tx, error) { } // PublishRaw derives a cid from raw bytes and provided codec and multihash type, and writes it to the db tx -// returns the CID and blockstore prefixed multihash key -func (tx fileWriters) publishRaw(codec uint64, raw []byte, height *big.Int) (cid, prefixedKey string, err error) { +// returns the CID +func (tx fileWriters) publishRaw(codec uint64, raw []byte, height *big.Int) (cid string, err error) { c, err := ipld.RawdataToCid(codec, raw, multihash.KECCAK_256) if err != nil { return } cid = c.String() - prefixedKey, err = tx.publishIPLD(c, raw, height) - return + return tx.publishIPLD(c, raw, height) } func (tx fileWriters) publishIPLD(c cid.Cid, raw []byte, height *big.Int) (string, error) { - dbKey := dshelp.MultihashToDsKey(c.Hash()) - prefixedKey := blockstore.BlockPrefix.String() + dbKey.String() - return prefixedKey, tx.write(&snapt.TableIPLDBlock, height.String(), prefixedKey, raw) + return c.String(), tx.write(&schema.TableIPLDBlock, height.String(), c.String(), raw) +} + +// PublishIPLD writes an IPLD to the ipld.blocks blockstore +func (p *publisher) PublishIPLD(c cid.Cid, raw []byte, height *big.Int, snapTx snapt.Tx) (string, error) { + tx := snapTx.(fileTx) + return tx.publishIPLD(c, raw, height) } // PublishHeader writes the header to the ipfs backing pg datastore and adds secondary @@ -188,38 +194,47 @@ func (p *publisher) PublishHeader(header *types.Header) error { return err } - mhKey := shared.MultihashKeyFromCID(headerNode.Cid()) - err = p.writers.write(&snapt.TableNodeInfo, p.nodeInfo.GenesisBlock, p.nodeInfo.NetworkID, p.nodeInfo.ID, + err = p.writers.write(&schema.TableNodeInfo, p.nodeInfo.GenesisBlock, p.nodeInfo.NetworkID, p.nodeInfo.ID, p.nodeInfo.ClientName, p.nodeInfo.ChainID) if err != nil { return err } - err = p.writers.write(&snapt.TableHeader, header.Number.String(), header.Hash().Hex(), header.ParentHash.Hex(), - headerNode.Cid().String(), 0, p.nodeInfo.ID, 0, header.Root.Hex(), header.TxHash.Hex(), - header.ReceiptHash.Hex(), header.UncleHash.Hex(), header.Bloom.Bytes(), header.Time, mhKey, - 0, header.Coinbase.String()) + err = p.writers.write(&schema.TableHeader, + header.Number.String(), + header.Hash().Hex(), + header.ParentHash.Hex(), + headerNode.Cid().String(), + 0, + pq.StringArray([]string{p.nodeInfo.ID}), + 0, + header.Root.Hex(), + header.TxHash.Hex(), + header.ReceiptHash.Hex(), + header.UncleHash.Hex(), + header.Bloom.Bytes(), + strconv.FormatUint(header.Time, 10), + header.Coinbase.String()) if err != nil { return err } return p.writers.Commit() } -// PublishStateNode writes the state node to the ipfs backing datastore and adds secondary indexes -// in the state_cids table -func (p *publisher) PublishStateNode(node *snapt.Node, headerID string, height *big.Int, snapTx snapt.Tx) error { - var stateKey string - if !snapt.IsNullHash(node.Key) { - stateKey = node.Key.Hex() - } - +// PublishStateLeafNode writes the state node eth.state_cids +func (p *publisher) PublishStateLeafNode(stateNode *models.StateNodeModel, snapTx snapt.Tx) error { tx := snapTx.(fileTx) - stateCIDStr, mhKey, err := tx.publishRaw(ipld.MEthStateTrie, node.Value, height) - if err != nil { - return err - } - err = tx.write(&snapt.TableStateNode, height.String(), headerID, stateKey, stateCIDStr, node.Path, - node.NodeType, false, mhKey) + err := tx.write(&schema.TableStateNode, + stateNode.BlockNumber, + stateNode.HeaderID, + stateNode.StateKey, + stateNode.CID, + true, + stateNode.Balance, + strconv.FormatUint(stateNode.Nonce, 10), + stateNode.CodeHash, + stateNode.StorageRoot, + false) if err != nil { return err } @@ -232,22 +247,19 @@ func (p *publisher) PublishStateNode(node *snapt.Node, headerID string, height * return err } -// PublishStorageNode writes the storage node to the ipfs backing pg datastore and adds secondary -// indexes in the storage_cids table -func (p *publisher) PublishStorageNode(node *snapt.Node, headerID string, height *big.Int, statePath []byte, snapTx snapt.Tx) error { - var storageKey string - if !snapt.IsNullHash(node.Key) { - storageKey = node.Key.Hex() - } - +// PublishStorageLeafNode writes the storage node to eth.storage_cids +func (p *publisher) PublishStorageLeafNode(storageNode *models.StorageNodeModel, snapTx snapt.Tx) error { tx := snapTx.(fileTx) - storageCIDStr, mhKey, err := tx.publishRaw(ipld.MEthStorageTrie, node.Value, height) - if err != nil { - return err - } - err = tx.write(&snapt.TableStorageNode, height.String(), headerID, statePath, storageKey, storageCIDStr, node.Path, - node.NodeType, false, mhKey) + err := tx.write(&schema.TableStorageNode, + storageNode.BlockNumber, + storageNode.HeaderID, + storageNode.StateKey, + storageNode.StorageKey, + storageNode.CID, + true, + storageNode.Value, + false) if err != nil { return err } @@ -262,15 +274,11 @@ func (p *publisher) PublishStorageNode(node *snapt.Node, headerID string, height // PublishCode writes code to the ipfs backing pg datastore func (p *publisher) PublishCode(height *big.Int, codeHash common.Hash, codeBytes []byte, snapTx snapt.Tx) error { - // no codec for code, doesn't matter though since blockstore key is multihash-derived - mhKey, err := shared.MultihashKeyFromKeccak256(codeHash) - if err != nil { - return fmt.Errorf("error deriving multihash key from codehash: %v", err) - } + c := ipld.Keccak256ToCid(ipld.RawBinary, codeHash.Bytes()) tx := snapTx.(fileTx) - if err = tx.write(&snapt.TableIPLDBlock, height.String(), mhKey, codeBytes); err != nil { - return fmt.Errorf("error publishing code IPLD: %v", err) + if _, err := tx.publishIPLD(c, codeBytes, height); err != nil { + return err } // increment code node counter. atomic.AddUint64(&p.codeNodeCounter, 1) diff --git a/pkg/snapshot/pg/publisher.go b/pkg/snapshot/pg/publisher.go index df6a42e..d3ce792 100644 --- a/pkg/snapshot/pg/publisher.go +++ b/pkg/snapshot/pg/publisher.go @@ -18,13 +18,12 @@ package pg import ( "context" "math/big" + "strconv" "sync/atomic" "time" - "github.com/ethereum/go-ethereum/statediff/indexer/models" - "github.com/lib/pq" - "github.com/ipfs/go-cid" + "github.com/lib/pq" "github.com/multiformats/go-multihash" "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" @@ -34,6 +33,7 @@ import ( "github.com/ethereum/go-ethereum/statediff/indexer/database/sql" "github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres" "github.com/ethereum/go-ethereum/statediff/indexer/ipld" + "github.com/ethereum/go-ethereum/statediff/indexer/models" "github.com/ethereum/go-ethereum/statediff/indexer/shared/schema" "github.com/cerc-io/ipld-eth-state-snapshot/pkg/prom" @@ -90,15 +90,14 @@ func (p *publisher) BeginTx() (snapt.Tx, error) { } // PublishRaw derives a cid from raw bytes and provided codec and multihash type, and writes it to the db tx -// returns the CID and blockstore prefixed multihash key -func (tx pubTx) publishRaw(codec uint64, raw []byte, height *big.Int) (cid, prefixedKey string, err error) { +// returns the CID +func (tx pubTx) publishRaw(codec uint64, raw []byte, height *big.Int) (cid string, err error) { c, err := ipld.RawdataToCid(codec, raw, multihash.KECCAK_256) if err != nil { return } cid = c.String() - prefixedKey, err = tx.publishIPLD(c, raw, height) - return + return tx.publishIPLD(c, raw, height) } func (tx pubTx) publishIPLD(c cid.Cid, raw []byte, height *big.Int) (string, error) { @@ -135,10 +134,21 @@ func (p *publisher) PublishHeader(header *types.Header) (err error) { return err } - _, err = tx.Exec(schema.TableHeader.ToInsertStatement(false), header.Number.Uint64(), header.Hash().Hex(), - header.ParentHash.Hex(), headerNode.Cid().String(), "0", pq.StringArray([]string{p.db.NodeID()}), "0", - header.Root.Hex(), header.TxHash.Hex(), header.ReceiptHash.Hex(), header.UncleHash.Hex(), - header.Bloom.Bytes(), header.Time, header.Coinbase.String()) + _, err = tx.Exec(schema.TableHeader.ToInsertStatement(false), + header.Number.Uint64(), + header.Hash().Hex(), + header.ParentHash.Hex(), + headerNode.Cid().String(), + "0", + pq.StringArray([]string{p.db.NodeID()}), + "0", + header.Root.Hex(), + header.TxHash.Hex(), + header.ReceiptHash.Hex(), + header.UncleHash.Hex(), + header.Bloom.Bytes(), + strconv.FormatUint(header.Time, 10), + header.Coinbase.String()) return err } @@ -155,7 +165,7 @@ func (p *publisher) PublishStateLeafNode(stateNode *models.StateNodeModel, snapT stateNode.Nonce, stateNode.CodeHash, stateNode.StorageRoot, - stateNode.Removed) + false) if err != nil { return err } @@ -179,7 +189,7 @@ func (p *publisher) PublishStorageLeafNode(storageNode *models.StorageNodeModel, storageNode.CID, true, storageNode.Value, - storageNode.Removed) + false) if err != nil { return err } From 14b1180161664c1278b04b2f64b350f815176426 Mon Sep 17 00:00:00 2001 From: i-norden Date: Tue, 11 Apr 2023 12:09:08 -0500 Subject: [PATCH 04/18] update Block1 and Chain2_Block32 test fixtures --- fixture/service.go | 534 +++++++++++++++++++++++++++++++-------------- 1 file changed, 371 insertions(+), 163 deletions(-) diff --git a/fixture/service.go b/fixture/service.go index dc91cd9..fcec6bc 100644 --- a/fixture/service.go +++ b/fixture/service.go @@ -3,10 +3,13 @@ package fixture import ( "math/big" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/rlp" + "github.com/ethereum/go-ethereum/statediff/indexer/ipld" + "github.com/ethereum/go-ethereum/statediff/indexer/models" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - - snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" ) var Block1_Header = types.Header{ @@ -28,11 +31,49 @@ var Block1_Header = types.Header{ BaseFee: nil, } -var Block1_StateNode0 = snapt.Node{ - NodeType: 0, - Path: []byte{12, 0}, - Key: common.Hash{}, - Value: []byte{248, 113, 160, 147, 141, 92, 6, 119, 63, 191, 125, 121, 193, 230, 153, 223, 49, 102, 109, 236, 50, 44, 161, 215, 28, 224, 171, 111, 118, 230, 79, 99, 18, 99, 4, 160, 117, 126, 95, 187, 60, 115, 90, 36, 51, 167, 59, 86, 20, 175, 63, 118, 94, 230, 107, 202, 41, 253, 234, 165, 214, 221, 181, 45, 9, 202, 244, 148, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 160, 247, 170, 155, 102, 71, 245, 140, 90, 255, 89, 193, 131, 99, 31, 85, 161, 78, 90, 0, 204, 46, 253, 15, 71, 120, 19, 109, 123, 255, 0, 188, 27, 128}, +var block1_stateNodeRLP = []byte{248, 113, 160, 147, 141, 92, 6, 119, 63, 191, 125, 121, 193, 230, 153, 223, 49, 102, 109, 236, 50, 44, 161, 215, 28, 224, 171, 111, 118, 230, 79, 99, 18, 99, 4, 160, 117, 126, 95, 187, 60, 115, 90, 36, 51, 167, 59, 86, 20, 175, 63, 118, 94, 230, 107, 202, 41, 253, 234, 165, 214, 221, 181, 45, 9, 202, 244, 148, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 160, 247, 170, 155, 102, 71, 245, 140, 90, 255, 89, 193, 131, 99, 31, 85, 161, 78, 90, 0, 204, 46, 253, 15, 71, 120, 19, 109, 123, 255, 0, 188, 27, 128} +var block1_stateNodeCID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block1_stateNodeRLP)) +var block_stateNodeLeafKey = "0x39fc293fc702e42b9c023f094826545db42fc0fdf2ba031bb522d5ef917a6edb" + +var Block1_StateNodeIPLD = models.IPLDModel{ + BlockNumber: Block1_Header.Number.String(), + Key: block1_stateNodeCID.String(), + Data: block1_stateNodeRLP, +} + +var Block1_EmptyRootNodeRLP, _ = rlp.EncodeToBytes([]byte{}) + +var Block1_StateNode0 = models.StateNodeModel{ + BlockNumber: Block1_Header.Number.String(), + HeaderID: Block1_Header.Hash().Hex(), + CID: block1_stateNodeCID.String(), + Diff: false, + Balance: "1000", + Nonce: 1, + CodeHash: crypto.Keccak256Hash([]byte{}).Hex(), + StorageRoot: crypto.Keccak256Hash(Block1_EmptyRootNodeRLP).Hex(), + Removed: false, + StateKey: block_stateNodeLeafKey, +} + +var block1_storageNodeRLP = []byte{3, 111, 15, 5, 141, 92, 6, 120, 63, 191, 125, 121, 193, 230, 153, 7, 49, 102, 109, 236, 50, 44, 161, 215, 28, 224, 171, 111, 118, 230, 79, 99, 18, 99, 4, 160, 117, 126, 95, 187, 60, 115, 90, 36, 51, 167, 59, 86, 20, 175, 63, 118, 94, 2, 107, 202, 41, 253, 234, 165, 214, 221, 181, 45, 9, 202, 244, 148, 128, 128, 32, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 160, 247, 170, 155, 102, 245, 71, 140, 90, 255, 89, 131, 99, 99, 31, 85, 161, 78, 90, 0, 204, 46, 253, 15, 71, 120, 19, 109, 123, 255, 0, 188, 27, 128} +var block1_storageNodeCID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block1_storageNodeRLP)) + +var Block1_StorageNodeIPLD = models.IPLDModel{ + BlockNumber: Block1_Header.Number.String(), + Key: block1_storageNodeCID.String(), + Data: block1_storageNodeRLP, +} + +var Block1_StorageNode0 = models.StorageNodeModel{ + BlockNumber: Block1_Header.Number.String(), + HeaderID: Block1_Header.Hash().Hex(), + StateKey: block_stateNodeLeafKey, + StorageKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", + Removed: false, + CID: block1_storageNodeCID.String(), + Diff: false, + Value: []byte{1}, } // Header for last block at height 32 @@ -57,215 +98,382 @@ var Chain2_Block32_Header = types.Header{ // State nodes for all paths at height 32 // Total 7 -var Chain2_Block32_StateNodes = []snapt.Node{ +var chain2_Block32_stateNode0RLP = []byte{248, 145, 128, 128, 128, 160, 151, 6, 152, 177, 246, 151, 39, 79, 71, 219, 192, 153, 253, 0, 46, 66, 56, 238, 116, 176, 237, 244, 79, 132, 49, 29, 30, 82, 108, 53, 191, 204, 128, 128, 160, 46, 224, 200, 157, 30, 24, 225, 92, 222, 131, 123, 169, 124, 86, 228, 124, 79, 136, 236, 83, 185, 22, 67, 136, 5, 73, 46, 110, 136, 138, 101, 63, 128, 128, 160, 104, 220, 31, 84, 240, 26, 100, 148, 110, 49, 52, 120, 81, 119, 30, 251, 196, 107, 11, 134, 124, 238, 93, 61, 109, 109, 181, 208, 10, 189, 17, 92, 128, 128, 160, 171, 149, 11, 254, 75, 39, 224, 164, 133, 151, 153, 47, 109, 134, 15, 169, 139, 206, 132, 93, 220, 210, 0, 225, 235, 118, 121, 247, 173, 12, 135, 133, 128, 128, 128, 128} +var chain2_Block32_stateNode0CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode0RLP)) +var chain2_Block32_stateNode1RLP = []byte{248, 81, 128, 128, 128, 160, 209, 34, 171, 171, 30, 147, 168, 199, 137, 152, 249, 118, 14, 166, 1, 169, 116, 224, 82, 196, 237, 83, 255, 188, 228, 197, 7, 178, 144, 137, 77, 55, 128, 128, 128, 128, 128, 160, 135, 96, 108, 173, 177, 63, 201, 196, 26, 204, 72, 118, 17, 30, 76, 117, 155, 63, 68, 187, 4, 249, 78, 69, 161, 82, 178, 234, 164, 48, 158, 173, 128, 128, 128, 128, 128, 128, 128} +var chain2_Block32_stateNode1CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode1RLP)) +var chain2_Block32_stateNode2RLP = []byte{248, 105, 160, 32, 21, 58, 188, 102, 126, 135, 59, 96, 54, 200, 164, 107, 221, 132, 126, 42, 222, 63, 137, 185, 51, 28, 120, 239, 37, 83, 254, 161, 148, 197, 13, 184, 70, 248, 68, 1, 128, 160, 168, 127, 48, 6, 204, 116, 51, 247, 216, 182, 191, 182, 185, 124, 223, 202, 239, 15, 67, 91, 253, 165, 42, 2, 54, 10, 211, 250, 242, 149, 205, 139, 160, 224, 22, 140, 8, 116, 27, 79, 113, 64, 185, 215, 180, 38, 38, 236, 164, 5, 87, 211, 15, 88, 153, 138, 185, 94, 186, 125, 137, 164, 198, 141, 192} +var chain2_Block32_stateNode2CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode2RLP)) +var chain2_Block32_stateNode3RLP = []byte{248, 105, 160, 32, 252, 41, 63, 199, 2, 228, 43, 156, 2, 63, 9, 72, 38, 84, 93, 180, 47, 192, 253, 242, 186, 3, 27, 181, 34, 213, 239, 145, 122, 110, 219, 184, 70, 248, 68, 1, 128, 160, 25, 80, 158, 144, 166, 222, 32, 247, 189, 42, 34, 60, 40, 240, 56, 105, 251, 184, 132, 209, 219, 59, 60, 16, 221, 204, 228, 74, 76, 113, 37, 226, 160, 224, 22, 140, 8, 116, 27, 79, 113, 64, 185, 215, 180, 38, 38, 236, 164, 5, 87, 211, 15, 88, 153, 138, 185, 94, 186, 125, 137, 164, 198, 141, 192} +var chain2_Block32_stateNode3CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode3RLP)) +var chain2_Block32_stateNode4RLP = []byte{248, 118, 160, 55, 171, 60, 13, 215, 117, 244, 72, 175, 127, 180, 18, 67, 65, 94, 214, 251, 151, 93, 21, 48, 162, 216, 40, 246, 155, 234, 115, 70, 35, 26, 215, 184, 83, 248, 81, 10, 141, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 160, 197, 210, 70, 1, 134, 247, 35, 60, 146, 126, 125, 178, 220, 199, 3, 192, 229, 0, 182, 83, 202, 130, 39, 59, 123, 250, 216, 4, 93, 133, 164, 112} +var chain2_Block32_stateNode4CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode4RLP)) +var chain2_Block32_stateNode5RLP = []byte{248, 105, 160, 51, 151, 227, 61, 237, 218, 71, 99, 174, 161, 67, 252, 97, 81, 235, 205, 154, 147, 246, 45, 183, 166, 165, 86, 212, 108, 88, 93, 130, 173, 42, 252, 184, 70, 248, 68, 1, 128, 160, 54, 174, 96, 33, 243, 186, 113, 120, 188, 222, 254, 210, 63, 40, 4, 130, 154, 156, 66, 247, 130, 93, 88, 113, 144, 78, 47, 252, 174, 140, 130, 45, 160, 29, 80, 58, 104, 206, 141, 36, 93, 124, 217, 67, 93, 183, 43, 71, 98, 114, 126, 124, 105, 229, 48, 218, 194, 109, 83, 20, 76, 13, 102, 156, 130} +var chain2_Block32_stateNode5CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode5RLP)) +var chain2_Block32_stateNode6RLP = []byte{248, 105, 160, 58, 188, 94, 219, 48, 85, 131, 227, 63, 102, 50, 44, 238, 228, 48, 136, 170, 153, 39, 125, 167, 114, 254, 181, 5, 53, 18, 208, 58, 10, 112, 43, 184, 70, 248, 68, 1, 128, 160, 54, 174, 96, 33, 243, 186, 113, 120, 188, 222, 254, 210, 63, 40, 4, 130, 154, 156, 66, 247, 130, 93, 88, 113, 144, 78, 47, 252, 174, 140, 130, 45, 160, 29, 80, 58, 104, 206, 141, 36, 93, 124, 217, 67, 93, 183, 43, 71, 98, 114, 126, 124, 105, 229, 48, 218, 194, 109, 83, 20, 76, 13, 102, 156, 130} +var chain2_Block32_stateNode6CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode6RLP)) + +var Chain2_Block32_StateIPLDs = []models.IPLDModel{ { - NodeType: 0, - Path: []byte{}, - Key: common.Hash{}, - Value: []byte{248, 145, 128, 128, 128, 160, 151, 6, 152, 177, 246, 151, 39, 79, 71, 219, 192, 153, 253, 0, 46, 66, 56, 238, 116, 176, 237, 244, 79, 132, 49, 29, 30, 82, 108, 53, 191, 204, 128, 128, 160, 46, 224, 200, 157, 30, 24, 225, 92, 222, 131, 123, 169, 124, 86, 228, 124, 79, 136, 236, 83, 185, 22, 67, 136, 5, 73, 46, 110, 136, 138, 101, 63, 128, 128, 160, 104, 220, 31, 84, 240, 26, 100, 148, 110, 49, 52, 120, 81, 119, 30, 251, 196, 107, 11, 134, 124, 238, 93, 61, 109, 109, 181, 208, 10, 189, 17, 92, 128, 128, 160, 171, 149, 11, 254, 75, 39, 224, 164, 133, 151, 153, 47, 109, 134, 15, 169, 139, 206, 132, 93, 220, 210, 0, 225, 235, 118, 121, 247, 173, 12, 135, 133, 128, 128, 128, 128}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_stateNode0CID.String(), + Data: chain2_Block32_stateNode0RLP, }, { - NodeType: 0, - Path: []byte{3}, - Key: common.Hash{}, - Value: []byte{248, 81, 128, 128, 128, 160, 209, 34, 171, 171, 30, 147, 168, 199, 137, 152, 249, 118, 14, 166, 1, 169, 116, 224, 82, 196, 237, 83, 255, 188, 228, 197, 7, 178, 144, 137, 77, 55, 128, 128, 128, 128, 128, 160, 135, 96, 108, 173, 177, 63, 201, 196, 26, 204, 72, 118, 17, 30, 76, 117, 155, 63, 68, 187, 4, 249, 78, 69, 161, 82, 178, 234, 164, 48, 158, 173, 128, 128, 128, 128, 128, 128, 128}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_stateNode1CID.String(), + Data: chain2_Block32_stateNode1RLP, }, { - NodeType: 2, - Path: []byte{3, 3}, - Key: common.HexToHash("0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d"), - Value: []byte{248, 105, 160, 32, 21, 58, 188, 102, 126, 135, 59, 96, 54, 200, 164, 107, 221, 132, 126, 42, 222, 63, 137, 185, 51, 28, 120, 239, 37, 83, 254, 161, 148, 197, 13, 184, 70, 248, 68, 1, 128, 160, 168, 127, 48, 6, 204, 116, 51, 247, 216, 182, 191, 182, 185, 124, 223, 202, 239, 15, 67, 91, 253, 165, 42, 2, 54, 10, 211, 250, 242, 149, 205, 139, 160, 224, 22, 140, 8, 116, 27, 79, 113, 64, 185, 215, 180, 38, 38, 236, 164, 5, 87, 211, 15, 88, 153, 138, 185, 94, 186, 125, 137, 164, 198, 141, 192}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_stateNode2CID.String(), + Data: chain2_Block32_stateNode2RLP, }, { - NodeType: 2, - Path: []byte{3, 9}, - Key: common.HexToHash("0x39fc293fc702e42b9c023f094826545db42fc0fdf2ba031bb522d5ef917a6edb"), - Value: []byte{248, 105, 160, 32, 252, 41, 63, 199, 2, 228, 43, 156, 2, 63, 9, 72, 38, 84, 93, 180, 47, 192, 253, 242, 186, 3, 27, 181, 34, 213, 239, 145, 122, 110, 219, 184, 70, 248, 68, 1, 128, 160, 25, 80, 158, 144, 166, 222, 32, 247, 189, 42, 34, 60, 40, 240, 56, 105, 251, 184, 132, 209, 219, 59, 60, 16, 221, 204, 228, 74, 76, 113, 37, 226, 160, 224, 22, 140, 8, 116, 27, 79, 113, 64, 185, 215, 180, 38, 38, 236, 164, 5, 87, 211, 15, 88, 153, 138, 185, 94, 186, 125, 137, 164, 198, 141, 192}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_stateNode3CID.String(), + Data: chain2_Block32_stateNode3RLP, }, { - NodeType: 2, - Path: []byte{6}, - Key: common.HexToHash("0x67ab3c0dd775f448af7fb41243415ed6fb975d1530a2d828f69bea7346231ad7"), - Value: []byte{248, 118, 160, 55, 171, 60, 13, 215, 117, 244, 72, 175, 127, 180, 18, 67, 65, 94, 214, 251, 151, 93, 21, 48, 162, 216, 40, 246, 155, 234, 115, 70, 35, 26, 215, 184, 83, 248, 81, 10, 141, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 160, 197, 210, 70, 1, 134, 247, 35, 60, 146, 126, 125, 178, 220, 199, 3, 192, 229, 0, 182, 83, 202, 130, 39, 59, 123, 250, 216, 4, 93, 133, 164, 112}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_stateNode4CID.String(), + Data: chain2_Block32_stateNode4RLP, }, { - NodeType: 2, - Path: []byte{9}, - Key: common.HexToHash("0x9397e33dedda4763aea143fc6151ebcd9a93f62db7a6a556d46c585d82ad2afc"), - Value: []byte{248, 105, 160, 51, 151, 227, 61, 237, 218, 71, 99, 174, 161, 67, 252, 97, 81, 235, 205, 154, 147, 246, 45, 183, 166, 165, 86, 212, 108, 88, 93, 130, 173, 42, 252, 184, 70, 248, 68, 1, 128, 160, 54, 174, 96, 33, 243, 186, 113, 120, 188, 222, 254, 210, 63, 40, 4, 130, 154, 156, 66, 247, 130, 93, 88, 113, 144, 78, 47, 252, 174, 140, 130, 45, 160, 29, 80, 58, 104, 206, 141, 36, 93, 124, 217, 67, 93, 183, 43, 71, 98, 114, 126, 124, 105, 229, 48, 218, 194, 109, 83, 20, 76, 13, 102, 156, 130}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_stateNode5CID.String(), + Data: chain2_Block32_stateNode5RLP, }, { - NodeType: 2, - Path: []byte{12}, - Key: common.HexToHash("0xcabc5edb305583e33f66322ceee43088aa99277da772feb5053512d03a0a702b"), - Value: []byte{248, 105, 160, 58, 188, 94, 219, 48, 85, 131, 227, 63, 102, 50, 44, 238, 228, 48, 136, 170, 153, 39, 125, 167, 114, 254, 181, 5, 53, 18, 208, 58, 10, 112, 43, 184, 70, 248, 68, 1, 128, 160, 54, 174, 96, 33, 243, 186, 113, 120, 188, 222, 254, 210, 63, 40, 4, 130, 154, 156, 66, 247, 130, 93, 88, 113, 144, 78, 47, 252, 174, 140, 130, 45, 160, 29, 80, 58, 104, 206, 141, 36, 93, 124, 217, 67, 93, 183, 43, 71, 98, 114, 126, 124, 105, 229, 48, 218, 194, 109, 83, 20, 76, 13, 102, 156, 130}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_stateNode6CID.String(), + Data: chain2_Block32_stateNode6RLP, + }, +} +var Chain2_Block32_StateNodes = []models.StateNodeModel{ + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + CID: chain2_Block32_stateNode2CID.String(), + Diff: false, + Balance: "1000", + Nonce: 1, + CodeHash: crypto.Keccak256Hash([]byte{}).Hex(), + StorageRoot: crypto.Keccak256Hash(Block1_EmptyRootNodeRLP).Hex(), + Removed: false, + StateKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + CID: chain2_Block32_stateNode3CID.String(), + Diff: false, + Balance: "1000", + Nonce: 1, + CodeHash: crypto.Keccak256Hash([]byte{}).Hex(), + StorageRoot: crypto.Keccak256Hash(Block1_EmptyRootNodeRLP).Hex(), + Removed: false, + StateKey: "0x39fc293fc702e42b9c023f094826545db42fc0fdf2ba031bb522d5ef917a6edb", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + CID: chain2_Block32_stateNode4CID.String(), + Diff: false, + Balance: "1000", + Nonce: 1, + CodeHash: crypto.Keccak256Hash([]byte{}).Hex(), + StorageRoot: crypto.Keccak256Hash(Block1_EmptyRootNodeRLP).Hex(), + Removed: false, + StateKey: "0x67ab3c0dd775f448af7fb41243415ed6fb975d1530a2d828f69bea7346231ad7", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + CID: chain2_Block32_stateNode5CID.String(), + Diff: false, + Balance: "1000", + Nonce: 1, + CodeHash: crypto.Keccak256Hash([]byte{}).Hex(), + StorageRoot: crypto.Keccak256Hash(Block1_EmptyRootNodeRLP).Hex(), + Removed: false, + StateKey: "0x9397e33dedda4763aea143fc6151ebcd9a93f62db7a6a556d46c585d82ad2afc", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + CID: chain2_Block32_stateNode6CID.String(), + Diff: false, + Balance: "1000", + Nonce: 1, + CodeHash: crypto.Keccak256Hash([]byte{}).Hex(), + StorageRoot: crypto.Keccak256Hash(Block1_EmptyRootNodeRLP).Hex(), + Removed: false, + StateKey: "0xcabc5edb305583e33f66322ceee43088aa99277da772feb5053512d03a0a702b", }, } // Storage nodes for all paths at height 32 // Total 18 -var Chain2_Block32_StorageNodes = []StorageNodeWithState{ +var chain2_Block32_storageNode0RLP = []byte{248, 145, 128, 128, 128, 128, 160, 46, 77, 227, 140, 57, 224, 108, 238, 40, 82, 145, 79, 210, 174, 54, 248, 0, 145, 137, 64, 229, 230, 148, 145, 250, 132, 89, 198, 8, 249, 245, 133, 128, 160, 146, 250, 117, 217, 106, 75, 51, 124, 196, 244, 29, 16, 47, 173, 5, 90, 86, 19, 15, 48, 179, 174, 60, 171, 112, 154, 92, 70, 232, 164, 141, 165, 128, 160, 107, 250, 27, 137, 190, 180, 7, 172, 62, 97, 13, 157, 215, 114, 55, 219, 14, 244, 163, 155, 192, 255, 34, 143, 154, 149, 33, 227, 166, 135, 164, 93, 128, 128, 128, 160, 173, 131, 221, 2, 30, 147, 11, 230, 58, 166, 18, 25, 90, 56, 198, 126, 196, 130, 131, 1, 213, 112, 129, 155, 96, 143, 121, 231, 218, 97, 216, 200, 128, 128, 128, 128} +var chain2_Block32_storageNode0CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode0RLP)) +var chain2_Block32_storageNode1RLP = []byte{248, 81, 160, 167, 145, 134, 15, 219, 140, 96, 62, 101, 242, 176, 129, 164, 160, 200, 221, 13, 1, 246, 167, 156, 45, 205, 192, 88, 236, 235, 80, 105, 178, 123, 2, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 160, 18, 136, 22, 150, 26, 170, 67, 152, 182, 246, 95, 49, 193, 199, 219, 163, 97, 25, 243, 70, 126, 235, 163, 59, 44, 16, 37, 37, 247, 50, 229, 70, 128, 128} +var chain2_Block32_storageNode1CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode1RLP)) +var chain2_Block32_storageNode2RLP = []byte{236, 160, 32, 87, 135, 250, 18, 168, 35, 224, 242, 183, 99, 28, 196, 27, 59, 168, 130, 139, 51, 33, 202, 129, 17, 17, 250, 117, 205, 58, 163, 187, 90, 206, 138, 137, 54, 53, 201, 173, 197, 222, 160, 0, 0} +var chain2_Block32_storageNode2CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode2RLP)) +var chain2_Block32_storageNode3RLP = []byte{226, 160, 32, 44, 236, 111, 71, 132, 84, 126, 80, 66, 161, 99, 128, 134, 227, 24, 137, 41, 243, 79, 60, 0, 5, 248, 222, 195, 102, 201, 110, 129, 149, 172, 100} +var chain2_Block32_storageNode3CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode3RLP)) +var chain2_Block32_storageNode4RLP = []byte{236, 160, 58, 160, 42, 17, 221, 77, 37, 151, 49, 139, 113, 212, 147, 177, 69, 221, 246, 174, 8, 23, 169, 211, 148, 127, 69, 213, 41, 166, 167, 95, 43, 239, 138, 137, 54, 53, 201, 173, 197, 222, 159, 255, 156} +var chain2_Block32_storageNode4CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode4RLP)) +var chain2_Block32_storageNode5RLP = []byte{248, 67, 160, 58, 53, 172, 251, 193, 95, 248, 26, 57, 174, 125, 52, 79, 215, 9, 242, 142, 134, 0, 180, 170, 140, 101, 198, 182, 75, 254, 127, 227, 107, 209, 155, 161, 160, 71, 76, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6} +var chain2_Block32_storageNode5CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode5RLP)) +var chain2_Block32_storageNode6RLP = []byte{248, 67, 160, 58, 53, 172, 251, 193, 95, 248, 26, 57, 174, 125, 52, 79, 215, 9, 242, 142, 134, 0, 180, 170, 140, 101, 198, 182, 75, 254, 127, 227, 107, 209, 155, 161, 160, 71, 76, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6} +var chain2_Block32_storageNode6CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode6RLP)) +var chain2_Block32_storageNode7RLP = []byte{248, 67, 160, 50, 87, 90, 14, 158, 89, 60, 0, 249, 89, 248, 201, 47, 18, 219, 40, 105, 195, 57, 90, 59, 5, 2, 208, 94, 37, 22, 68, 111, 113, 248, 91, 161, 160, 71, 111, 108, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8} +var chain2_Block32_storageNode7CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode7RLP)) +var chain2_Block32_storageNode8RLP = []byte{248, 67, 160, 50, 87, 90, 14, 158, 89, 60, 0, 249, 89, 248, 201, 47, 18, 219, 40, 105, 195, 57, 90, 59, 5, 2, 208, 94, 37, 22, 68, 111, 113, 248, 91, 161, 160, 71, 111, 108, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8} +var chain2_Block32_storageNode8CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode8RLP)) +var chain2_Block32_storageNode9RLP = []byte{248, 145, 128, 128, 128, 128, 160, 145, 86, 15, 219, 52, 36, 164, 68, 160, 227, 156, 111, 1, 245, 112, 184, 187, 242, 26, 138, 8, 98, 129, 35, 57, 212, 165, 21, 204, 151, 229, 43, 128, 160, 250, 205, 84, 126, 141, 108, 126, 228, 162, 8, 238, 234, 141, 159, 232, 175, 70, 112, 207, 55, 165, 209, 107, 153, 54, 183, 60, 172, 194, 251, 66, 61, 128, 160, 107, 250, 27, 137, 190, 180, 7, 172, 62, 97, 13, 157, 215, 114, 55, 219, 14, 244, 163, 155, 192, 255, 34, 143, 154, 149, 33, 227, 166, 135, 164, 93, 128, 128, 128, 160, 173, 131, 221, 2, 30, 147, 11, 230, 58, 166, 18, 25, 90, 56, 198, 126, 196, 130, 131, 1, 213, 112, 129, 155, 96, 143, 121, 231, 218, 97, 216, 200, 128, 128, 128, 128} +var chain2_Block32_storageNode9CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode9RLP)) +var chain2_Block32_storageNode10RLP = []byte{236, 160, 48, 87, 135, 250, 18, 168, 35, 224, 242, 183, 99, 28, 196, 27, 59, 168, 130, 139, 51, 33, 202, 129, 17, 17, 250, 117, 205, 58, 163, 187, 90, 206, 138, 137, 54, 53, 201, 173, 197, 222, 160, 0, 0} +var chain2_Block32_storageNode10CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode10RLP)) +var chain2_Block32_storageNode11RLP = []byte{236, 160, 58, 160, 42, 17, 221, 77, 37, 151, 49, 139, 113, 212, 147, 177, 69, 221, 246, 174, 8, 23, 169, 211, 148, 127, 69, 213, 41, 166, 167, 95, 43, 239, 138, 137, 54, 53, 201, 173, 197, 222, 160, 0, 0} +var chain2_Block32_storageNode11CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode11RLP)) +var chain2_Block32_storageNode12RLP = []byte{248, 81, 128, 128, 160, 79, 197, 241, 58, 178, 249, 186, 12, 45, 168, 139, 1, 81, 171, 14, 124, 244, 216, 93, 8, 204, 164, 92, 205, 146, 60, 106, 183, 99, 35, 235, 40, 128, 128, 128, 128, 128, 128, 128, 128, 160, 82, 154, 228, 80, 107, 126, 132, 72, 3, 170, 88, 197, 100, 216, 50, 21, 226, 183, 86, 42, 208, 239, 184, 183, 152, 93, 188, 113, 224, 234, 218, 43, 128, 128, 128, 128, 128} +var chain2_Block32_storageNode12CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode12RLP)) +var chain2_Block32_storageNode13RLP = []byte{248, 81, 128, 128, 160, 79, 197, 241, 58, 178, 249, 186, 12, 45, 168, 139, 1, 81, 171, 14, 124, 244, 216, 93, 8, 204, 164, 92, 205, 146, 60, 106, 183, 99, 35, 235, 40, 128, 128, 128, 128, 128, 128, 128, 128, 160, 82, 154, 228, 80, 107, 126, 132, 72, 3, 170, 88, 197, 100, 216, 50, 21, 226, 183, 86, 42, 208, 239, 184, 183, 152, 93, 188, 113, 224, 234, 218, 43, 128, 128, 128, 128, 128} +var chain2_Block32_storageNode13CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode13RLP)) +var chain2_Block32_storageNode14RLP = []byte{226, 160, 57, 13, 236, 217, 84, 139, 98, 168, 214, 3, 69, 169, 136, 56, 111, 200, 75, 166, 188, 149, 72, 64, 8, 246, 54, 47, 147, 22, 14, 243, 229, 99, 1} +var chain2_Block32_storageNode14CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode14RLP)) +var chain2_Block32_storageNode15RLP = []byte{226, 160, 57, 13, 236, 217, 84, 139, 98, 168, 214, 3, 69, 169, 136, 56, 111, 200, 75, 166, 188, 149, 72, 64, 8, 246, 54, 47, 147, 22, 14, 243, 229, 99, 1} +var chain2_Block32_storageNode15CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode15RLP)) +var chain2_Block32_storageNode16RLP = []byte{226, 160, 49, 14, 45, 82, 118, 18, 7, 59, 38, 238, 205, 253, 113, 126, 106, 50, 12, 244, 75, 74, 250, 194, 176, 115, 45, 159, 203, 226, 183, 250, 12, 246, 4} +var chain2_Block32_storageNode16CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode16RLP)) +var chain2_Block32_storageNode17RLP = []byte{226, 160, 49, 14, 45, 82, 118, 18, 7, 59, 38, 238, 205, 253, 113, 126, 106, 50, 12, 244, 75, 74, 250, 194, 176, 115, 45, 159, 203, 226, 183, 250, 12, 246, 4} +var chain2_Block32_storageNode17CID = ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(chain2_Block32_storageNode17RLP)) + +var Chain2_Block32_StorageIPLDs = []models.IPLDModel{ { - Node: snapt.Node{ - NodeType: 0, - Path: []byte{}, - Key: common.HexToHash(""), - Value: []byte{248, 145, 128, 128, 128, 128, 160, 46, 77, 227, 140, 57, 224, 108, 238, 40, 82, 145, 79, 210, 174, 54, 248, 0, 145, 137, 64, 229, 230, 148, 145, 250, 132, 89, 198, 8, 249, 245, 133, 128, 160, 146, 250, 117, 217, 106, 75, 51, 124, 196, 244, 29, 16, 47, 173, 5, 90, 86, 19, 15, 48, 179, 174, 60, 171, 112, 154, 92, 70, 232, 164, 141, 165, 128, 160, 107, 250, 27, 137, 190, 180, 7, 172, 62, 97, 13, 157, 215, 114, 55, 219, 14, 244, 163, 155, 192, 255, 34, 143, 154, 149, 33, 227, 166, 135, 164, 93, 128, 128, 128, 160, 173, 131, 221, 2, 30, 147, 11, 230, 58, 166, 18, 25, 90, 56, 198, 126, 196, 130, 131, 1, 213, 112, 129, 155, 96, 143, 121, 231, 218, 97, 216, 200, 128, 128, 128, 128}, - }, - StatePath: []byte{3, 3}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode0CID.String(), + Data: chain2_Block32_storageNode0RLP, }, { - Node: snapt.Node{ - NodeType: 0, - Path: []byte{4}, - Key: common.HexToHash(""), - Value: []byte{248, 81, 160, 167, 145, 134, 15, 219, 140, 96, 62, 101, 242, 176, 129, 164, 160, 200, 221, 13, 1, 246, 167, 156, 45, 205, 192, 88, 236, 235, 80, 105, 178, 123, 2, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 160, 18, 136, 22, 150, 26, 170, 67, 152, 182, 246, 95, 49, 193, 199, 219, 163, 97, 25, 243, 70, 126, 235, 163, 59, 44, 16, 37, 37, 247, 50, 229, 70, 128, 128}, - }, - StatePath: []byte{3, 3}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode1CID.String(), + Data: chain2_Block32_storageNode1RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{4, 0}, - Key: common.HexToHash("0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace"), - Value: []byte{236, 160, 32, 87, 135, 250, 18, 168, 35, 224, 242, 183, 99, 28, 196, 27, 59, 168, 130, 139, 51, 33, 202, 129, 17, 17, 250, 117, 205, 58, 163, 187, 90, 206, 138, 137, 54, 53, 201, 173, 197, 222, 160, 0, 0}, - }, - StatePath: []byte{3, 3}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode2CID.String(), + Data: chain2_Block32_storageNode2RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{4, 14}, - Key: common.HexToHash("0x4e2cec6f4784547e5042a1638086e3188929f34f3c0005f8dec366c96e8195ac"), - Value: []byte{226, 160, 32, 44, 236, 111, 71, 132, 84, 126, 80, 66, 161, 99, 128, 134, 227, 24, 137, 41, 243, 79, 60, 0, 5, 248, 222, 195, 102, 201, 110, 129, 149, 172, 100}, - }, - StatePath: []byte{3, 3}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode3CID.String(), + Data: chain2_Block32_storageNode3RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{6}, - Key: common.HexToHash("0x6aa02a11dd4d2597318b71d493b145ddf6ae0817a9d3947f45d529a6a75f2bef"), - Value: []byte{236, 160, 58, 160, 42, 17, 221, 77, 37, 151, 49, 139, 113, 212, 147, 177, 69, 221, 246, 174, 8, 23, 169, 211, 148, 127, 69, 213, 41, 166, 167, 95, 43, 239, 138, 137, 54, 53, 201, 173, 197, 222, 159, 255, 156}, - }, - StatePath: []byte{3, 3}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode4CID.String(), + Data: chain2_Block32_storageNode4RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{8}, - Key: common.HexToHash("0x8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b"), - Value: []byte{248, 67, 160, 58, 53, 172, 251, 193, 95, 248, 26, 57, 174, 125, 52, 79, 215, 9, 242, 142, 134, 0, 180, 170, 140, 101, 198, 182, 75, 254, 127, 227, 107, 209, 155, 161, 160, 71, 76, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, - }, - StatePath: []byte{3, 9}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode5CID.String(), + Data: chain2_Block32_storageNode5RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{8}, - Key: common.HexToHash("0x8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b"), - Value: []byte{248, 67, 160, 58, 53, 172, 251, 193, 95, 248, 26, 57, 174, 125, 52, 79, 215, 9, 242, 142, 134, 0, 180, 170, 140, 101, 198, 182, 75, 254, 127, 227, 107, 209, 155, 161, 160, 71, 76, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, - }, - StatePath: []byte{3, 3}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode6CID.String(), + Data: chain2_Block32_storageNode6RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{12}, - Key: common.HexToHash("0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b"), - Value: []byte{248, 67, 160, 50, 87, 90, 14, 158, 89, 60, 0, 249, 89, 248, 201, 47, 18, 219, 40, 105, 195, 57, 90, 59, 5, 2, 208, 94, 37, 22, 68, 111, 113, 248, 91, 161, 160, 71, 111, 108, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - }, - StatePath: []byte{3, 9}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode7CID.String(), + Data: chain2_Block32_storageNode7RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{12}, - Key: common.HexToHash("0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b"), - Value: []byte{248, 67, 160, 50, 87, 90, 14, 158, 89, 60, 0, 249, 89, 248, 201, 47, 18, 219, 40, 105, 195, 57, 90, 59, 5, 2, 208, 94, 37, 22, 68, 111, 113, 248, 91, 161, 160, 71, 111, 108, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - }, - StatePath: []byte{3, 3}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode8CID.String(), + Data: chain2_Block32_storageNode8RLP, }, { - Node: snapt.Node{ - NodeType: 0, - Path: []byte{}, - Key: common.HexToHash(""), - Value: []byte{248, 145, 128, 128, 128, 128, 160, 145, 86, 15, 219, 52, 36, 164, 68, 160, 227, 156, 111, 1, 245, 112, 184, 187, 242, 26, 138, 8, 98, 129, 35, 57, 212, 165, 21, 204, 151, 229, 43, 128, 160, 250, 205, 84, 126, 141, 108, 126, 228, 162, 8, 238, 234, 141, 159, 232, 175, 70, 112, 207, 55, 165, 209, 107, 153, 54, 183, 60, 172, 194, 251, 66, 61, 128, 160, 107, 250, 27, 137, 190, 180, 7, 172, 62, 97, 13, 157, 215, 114, 55, 219, 14, 244, 163, 155, 192, 255, 34, 143, 154, 149, 33, 227, 166, 135, 164, 93, 128, 128, 128, 160, 173, 131, 221, 2, 30, 147, 11, 230, 58, 166, 18, 25, 90, 56, 198, 126, 196, 130, 131, 1, 213, 112, 129, 155, 96, 143, 121, 231, 218, 97, 216, 200, 128, 128, 128, 128}, - }, - StatePath: []byte{3, 9}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode9CID.String(), + Data: chain2_Block32_storageNode9RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{4}, - Key: common.HexToHash("0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace"), - Value: []byte{236, 160, 48, 87, 135, 250, 18, 168, 35, 224, 242, 183, 99, 28, 196, 27, 59, 168, 130, 139, 51, 33, 202, 129, 17, 17, 250, 117, 205, 58, 163, 187, 90, 206, 138, 137, 54, 53, 201, 173, 197, 222, 160, 0, 0}, - }, - StatePath: []byte{3, 9}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode10CID.String(), + Data: chain2_Block32_storageNode10RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{6}, - Key: common.HexToHash("0x6aa02a11dd4d2597318b71d493b145ddf6ae0817a9d3947f45d529a6a75f2bef"), - Value: []byte{236, 160, 58, 160, 42, 17, 221, 77, 37, 151, 49, 139, 113, 212, 147, 177, 69, 221, 246, 174, 8, 23, 169, 211, 148, 127, 69, 213, 41, 166, 167, 95, 43, 239, 138, 137, 54, 53, 201, 173, 197, 222, 160, 0, 0}, - }, - StatePath: []byte{3, 9}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode11CID.String(), + Data: chain2_Block32_storageNode11RLP, }, { - Node: snapt.Node{ - NodeType: 0, - Path: []byte{}, - Key: common.HexToHash(""), - Value: []byte{248, 81, 128, 128, 160, 79, 197, 241, 58, 178, 249, 186, 12, 45, 168, 139, 1, 81, 171, 14, 124, 244, 216, 93, 8, 204, 164, 92, 205, 146, 60, 106, 183, 99, 35, 235, 40, 128, 128, 128, 128, 128, 128, 128, 128, 160, 82, 154, 228, 80, 107, 126, 132, 72, 3, 170, 88, 197, 100, 216, 50, 21, 226, 183, 86, 42, 208, 239, 184, 183, 152, 93, 188, 113, 224, 234, 218, 43, 128, 128, 128, 128, 128}, - }, - StatePath: []byte{12}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode12CID.String(), + Data: chain2_Block32_storageNode12RLP, }, { - Node: snapt.Node{ - NodeType: 0, - Path: []byte{}, - Key: common.HexToHash(""), - Value: []byte{248, 81, 128, 128, 160, 79, 197, 241, 58, 178, 249, 186, 12, 45, 168, 139, 1, 81, 171, 14, 124, 244, 216, 93, 8, 204, 164, 92, 205, 146, 60, 106, 183, 99, 35, 235, 40, 128, 128, 128, 128, 128, 128, 128, 128, 160, 82, 154, 228, 80, 107, 126, 132, 72, 3, 170, 88, 197, 100, 216, 50, 21, 226, 183, 86, 42, 208, 239, 184, 183, 152, 93, 188, 113, 224, 234, 218, 43, 128, 128, 128, 128, 128}, - }, - StatePath: []byte{9}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode13CID.String(), + Data: chain2_Block32_storageNode13RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{02}, - Key: common.HexToHash("0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563"), - Value: []byte{226, 160, 57, 13, 236, 217, 84, 139, 98, 168, 214, 3, 69, 169, 136, 56, 111, 200, 75, 166, 188, 149, 72, 64, 8, 246, 54, 47, 147, 22, 14, 243, 229, 99, 1}, - }, - StatePath: []byte{12}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode14CID.String(), + Data: chain2_Block32_storageNode14RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{02}, - Key: common.HexToHash("0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563"), - Value: []byte{226, 160, 57, 13, 236, 217, 84, 139, 98, 168, 214, 3, 69, 169, 136, 56, 111, 200, 75, 166, 188, 149, 72, 64, 8, 246, 54, 47, 147, 22, 14, 243, 229, 99, 1}, - }, - StatePath: []byte{9}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode15CID.String(), + Data: chain2_Block32_storageNode15RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{11}, - Key: common.HexToHash("0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"), - Value: []byte{226, 160, 49, 14, 45, 82, 118, 18, 7, 59, 38, 238, 205, 253, 113, 126, 106, 50, 12, 244, 75, 74, 250, 194, 176, 115, 45, 159, 203, 226, 183, 250, 12, 246, 4}, - }, - StatePath: []byte{12}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode16CID.String(), + Data: chain2_Block32_storageNode16RLP, }, { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{11}, - Key: common.HexToHash("0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"), - Value: []byte{226, 160, 49, 14, 45, 82, 118, 18, 7, 59, 38, 238, 205, 253, 113, 126, 106, 50, 12, 244, 75, 74, 250, 194, 176, 115, 45, 159, 203, 226, 183, 250, 12, 246, 4}, - }, - StatePath: []byte{9}, + BlockNumber: Chain2_Block32_Header.Number.String(), + Key: chain2_Block32_storageNode17CID.String(), + Data: chain2_Block32_storageNode17RLP, + }, +} +var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace", + CID: chain2_Block32_storageNode2CID.String(), + Value: []byte{}, + StateKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0x4e2cec6f4784547e5042a1638086e3188929f34f3c0005f8dec366c96e8195ac", + CID: chain2_Block32_storageNode3CID.String(), + Value: []byte{}, + StateKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0x6aa02a11dd4d2597318b71d493b145ddf6ae0817a9d3947f45d529a6a75f2bef", + CID: chain2_Block32_storageNode4CID.String(), + Value: []byte{}, + StateKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0x8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b", + CID: chain2_Block32_storageNode5CID.String(), + Value: []byte{}, + StateKey: "0x39fc293fc702e42b9c023f094826545db42fc0fdf2ba031bb522d5ef917a6edb'", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0x8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b", + CID: chain2_Block32_storageNode6CID.String(), + Value: []byte{}, + StateKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b", + CID: chain2_Block32_storageNode7CID.String(), + Value: []byte{}, + StateKey: "0x39fc293fc702e42b9c023f094826545db42fc0fdf2ba031bb522d5ef917a6edb'", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b", + CID: chain2_Block32_storageNode8CID.String(), + Value: []byte{}, + StateKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace", + CID: chain2_Block32_storageNode10CID.String(), + Value: []byte{}, + StateKey: "0x39fc293fc702e42b9c023f094826545db42fc0fdf2ba031bb522d5ef917a6edb'", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0x6aa02a11dd4d2597318b71d493b145ddf6ae0817a9d3947f45d529a6a75f2bef", + CID: chain2_Block32_storageNode11CID.String(), + Value: []byte{}, + StateKey: "0x39fc293fc702e42b9c023f094826545db42fc0fdf2ba031bb522d5ef917a6edb'", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563", + CID: chain2_Block32_storageNode14CID.String(), + Value: []byte{}, + StateKey: "0xcabc5edb305583e33f66322ceee43088aa99277da772feb5053512d03a0a702b", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563", + CID: chain2_Block32_storageNode15CID.String(), + Value: []byte{}, + StateKey: "0x9397e33dedda4763aea143fc6151ebcd9a93f62db7a6a556d46c585d82ad2afc", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6", + CID: chain2_Block32_storageNode16CID.String(), + Value: []byte{}, + StateKey: "0xcabc5edb305583e33f66322ceee43088aa99277da772feb5053512d03a0a702b", + }, + { + BlockNumber: Chain2_Block32_Header.Number.String(), + HeaderID: Chain2_Block32_Header.Hash().Hex(), + Diff: false, + Removed: false, + StorageKey: "0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6", + CID: chain2_Block32_storageNode17CID.String(), + Value: []byte{}, + StateKey: "0x9397e33dedda4763aea143fc6151ebcd9a93f62db7a6a556d46c585d82ad2afc", }, } From 382ad927017bbed44cc4832eccec0dd21b3dc05b Mon Sep 17 00:00:00 2001 From: i-norden Date: Wed, 12 Apr 2023 10:16:42 -0500 Subject: [PATCH 05/18] removei in-place snapshot stuff --- fixture/in_place_snapshot.go | 307 ------------------------- pkg/snapshot/in_place_snapshot.go | 61 ----- pkg/snapshot/in_place_snapshot_test.go | 160 ------------- 3 files changed, 528 deletions(-) delete mode 100644 fixture/in_place_snapshot.go delete mode 100644 pkg/snapshot/in_place_snapshot.go delete mode 100644 pkg/snapshot/in_place_snapshot_test.go diff --git a/fixture/in_place_snapshot.go b/fixture/in_place_snapshot.go deleted file mode 100644 index 39c1af4..0000000 --- a/fixture/in_place_snapshot.go +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright © 2022 Vulcanize, Inc -// -// 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 . - -package fixture - -import ( - "math/big" - - snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" -) - -type Block struct { - Hash common.Hash - Number *big.Int - StateNodes []snapt.Node - StorageNodes [][]snapt.Node -} - -var InPlaceSnapshotBlocks = []Block{ - // Genesis block - { - Hash: common.HexToHash("0xe1bdb963128f645aa674b52a8c7ce00704762f27e2a6896abebd7954878f40e4"), - Number: big.NewInt(0), - StateNodes: []snapt.Node{ - // State node for main account with balance. - { - NodeType: 2, - Path: []byte{}, - Key: common.HexToHash("0x67ab3c0dd775f448af7fb41243415ed6fb975d1530a2d828f69bea7346231ad7"), - Value: []byte{248, 119, 161, 32, 103, 171, 60, 13, 215, 117, 244, 72, 175, 127, 180, 18, 67, 65, 94, 214, 251, 151, 93, 21, 48, 162, 216, 40, 246, 155, 234, 115, 70, 35, 26, 215, 184, 83, 248, 81, 128, 141, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 160, 197, 210, 70, 1, 134, 247, 35, 60, 146, 126, 125, 178, 220, 199, 3, 192, 229, 0, 182, 83, 202, 130, 39, 59, 123, 250, 216, 4, 93, 133, 164, 112}, - }, - }, - }, - // Contract Test1 deployed by main account. - { - Hash: common.HexToHash("0x46ce57b700e470d0c0820ede662ecc0d0c78cf87237cb12a40a7ff5ff9cc8ac5"), - Number: big.NewInt(1), - StateNodes: []snapt.Node{ - // Branch root node. - { - NodeType: 0, - Path: []byte{}, - Value: []byte{248, 81, 128, 128, 128, 128, 128, 128, 160, 173, 52, 73, 195, 118, 160, 81, 100, 138, 50, 127, 27, 188, 85, 147, 215, 187, 244, 219, 228, 93, 25, 72, 253, 160, 45, 16, 239, 130, 223, 160, 26, 128, 128, 160, 137, 52, 229, 60, 211, 96, 171, 177, 51, 19, 204, 180, 24, 252, 28, 70, 234, 7, 73, 20, 117, 230, 32, 223, 188, 6, 191, 75, 123, 64, 163, 197, 128, 128, 128, 128, 128, 128, 128}, - }, - // State node for sender account. - { - NodeType: 2, - Path: []byte{6}, - Key: common.HexToHash("0x67ab3c0dd775f448af7fb41243415ed6fb975d1530a2d828f69bea7346231ad7"), - Value: []byte{248, 118, 160, 55, 171, 60, 13, 215, 117, 244, 72, 175, 127, 180, 18, 67, 65, 94, 214, 251, 151, 93, 21, 48, 162, 216, 40, 246, 155, 234, 115, 70, 35, 26, 215, 184, 83, 248, 81, 1, 141, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 160, 197, 210, 70, 1, 134, 247, 35, 60, 146, 126, 125, 178, 220, 199, 3, 192, 229, 0, 182, 83, 202, 130, 39, 59, 123, 250, 216, 4, 93, 133, 164, 112}, - }, - // State node for deployment of contract Test1. - { - NodeType: 2, - Path: []byte{9}, - Key: common.HexToHash("0x9397e33dedda4763aea143fc6151ebcd9a93f62db7a6a556d46c585d82ad2afc"), - Value: []byte{248, 105, 160, 51, 151, 227, 61, 237, 218, 71, 99, 174, 161, 67, 252, 97, 81, 235, 205, 154, 147, 246, 45, 183, 166, 165, 86, 212, 108, 88, 93, 130, 173, 42, 252, 184, 70, 248, 68, 1, 128, 160, 243, 143, 159, 99, 199, 96, 208, 136, 215, 221, 4, 247, 67, 97, 155, 98, 145, 246, 59, 238, 189, 139, 223, 83, 6, 40, 249, 14, 156, 250, 82, 215, 160, 47, 62, 207, 242, 160, 167, 130, 233, 6, 187, 196, 80, 96, 6, 188, 150, 74, 176, 201, 7, 65, 32, 174, 97, 1, 76, 26, 86, 141, 49, 62, 214}, - }, - }, - StorageNodes: [][]snapt.Node{ - {}, - {}, - { - // Storage node for contract Test1 state variable initialCount. - { - NodeType: 2, - Path: []byte{}, - Key: common.HexToHash("0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"), - Value: []byte{227, 161, 32, 177, 14, 45, 82, 118, 18, 7, 59, 38, 238, 205, 253, 113, 126, 106, 50, 12, 244, 75, 74, 250, 194, 176, 115, 45, 159, 203, 226, 183, 250, 12, 246, 1}, - }, - }, - }, - }, - // Contract Test2 deployed by main account. - { - Hash: common.HexToHash("0xa848b156fe4e61d8dac0a833720794e8c58e93fa6db369af6f0d9a19ada9d723"), - Number: big.NewInt(2), - StateNodes: []snapt.Node{ - // Branch root node. - { - NodeType: 0, - Path: []byte{}, - Value: []byte{248, 81, 128, 128, 128, 128, 128, 128, 160, 191, 248, 9, 223, 101, 212, 255, 213, 196, 146, 160, 239, 69, 178, 134, 139, 81, 22, 255, 149, 90, 253, 178, 172, 102, 87, 249, 225, 224, 173, 183, 55, 128, 128, 160, 165, 200, 234, 64, 112, 157, 130, 31, 236, 38, 20, 68, 99, 247, 81, 161, 76, 62, 186, 246, 84, 121, 39, 155, 102, 134, 188, 109, 89, 220, 31, 212, 128, 128, 128, 128, 128, 128, 128}, - }, - // State node for sender account. - { - NodeType: 2, - Path: []byte{6}, - Key: common.HexToHash("0x67ab3c0dd775f448af7fb41243415ed6fb975d1530a2d828f69bea7346231ad7"), - Value: []byte{248, 118, 160, 55, 171, 60, 13, 215, 117, 244, 72, 175, 127, 180, 18, 67, 65, 94, 214, 251, 151, 93, 21, 48, 162, 216, 40, 246, 155, 234, 115, 70, 35, 26, 215, 184, 83, 248, 81, 2, 141, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 160, 197, 210, 70, 1, 134, 247, 35, 60, 146, 126, 125, 178, 220, 199, 3, 192, 229, 0, 182, 83, 202, 130, 39, 59, 123, 250, 216, 4, 93, 133, 164, 112}, - }, - // State node for deployment of contract Test2. - { - NodeType: 2, - Path: []byte{10}, - Key: common.HexToHash("0xa44b5f4b47ded891709350af6a6e4d56602228a70279bdad4f0f64042445b4b9"), - Value: []byte{248, 105, 160, 52, 75, 95, 75, 71, 222, 216, 145, 112, 147, 80, 175, 106, 110, 77, 86, 96, 34, 40, 167, 2, 121, 189, 173, 79, 15, 100, 4, 36, 69, 180, 185, 184, 70, 248, 68, 1, 128, 160, 130, 30, 37, 86, 162, 144, 200, 100, 5, 248, 22, 10, 45, 102, 32, 66, 164, 49, 186, 69, 107, 157, 178, 101, 199, 155, 184, 55, 192, 75, 229, 240, 160, 86, 36, 245, 233, 5, 167, 42, 118, 181, 35, 178, 216, 149, 56, 146, 147, 19, 8, 140, 137, 234, 0, 160, 27, 220, 33, 204, 6, 152, 239, 177, 52}, - }, - }, - StorageNodes: [][]snapt.Node{ - {}, - {}, - { - // Storage node for contract Test2 state variable test. - { - NodeType: 2, - Path: []byte{}, - Key: common.HexToHash("0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563"), - Value: []byte{227, 161, 32, 41, 13, 236, 217, 84, 139, 98, 168, 214, 3, 69, 169, 136, 56, 111, 200, 75, 166, 188, 149, 72, 64, 8, 246, 54, 47, 147, 22, 14, 243, 229, 99, 1}, - }, - }, - }, - }, - // Increment contract Test1 state variable count using main account. - { - Hash: common.HexToHash("0x9fc4aaaab26f0b43ac609c99ae50925e5dc9a25f103c0511fcff38c6b3158302"), - Number: big.NewInt(3), - StateNodes: []snapt.Node{ - // Branch root node. - { - NodeType: 0, - Path: []byte{}, - Value: []byte{248, 113, 128, 128, 128, 128, 128, 128, 160, 70, 53, 190, 199, 124, 254, 86, 213, 42, 126, 117, 155, 2, 223, 56, 167, 130, 118, 10, 150, 65, 46, 207, 169, 167, 250, 209, 64, 37, 205, 153, 51, 128, 128, 160, 165, 200, 234, 64, 112, 157, 130, 31, 236, 38, 20, 68, 99, 247, 81, 161, 76, 62, 186, 246, 84, 121, 39, 155, 102, 134, 188, 109, 89, 220, 31, 212, 128, 128, 160, 214, 109, 199, 206, 145, 11, 213, 44, 206, 214, 36, 181, 134, 92, 243, 178, 58, 88, 158, 42, 31, 125, 71, 148, 188, 122, 252, 100, 250, 182, 85, 159, 128, 128, 128, 128}, - }, - // State node for sender account. - { - NodeType: 2, - Path: []byte{6}, - Key: common.HexToHash("0x67ab3c0dd775f448af7fb41243415ed6fb975d1530a2d828f69bea7346231ad7"), - Value: []byte{248, 118, 160, 55, 171, 60, 13, 215, 117, 244, 72, 175, 127, 180, 18, 67, 65, 94, 214, 251, 151, 93, 21, 48, 162, 216, 40, 246, 155, 234, 115, 70, 35, 26, 215, 184, 83, 248, 81, 3, 141, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 160, 197, 210, 70, 1, 134, 247, 35, 60, 146, 126, 125, 178, 220, 199, 3, 192, 229, 0, 182, 83, 202, 130, 39, 59, 123, 250, 216, 4, 93, 133, 164, 112}, - }, - // State node for contract Test1 transaction. - { - NodeType: 2, - Path: []byte{9}, - Key: common.HexToHash("0x9397e33dedda4763aea143fc6151ebcd9a93f62db7a6a556d46c585d82ad2afc"), - Value: []byte{248, 105, 160, 51, 151, 227, 61, 237, 218, 71, 99, 174, 161, 67, 252, 97, 81, 235, 205, 154, 147, 246, 45, 183, 166, 165, 86, 212, 108, 88, 93, 130, 173, 42, 252, 184, 70, 248, 68, 1, 128, 160, 167, 171, 204, 110, 30, 52, 74, 189, 215, 97, 245, 227, 176, 141, 250, 205, 8, 182, 138, 101, 51, 150, 155, 174, 234, 246, 30, 128, 253, 230, 36, 228, 160, 47, 62, 207, 242, 160, 167, 130, 233, 6, 187, 196, 80, 96, 6, 188, 150, 74, 176, 201, 7, 65, 32, 174, 97, 1, 76, 26, 86, 141, 49, 62, 214}, - }, - }, - StorageNodes: [][]snapt.Node{ - {}, - {}, - { - // Branch root node. - { - NodeType: 0, - Path: []byte{}, - Value: []byte{248, 81, 128, 128, 160, 79, 197, 241, 58, 178, 249, 186, 12, 45, 168, 139, 1, 81, 171, 14, 124, 244, 216, 93, 8, 204, 164, 92, 205, 146, 60, 106, 183, 99, 35, 235, 40, 128, 128, 128, 128, 128, 128, 128, 128, 160, 244, 152, 74, 17, 246, 26, 41, 33, 69, 97, 65, 223, 136, 222, 110, 26, 113, 13, 40, 104, 27, 145, 175, 121, 76, 90, 114, 30, 71, 131, 156, 215, 128, 128, 128, 128, 128}, - }, - // Storage node for contract Test1 state variable count. - { - NodeType: 2, - Path: []byte{2}, - Key: common.HexToHash("0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563"), - Value: []byte{226, 160, 57, 13, 236, 217, 84, 139, 98, 168, 214, 3, 69, 169, 136, 56, 111, 200, 75, 166, 188, 149, 72, 64, 8, 246, 54, 47, 147, 22, 14, 243, 229, 99, 1}, - }, - // Storage node for contract Test1 state variable initialCount. - { - NodeType: 2, - Path: []byte{11}, - Key: common.HexToHash("0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"), - Value: []byte{226, 160, 49, 14, 45, 82, 118, 18, 7, 59, 38, 238, 205, 253, 113, 126, 106, 50, 12, 244, 75, 74, 250, 194, 176, 115, 45, 159, 203, 226, 183, 250, 12, 246, 1}, - }, - }, - }, - }, -} - -// Expected state nodes at snapshot height. -var ExpectedStateNodes = []snapt.Node{ - { - NodeType: 0, - Path: []byte{}, - Value: []byte{248, 113, 128, 128, 128, 128, 128, 128, 160, 70, 53, 190, 199, 124, 254, 86, 213, 42, 126, 117, 155, 2, 223, 56, 167, 130, 118, 10, 150, 65, 46, 207, 169, 167, 250, 209, 64, 37, 205, 153, 51, 128, 128, 160, 165, 200, 234, 64, 112, 157, 130, 31, 236, 38, 20, 68, 99, 247, 81, 161, 76, 62, 186, 246, 84, 121, 39, 155, 102, 134, 188, 109, 89, 220, 31, 212, 128, 128, 160, 214, 109, 199, 206, 145, 11, 213, 44, 206, 214, 36, 181, 134, 92, 243, 178, 58, 88, 158, 42, 31, 125, 71, 148, 188, 122, 252, 100, 250, 182, 85, 159, 128, 128, 128, 128}, - }, - { - NodeType: 2, - Path: []byte{6}, - Key: common.HexToHash("0x67ab3c0dd775f448af7fb41243415ed6fb975d1530a2d828f69bea7346231ad7"), - Value: []byte{248, 118, 160, 55, 171, 60, 13, 215, 117, 244, 72, 175, 127, 180, 18, 67, 65, 94, 214, 251, 151, 93, 21, 48, 162, 216, 40, 246, 155, 234, 115, 70, 35, 26, 215, 184, 83, 248, 81, 3, 141, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 160, 197, 210, 70, 1, 134, 247, 35, 60, 146, 126, 125, 178, 220, 199, 3, 192, 229, 0, 182, 83, 202, 130, 39, 59, 123, 250, 216, 4, 93, 133, 164, 112}, - }, - { - NodeType: 2, - Path: []byte{9}, - Key: common.HexToHash("0x9397e33dedda4763aea143fc6151ebcd9a93f62db7a6a556d46c585d82ad2afc"), - Value: []byte{248, 105, 160, 51, 151, 227, 61, 237, 218, 71, 99, 174, 161, 67, 252, 97, 81, 235, 205, 154, 147, 246, 45, 183, 166, 165, 86, 212, 108, 88, 93, 130, 173, 42, 252, 184, 70, 248, 68, 1, 128, 160, 167, 171, 204, 110, 30, 52, 74, 189, 215, 97, 245, 227, 176, 141, 250, 205, 8, 182, 138, 101, 51, 150, 155, 174, 234, 246, 30, 128, 253, 230, 36, 228, 160, 47, 62, 207, 242, 160, 167, 130, 233, 6, 187, 196, 80, 96, 6, 188, 150, 74, 176, 201, 7, 65, 32, 174, 97, 1, 76, 26, 86, 141, 49, 62, 214}, - }, - { - NodeType: 2, - Path: []byte{10}, - Key: common.HexToHash("0xa44b5f4b47ded891709350af6a6e4d56602228a70279bdad4f0f64042445b4b9"), - Value: []byte{248, 105, 160, 52, 75, 95, 75, 71, 222, 216, 145, 112, 147, 80, 175, 106, 110, 77, 86, 96, 34, 40, 167, 2, 121, 189, 173, 79, 15, 100, 4, 36, 69, 180, 185, 184, 70, 248, 68, 1, 128, 160, 130, 30, 37, 86, 162, 144, 200, 100, 5, 248, 22, 10, 45, 102, 32, 66, 164, 49, 186, 69, 107, 157, 178, 101, 199, 155, 184, 55, 192, 75, 229, 240, 160, 86, 36, 245, 233, 5, 167, 42, 118, 181, 35, 178, 216, 149, 56, 146, 147, 19, 8, 140, 137, 234, 0, 160, 27, 220, 33, 204, 6, 152, 239, 177, 52}, - }, -} - -type StorageNodeWithState struct { - snapt.Node - StatePath []byte -} - -// Expected storage nodes at snapshot height. -var ExpectedStorageNodes = []StorageNodeWithState{ - { - Node: snapt.Node{ - NodeType: 0, - Path: []byte{}, - Value: []byte{248, 81, 128, 128, 160, 79, 197, 241, 58, 178, 249, 186, 12, 45, 168, 139, 1, 81, 171, 14, 124, 244, 216, 93, 8, 204, 164, 92, 205, 146, 60, 106, 183, 99, 35, 235, 40, 128, 128, 128, 128, 128, 128, 128, 128, 160, 244, 152, 74, 17, 246, 26, 41, 33, 69, 97, 65, 223, 136, 222, 110, 26, 113, 13, 40, 104, 27, 145, 175, 121, 76, 90, 114, 30, 71, 131, 156, 215, 128, 128, 128, 128, 128}, - }, - StatePath: []byte{9}, - }, - { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{2}, - Key: common.HexToHash("0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563"), - Value: []byte{226, 160, 57, 13, 236, 217, 84, 139, 98, 168, 214, 3, 69, 169, 136, 56, 111, 200, 75, 166, 188, 149, 72, 64, 8, 246, 54, 47, 147, 22, 14, 243, 229, 99, 1}, - }, - StatePath: []byte{9}, - }, - { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{11}, - Key: common.HexToHash("0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"), - Value: []byte{226, 160, 49, 14, 45, 82, 118, 18, 7, 59, 38, 238, 205, 253, 113, 126, 106, 50, 12, 244, 75, 74, 250, 194, 176, 115, 45, 159, 203, 226, 183, 250, 12, 246, 1}, - }, - StatePath: []byte{9}, - }, - { - Node: snapt.Node{ - NodeType: 2, - Path: []byte{}, - Key: common.HexToHash("0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563"), - Value: []byte{227, 161, 32, 41, 13, 236, 217, 84, 139, 98, 168, 214, 3, 69, 169, 136, 56, 111, 200, 75, 166, 188, 149, 72, 64, 8, 246, 54, 47, 147, 22, 14, 243, 229, 99, 1}, - }, - StatePath: []byte{10}, - }, -} - -// Block header at snapshot height. -// Required in database when executing inPlaceStateSnapshot. -var Block4_Header = types.Header{ - ParentHash: common.HexToHash("0x9fc4aaaab26f0b43ac609c99ae50925e5dc9a25f103c0511fcff38c6b3158302"), - UncleHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"), - Coinbase: common.HexToAddress("0x0000000000000000000000000000000000000000"), - Root: common.HexToHash("0x53580584816f617295ea26c0e17641e0120cab2f0a8ffb53a866fd53aa8e8c2d"), - TxHash: common.HexToHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"), - ReceiptHash: common.HexToHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"), - Bloom: types.Bloom{}, - Difficulty: big.NewInt(+2), - Number: big.NewInt(4), - GasLimit: 4704588, - GasUsed: 0, - Time: 1492010458, - Extra: []byte{215, 131, 1, 6, 0, 132, 103, 101, 116, 104, 135, 103, 111, 49, 46, 55, 46, 51, 133, 108, 105, 110, 117, 120, 0, 0, 0, 0, 0, 0, 0, 0, 159, 30, 250, 30, 250, 114, 175, 19, 140, 145, 89, 102, 198, 57, 84, 74, 2, 85, 230, 40, 142, 24, 140, 34, 206, 145, 104, 193, 13, 190, 70, 218, 61, 136, 180, 170, 6, 89, 48, 17, 159, 184, 134, 33, 11, 240, 26, 8, 79, 222, 93, 59, 196, 141, 138, 163, 139, 202, 146, 228, 252, 197, 33, 81, 0}, - MixDigest: common.Hash{}, - Nonce: types.BlockNonce{}, - BaseFee: nil, -} - -/* -pragma solidity ^0.8.0; - -contract Test1 { - uint256 private count; - uint256 private initialCount; - - event Increment(uint256 count); - - constructor() { - initialCount = 1; - } - - function incrementCount() public returns (uint256) { - count = count + 1; - emit Increment(count); - - return count; - } -} -*/ - -/* -pragma solidity ^0.8.0; - -contract Test2 { - uint256 private test; - - constructor() { - test = 1; - } -} -*/ diff --git a/pkg/snapshot/in_place_snapshot.go b/pkg/snapshot/in_place_snapshot.go deleted file mode 100644 index f05b52d..0000000 --- a/pkg/snapshot/in_place_snapshot.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright © 2022 Vulcanize, Inc -// -// 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 . - -package snapshot - -import ( - . "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" - "github.com/jmoiron/sqlx" - "github.com/sirupsen/logrus" -) - -const ( - stateSnapShotPgStr = "SELECT state_snapshot($1, $2)" - storageSnapShotPgStr = "SELECT storage_snapshot($1, $2)" -) - -type InPlaceSnapshotParams struct { - StartHeight uint64 - EndHeight uint64 -} - -func CreateInPlaceSnapshot(config *Config, params InPlaceSnapshotParams) error { - db, err := sqlx.Connect("postgres", config.DB.ConnConfig.DbConnectionString()) - if err != nil { - return err - } - - tx, err := db.Begin() - if err != nil { - return err - } - - defer func() { - err = CommitOrRollback(tx, err) - if err != nil { - logrus.Errorf("CommitOrRollback failed: %s", err) - } - }() - - if _, err = tx.Exec(stateSnapShotPgStr, params.StartHeight, params.EndHeight); err != nil { - return err - } - - if _, err = tx.Exec(storageSnapShotPgStr, params.StartHeight, params.EndHeight); err != nil { - return err - } - - return nil -} diff --git a/pkg/snapshot/in_place_snapshot_test.go b/pkg/snapshot/in_place_snapshot_test.go deleted file mode 100644 index 740900a..0000000 --- a/pkg/snapshot/in_place_snapshot_test.go +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright © 2022 Vulcanize, Inc -// -// 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 . - -package snapshot - -import ( - "context" - "strconv" - "testing" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres" - "github.com/ethereum/go-ethereum/statediff/indexer/ipld" - "github.com/ethereum/go-ethereum/statediff/indexer/models" - "github.com/ethereum/go-ethereum/statediff/indexer/test_helpers" - "github.com/multiformats/go-multihash" - - fixt "github.com/cerc-io/ipld-eth-state-snapshot/fixture" - "github.com/cerc-io/ipld-eth-state-snapshot/pkg/snapshot/pg" - snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" - "github.com/cerc-io/ipld-eth-state-snapshot/test" -) - -var ( - pgConfig = test.DefaultPgConfig - nodeInfo = test.DefaultNodeInfo - snapshotHeight = 4 - - allTables = []*snapt.Table{ - &snapt.TableIPLDBlock, - &snapt.TableNodeInfo, - &snapt.TableHeader, - &snapt.TableStateNode, - &snapt.TableStorageNode, - } -) - -func writeData(t *testing.T, db *postgres.DB) snapt.Publisher { - pub := pg.NewPublisher(db) - tx, err := pub.BeginTx() - test.NoError(t, err) - - for _, block := range fixt.InPlaceSnapshotBlocks { - headerID := block.Hash.String() - - for _, stateNode := range block.StateNodes { - test.NoError(t, pub.PublishStateNode(&stateNode, headerID, block.Number, tx)) - } - - for index, stateStorageNodes := range block.StorageNodes { - stateNode := block.StateNodes[index] - - for _, storageNode := range stateStorageNodes { - test.NoError(t, pub.PublishStorageNode(&storageNode, headerID, block.Number, stateNode.Path, tx)) - } - } - - } - - test.NoError(t, tx.Commit()) - - test.NoError(t, pub.PublishHeader(&fixt.Block4_Header)) - return pub -} - -func TestCreateInPlaceSnapshot(t *testing.T) { - test.NeedsDB(t) - ctx := context.Background() - driver, err := postgres.NewSQLXDriver(ctx, pgConfig, nodeInfo) - test.NoError(t, err) - db := postgres.NewPostgresDB(driver, false) - - test_helpers.TearDownDB(t, db) - - _ = writeData(t, db) - - params := InPlaceSnapshotParams{StartHeight: uint64(0), EndHeight: uint64(snapshotHeight)} - config := &Config{ - Eth: &EthConfig{ - NodeInfo: test.DefaultNodeInfo, - }, - DB: &DBConfig{ - URI: pgConfig.DbConnectionString(), - ConnConfig: pgConfig, - }, - } - err = CreateInPlaceSnapshot(config, params) - test.NoError(t, err) - - // Check inplace snapshot was created for state_cids - stateNodes := make([]models.StateNodeModel, 0) - pgQueryStateCids := `SELECT cast(state_cids.block_number AS TEXT), state_cids.cid, state_cids.state_leaf_key, state_cids.node_type, state_cids.state_path, state_cids.header_id, state_cids.mh_key - FROM eth.state_cids - WHERE eth.state_cids.block_number = $1 - ORDER BY state_cids.state_path` - err = db.Select(ctx, &stateNodes, pgQueryStateCids, snapshotHeight) - test.NoError(t, err) - test.ExpectEqual(t, 4, len(stateNodes)) - expectedStateNodes := fixt.ExpectedStateNodes - - pgIpfsGet := `SELECT data FROM public.blocks - WHERE key = $1 AND block_number = $2` - - for index, stateNode := range stateNodes { - var data []byte - err = db.Get(ctx, &data, pgIpfsGet, stateNode.MhKey, snapshotHeight) - test.NoError(t, err) - - expectedStateNode := expectedStateNodes[index] - expectedCID, _ := ipld.RawdataToCid(ipld.MEthStateTrie, expectedStateNode.Value, multihash.KECCAK_256) - test.ExpectEqual(t, strconv.Itoa(snapshotHeight), stateNode.BlockNumber) - test.ExpectEqual(t, fixt.Block4_Header.Hash().String(), stateNode.HeaderID) - test.ExpectEqual(t, expectedCID.String(), stateNode.CID) - test.ExpectEqual(t, int(expectedStateNode.NodeType), stateNode.NodeType) - test.ExpectEqual(t, expectedStateNode.Key, common.HexToHash(stateNode.StateKey)) - test.ExpectEqual(t, false, stateNode.Diff) - test.ExpectEqualBytes(t, expectedStateNode.Path, stateNode.Path) - test.ExpectEqualBytes(t, expectedStateNode.Value, data) - } - - // Check inplace snapshot was created for storage_cids - storageNodes := make([]models.StorageNodeModel, 0) - pgQueryStorageCids := `SELECT cast(storage_cids.block_number AS TEXT), storage_cids.cid, storage_cids.state_path, storage_cids.storage_leaf_key, storage_cids.node_type, storage_cids.storage_path, storage_cids.mh_key, storage_cids.header_id - FROM eth.storage_cids - WHERE eth.storage_cids.block_number = $1 - ORDER BY storage_cids.state_path, storage_cids.storage_path` - err = db.Select(ctx, &storageNodes, pgQueryStorageCids, snapshotHeight) - test.NoError(t, err) - - for index, storageNode := range storageNodes { - expectedStorageNode := fixt.ExpectedStorageNodes[index] - expectedStorageCID, _ := ipld.RawdataToCid(ipld.MEthStorageTrie, expectedStorageNode.Value, multihash.KECCAK_256) - - test.ExpectEqual(t, strconv.Itoa(snapshotHeight), storageNode.BlockNumber) - test.ExpectEqual(t, fixt.Block4_Header.Hash().String(), storageNode.HeaderID) - test.ExpectEqual(t, expectedStorageCID.String(), storageNode.CID) - test.ExpectEqual(t, int(expectedStorageNode.NodeType), storageNode.NodeType) - test.ExpectEqual(t, expectedStorageNode.Key, common.HexToHash(storageNode.StorageKey)) - test.ExpectEqual(t, expectedStorageNode.StatePath, storageNode.StatePath) - test.ExpectEqual(t, expectedStorageNode.Path, storageNode.Path) - test.ExpectEqual(t, false, storageNode.Diff) - - var data []byte - err = db.Get(ctx, &data, pgIpfsGet, storageNode.MhKey, snapshotHeight) - test.NoError(t, err) - test.ExpectEqualBytes(t, expectedStorageNode.Value, data) - } -} From 22ecd4065ad2ba34b6d5f0c71847f33fc993280c Mon Sep 17 00:00:00 2001 From: i-norden Date: Wed, 12 Apr 2023 13:07:42 -0500 Subject: [PATCH 06/18] update service --- pkg/snapshot/file/publisher.go | 4 +- pkg/snapshot/file/publisher_test.go | 19 +- pkg/snapshot/pg/publisher.go | 4 +- pkg/snapshot/pg/publisher_test.go | 18 +- pkg/snapshot/service.go | 347 ++++++++++++++++------------ pkg/snapshot/util.go | 2 +- 6 files changed, 230 insertions(+), 164 deletions(-) diff --git a/pkg/snapshot/file/publisher.go b/pkg/snapshot/file/publisher.go index 943d18f..5604100 100644 --- a/pkg/snapshot/file/publisher.go +++ b/pkg/snapshot/file/publisher.go @@ -229,7 +229,7 @@ func (p *publisher) PublishStateLeafNode(stateNode *models.StateNodeModel, snapT stateNode.HeaderID, stateNode.StateKey, stateNode.CID, - true, + false, stateNode.Balance, strconv.FormatUint(stateNode.Nonce, 10), stateNode.CodeHash, @@ -257,7 +257,7 @@ func (p *publisher) PublishStorageLeafNode(storageNode *models.StorageNodeModel, storageNode.StateKey, storageNode.StorageKey, storageNode.CID, - true, + false, storageNode.Value, false) if err != nil { diff --git a/pkg/snapshot/file/publisher_test.go b/pkg/snapshot/file/publisher_test.go index 0575aa0..1f2d8a1 100644 --- a/pkg/snapshot/file/publisher_test.go +++ b/pkg/snapshot/file/publisher_test.go @@ -9,12 +9,13 @@ import ( "path/filepath" "testing" + "github.com/ethereum/go-ethereum/statediff/indexer/shared/schema" + "github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres" "github.com/ethereum/go-ethereum/statediff/indexer/ipld" "github.com/ethereum/go-ethereum/statediff/indexer/test_helpers" fixt "github.com/cerc-io/ipld-eth-state-snapshot/fixture" - snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" "github.com/cerc-io/ipld-eth-state-snapshot/test" ) @@ -22,12 +23,12 @@ var ( pgConfig = test.DefaultPgConfig nodeInfo = test.DefaultNodeInfo // tables ordered according to fkey depedencies - allTables = []*snapt.Table{ - &snapt.TableIPLDBlock, - &snapt.TableNodeInfo, - &snapt.TableHeader, - &snapt.TableStateNode, - &snapt.TableStorageNode, + allTables = []*schema.Table{ + &schema.TableIPLDBlock, + &schema.TableNodeInfo, + &schema.TableHeader, + &schema.TableStateNode, + &schema.TableStorageNode, } ) @@ -39,7 +40,7 @@ func writeFiles(t *testing.T, dir string) *publisher { test.NoError(t, err) headerID := fixt.Block1_Header.Hash().String() - test.NoError(t, pub.PublishStateNode(&fixt.Block1_StateNode0, headerID, fixt.Block1_Header.Number, tx)) + test.NoError(t, pub.PublishStateLeafNode(&fixt.Block1_StateNode0, headerID, fixt.Block1_Header.Number, tx)) test.NoError(t, tx.Commit()) return pub @@ -47,7 +48,7 @@ func writeFiles(t *testing.T, dir string) *publisher { // verify that we can parse the csvs // TODO check actual data -func verifyFileData(t *testing.T, path string, tbl *snapt.Table) { +func verifyFileData(t *testing.T, path string, tbl *schema.Table) { file, err := os.Open(path) test.NoError(t, err) r := csv.NewReader(file) diff --git a/pkg/snapshot/pg/publisher.go b/pkg/snapshot/pg/publisher.go index d3ce792..7378e09 100644 --- a/pkg/snapshot/pg/publisher.go +++ b/pkg/snapshot/pg/publisher.go @@ -160,7 +160,7 @@ func (p *publisher) PublishStateLeafNode(stateNode *models.StateNodeModel, snapT stateNode.HeaderID, stateNode.StateKey, stateNode.CID, - true, + false, stateNode.Balance, stateNode.Nonce, stateNode.CodeHash, @@ -187,7 +187,7 @@ func (p *publisher) PublishStorageLeafNode(storageNode *models.StorageNodeModel, storageNode.StateKey, storageNode.StorageKey, storageNode.CID, - true, + false, storageNode.Value, false) if err != nil { diff --git a/pkg/snapshot/pg/publisher_test.go b/pkg/snapshot/pg/publisher_test.go index 25c1290..d084bf4 100644 --- a/pkg/snapshot/pg/publisher_test.go +++ b/pkg/snapshot/pg/publisher_test.go @@ -4,12 +4,13 @@ import ( "context" "testing" + "github.com/ethereum/go-ethereum/statediff/indexer/shared/schema" + "github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres" "github.com/ethereum/go-ethereum/statediff/indexer/ipld" "github.com/ethereum/go-ethereum/statediff/indexer/test_helpers" fixt "github.com/cerc-io/ipld-eth-state-snapshot/fixture" - snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" "github.com/cerc-io/ipld-eth-state-snapshot/test" ) @@ -17,12 +18,12 @@ var ( pgConfig = test.DefaultPgConfig nodeInfo = test.DefaultNodeInfo // tables ordered according to fkey depedencies - allTables = []*snapt.Table{ - &snapt.TableIPLDBlock, - &snapt.TableNodeInfo, - &snapt.TableHeader, - &snapt.TableStateNode, - &snapt.TableStorageNode, + allTables = []*schema.Table{ + &schema.TableIPLDBlock, + &schema.TableNodeInfo, + &schema.TableHeader, + &schema.TableStateNode, + &schema.TableStorageNode, } ) @@ -33,7 +34,8 @@ func writeData(t *testing.T, db *postgres.DB) *publisher { test.NoError(t, err) headerID := fixt.Block1_Header.Hash().String() - test.NoError(t, pub.PublishStateNode(&fixt.Block1_StateNode0, headerID, fixt.Block1_Header.Number, tx)) + stateNode := &fixt.Block1_StateNode0 + test.NoError(t, pub.PublishStateLeafNode(&fixt.Block1_StateNode0, headerID, fixt.Block1_Header.Number, tx)) test.NoError(t, tx.Commit()) return pub diff --git a/pkg/snapshot/service.go b/pkg/snapshot/service.go index 302a673..4053961 100644 --- a/pkg/snapshot/service.go +++ b/pkg/snapshot/service.go @@ -29,6 +29,8 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/rlp" + "github.com/ethereum/go-ethereum/statediff/indexer/ipld" + "github.com/ethereum/go-ethereum/statediff/indexer/models" "github.com/ethereum/go-ethereum/trie" iter "github.com/ethereum/go-ethereum/trie/concurrent_iterator" log "github.com/sirupsen/logrus" @@ -164,7 +166,7 @@ func (s *Service) CreateSnapshot(params SnapshotParams) error { } } -// Create snapshot up to head (ignores height param) +// CreateLatestSnapshot snapshot at head (ignores height param) func (s *Service) CreateLatestSnapshot(workers uint, watchedAddresses map[common.Address]struct{}) error { log.Info("Creating snapshot at head") hash := rawdb.ReadHeadHeaderHash(s.ethDB) @@ -175,54 +177,20 @@ func (s *Service) CreateLatestSnapshot(workers uint, watchedAddresses map[common return s.CreateSnapshot(SnapshotParams{Height: *height, Workers: workers, WatchedAddresses: watchedAddresses}) } -type nodeResult struct { - node Node - elements []interface{} -} - -func resolveNode(nodePath []byte, it trie.NodeIterator, trieDB *trie.Database) (*nodeResult, error) { - // "leaf" nodes are actually "value" nodes, whose parents are the actual leaves - if it.Leaf() { - return nil, nil - } - if IsNullHash(it.Hash()) { - return nil, nil +// Full-trie concurrent snapshot +func (s *Service) createSnapshotAsync(ctx context.Context, iters []trie.NodeIterator, headerID string, height *big.Int, seekingPaths [][]byte) error { + // use errgroup with a context to stop all concurrent iterators if one runs into an error + // each concurrent iterator completes processing it's current node before stopping + g, ctx := errgroup.WithContext(ctx) + for _, it := range iters { + func(it trie.NodeIterator) { + g.Go(func() error { + return s.createSnapshot(ctx, it, headerID, height, seekingPaths) + }) + }(it) } - // use full node path - // (it.Path() will give partial path in case of subtrie iterators) - path := make([]byte, len(nodePath)) - copy(path, nodePath) - n, err := trieDB.Node(it.Hash()) - if err != nil { - return nil, err - } - var elements []interface{} - if err := rlp.DecodeBytes(n, &elements); err != nil { - return nil, err - } - ty, err := CheckKeyType(elements) - if err != nil { - return nil, err - } - return &nodeResult{ - node: Node{ - NodeType: ty, - Path: path, - Value: n, - }, - elements: elements, - }, nil -} - -// validPath checks if a path is prefix to any one of the paths in the given list -func validPath(currentPath []byte, seekingPaths [][]byte) bool { - for _, seekingPath := range seekingPaths { - if bytes.HasPrefix(seekingPath, currentPath) { - return true - } - } - return false + return g.Wait() } // createSnapshot performs traversal using the given iterator and indexes the nodes @@ -264,7 +232,8 @@ func (s *Service) createSnapshot(ctx context.Context, it trie.NodeIterator, head // createSubTrieSnapshot processes nodes at the next level of a trie using the given subtrie iterator // continually updating seekedPath with path of the latest processed node -func (s *Service) createSubTrieSnapshot(ctx context.Context, tx Tx, prefixPath []byte, subTrieIt trie.NodeIterator, recoveredPath []byte, seekedPath *[]byte, endPath []byte, headerID string, height *big.Int, seekingPaths [][]byte) error { +func (s *Service) createSubTrieSnapshot(ctx context.Context, tx Tx, prefixPath []byte, subTrieIt trie.NodeIterator, + recoveredPath []byte, seekedPath *[]byte, endPath []byte, headerID string, height *big.Int, seekingPaths [][]byte) error { prom.IncActiveIterCount() defer prom.DecActiveIterCount() @@ -288,7 +257,7 @@ func (s *Service) createSubTrieSnapshot(ctx context.Context, tx Tx, prefixPath [ // if node path is empty and prefix is nil, it's the root node if prefixPath == nil { // create snapshot of node, if it is a leaf this will also create snapshot of entire storage trie - if err := s.createNodeSnapshot(tx, subTrieIt.Path(), subTrieIt, headerID, height); err != nil { + if err := s.createNodeSnapshot(tx, subTrieIt, headerID, height, seekingPaths); err != nil { return err } updateSeekedPath(seekedPath, subTrieIt.Path()) @@ -338,7 +307,7 @@ func (s *Service) createSubTrieSnapshot(ctx context.Context, tx Tx, prefixPath [ // if the node is along paths of interest // create snapshot of node, if it is a leaf this will also create snapshot of entire storage trie - if err := s.createNodeSnapshot(tx, nodePath, subTrieIt, headerID, height); err != nil { + if err := s.createNodeSnapshot(tx, subTrieIt, headerID, height, seekingPaths); err != nil { return err } // update seeked path after node has been processed @@ -389,83 +358,123 @@ func (s *Service) createSubTrieIt(prefixPath []byte, hash common.Hash, recovered // createNodeSnapshot indexes the current node // entire storage trie is also indexed (if available) -func (s *Service) createNodeSnapshot(tx Tx, path []byte, it trie.NodeIterator, headerID string, height *big.Int) error { - res, err := resolveNode(path, it, s.stateDB.TrieDB()) - if err != nil { - return err - } - if res == nil { - return nil - } - - tx, err = s.ipfsPublisher.PrepareTxForBatch(tx, s.maxBatchSize) +func (s *Service) createNodeSnapshot(tx Tx, it trie.NodeIterator, headerID string, height *big.Int, watchedAddressesLeafPaths [][]byte) error { + tx, err := s.ipfsPublisher.PrepareTxForBatch(tx, s.maxBatchSize) if err != nil { return err } - switch res.node.NodeType { - case Leaf: - // if the node is a leaf, decode the account and publish the associated storage trie - // nodes if there are any - var account types.StateAccount - if err := rlp.DecodeBytes(res.elements[1].([]byte), &account); err != nil { - return fmt.Errorf( - "error decoding account for leaf node at path %x nerror: %v", res.node.Path, err) - } - partialPath := trie.CompactToHex(res.elements[0].([]byte)) - valueNodePath := append(res.node.Path, partialPath...) - encodedPath := trie.HexToCompact(valueNodePath) - leafKey := encodedPath[1:] - res.node.Key = common.BytesToHash(leafKey) - if err := s.ipfsPublisher.PublishStateNode(&res.node, headerID, height, tx); err != nil { + // index values by leaf key + if it.Leaf() { + // if it is a "value" node, we will index the value by leaf key + // publish codehash => code mappings + // take storage snapshot + if err := s.processStateValueNode(it, headerID, height, watchedAddressesLeafPaths, tx); err != nil { return err } - - // publish any non-nil code referenced by codehash - if !bytes.Equal(account.CodeHash, emptyCodeHash) { - codeHash := common.BytesToHash(account.CodeHash) - codeBytes := rawdb.ReadCode(s.ethDB, codeHash) - if len(codeBytes) == 0 { - log.Error("Code is missing", "account", common.BytesToHash(it.LeafKey())) - return errors.New("missing code") - } - - if err = s.ipfsPublisher.PublishCode(height, codeHash, codeBytes, tx); err != nil { + } else { // trie nodes will be written to blockstore only + // reminder that this includes leaf nodes, since the geth iterator.Leaf() actually signifies a "value" node + // so this is also where we publish the IPLD block corresponding to the "value" nodes indexed above + if IsNullHash(it.Hash()) { + // skip null node + return nil + } + nodeVal := make([]byte, len(it.NodeBlob())) + copy(nodeVal, it.NodeBlob()) + if len(watchedAddressesLeafPaths) > 0 { + var elements []interface{} + if err := rlp.DecodeBytes(nodeVal, &elements); err != nil { return err } + ok, err := isLeaf(elements) + if err != nil { + return err + } + if ok { + nodePath := make([]byte, len(it.Path())) + copy(nodePath, it.Path()) + partialPath := trie.CompactToHex(elements[0].([]byte)) + valueNodePath := append(nodePath, partialPath...) + if !isWatchedAddress(watchedAddressesLeafPaths, valueNodePath) { + // skip this node + return nil + } + } } - - if _, err = s.storageSnapshot(account.Root, headerID, height, res.node.Path, tx); err != nil { - return fmt.Errorf("failed building storage snapshot for account %+v\r\nerror: %w", account, err) - } - case Extension, Branch: - res.node.Key = common.BytesToHash([]byte{}) - if err := s.ipfsPublisher.PublishStateNode(&res.node, headerID, height, tx); err != nil { + nodeHash := make([]byte, len(it.Hash().Bytes())) + copy(nodeHash, it.Hash().Bytes()) + if _, err := s.ipfsPublisher.PublishIPLD(ipld.Keccak256ToCid(ipld.MEthStateTrie, nodeHash), nodeVal, height, tx); err != nil { return err } - default: - return errors.New("unexpected node type") } + return it.Error() } -// Full-trie concurrent snapshot -func (s *Service) createSnapshotAsync(ctx context.Context, iters []trie.NodeIterator, headerID string, height *big.Int, seekingPaths [][]byte) error { - // use errgroup with a context to stop all concurrent iterators if one runs into an error - // each concurrent iterator completes processing it's current node before stopping - g, ctx := errgroup.WithContext(ctx) - for _, it := range iters { - func(it trie.NodeIterator) { - g.Go(func() error { - return s.createSnapshot(ctx, it, headerID, height, seekingPaths) - }) - }(it) +// reminder: it.Leaf() == true when the iterator is positioned at a "value node" which is not something that actually exists in an MMPT +func (s *Service) processStateValueNode(it trie.NodeIterator, headerID string, height *big.Int, + watchedAddressesLeafPaths [][]byte, tx Tx) error { + // skip if it is not a watched address + // If we aren't watching any specific addresses, we are watching everything + if len(watchedAddressesLeafPaths) > 0 && !isWatchedAddress(watchedAddressesLeafPaths, it.Path()) { + return nil } - return g.Wait() + // created vs updated is important for leaf nodes since we need to diff their storage + // so we need to map all changed accounts at B to their leafkey, since account can change pathes but not leafkey + var account types.StateAccount + accountRLP := make([]byte, len(it.LeafBlob())) + copy(accountRLP, it.LeafBlob()) + if err := rlp.DecodeBytes(accountRLP, &account); err != nil { + return fmt.Errorf("error decoding account for leaf value at leaf key %x\nerror: %v", it.LeafKey(), err) + } + leafKey := make([]byte, len(it.LeafKey())) + copy(leafKey, it.LeafKey()) + + // write codehash => code mappings if we have a contract + if !bytes.Equal(account.CodeHash, emptyCodeHash) { + codeHash := common.BytesToHash(account.CodeHash) + code, err := s.stateDB.ContractCode(common.Hash{}, codeHash) + if err != nil { + return fmt.Errorf("failed to retrieve code for codehash %s\r\n error: %v", codeHash.String(), err) + } + if _, err := s.ipfsPublisher.PublishIPLD(ipld.Keccak256ToCid(ipld.RawBinary, codeHash.Bytes()), code, height, tx); err != nil { + return err + } + } + + // since this is a "value node", we need to move up to the "parent" node which is the actual leaf node + // it should be in the fastcache since it necessarily was recently accessed to reach the current node + parentNodeRLP, err := s.stateDB.TrieDB().Node(it.Parent()) + if err != nil { + return err + } + // publish the state leaf model + stateKeyStr := common.BytesToHash(leafKey).String() + stateLeafNodeModel := &models.StateNodeModel{ + BlockNumber: height.String(), + HeaderID: headerID, + StateKey: stateKeyStr, + Removed: false, + CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(parentNodeRLP)).String(), + Diff: false, + Balance: account.Balance.String(), + Nonce: account.Nonce, + CodeHash: common.BytesToHash(account.CodeHash).String(), + StorageRoot: account.Root.String(), + } + if err := s.ipfsPublisher.PublishStateLeafNode(stateLeafNodeModel, tx); err != nil { + return fmt.Errorf("failed publishing state leaf node for leaf key %s\r\nerror: %w", stateKeyStr, err) + } + // create storage snapshot + // this short circuits if storage is empty + if _, err := s.storageSnapshot(account.Root, stateKeyStr, headerID, height, tx); err != nil { + return fmt.Errorf("failed building storage snapshot for account %+v\r\nerror: %w", account, err) + } + return nil } -func (s *Service) storageSnapshot(sr common.Hash, headerID string, height *big.Int, statePath []byte, tx Tx) (Tx, error) { +func (s *Service) storageSnapshot(sr common.Hash, stateKey, headerID string, height *big.Int, tx Tx) (Tx, error) { if bytes.Equal(sr.Bytes(), emptyContractRoot.Bytes()) { return tx, nil } @@ -477,42 +486,96 @@ func (s *Service) storageSnapshot(sr common.Hash, headerID string, height *big.I it := sTrie.NodeIterator(make([]byte, 0)) for it.Next(true) { - res, err := resolveNode(it.Path(), it, s.stateDB.TrieDB()) - if err != nil { - return nil, err - } - if res == nil { - continue - } - - tx, err = s.ipfsPublisher.PrepareTxForBatch(tx, s.maxBatchSize) - if err != nil { - return nil, err - } - - var nodeData []byte - nodeData, err = s.stateDB.TrieDB().Node(it.Hash()) - if err != nil { - return nil, err - } - res.node.Value = nodeData - - switch res.node.NodeType { - case Leaf: - partialPath := trie.CompactToHex(res.elements[0].([]byte)) - valueNodePath := append(res.node.Path, partialPath...) - encodedPath := trie.HexToCompact(valueNodePath) - leafKey := encodedPath[1:] - res.node.Key = common.BytesToHash(leafKey) - case Extension, Branch: - res.node.Key = common.BytesToHash([]byte{}) - default: - return nil, errors.New("unexpected node type") - } - if err = s.ipfsPublisher.PublishStorageNode(&res.node, headerID, height, statePath, tx); err != nil { - return nil, err + if it.Leaf() { + if err := s.processStorageValueNode(it, stateKey, headerID, height, tx); err != nil { + return nil, err + } + } else { + nodeVal := make([]byte, len(it.NodeBlob())) + copy(nodeVal, it.NodeBlob()) + nodeHash := make([]byte, len(it.Hash().Bytes())) + copy(nodeHash, it.Hash().Bytes()) + if _, err := s.ipfsPublisher.PublishIPLD(ipld.Keccak256ToCid(ipld.MEthStorageTrie, nodeHash), nodeVal, height, tx); err != nil { + return nil, err + } } } return tx, it.Error() } + +// reminder: it.Leaf() == true when the iterator is positioned at a "value node" which is not something that actually exists in an MMPT +func (s *Service) processStorageValueNode(it trie.NodeIterator, stateKey, headerID string, height *big.Int, tx Tx) error { + // skip if it is not a watched address + leafKey := make([]byte, len(it.LeafKey())) + copy(leafKey, it.LeafKey()) + value := make([]byte, len(it.LeafBlob())) + copy(value, it.LeafBlob()) + + // since this is a "value node", we need to move up to the "parent" node which is the actual leaf node + // it should be in the fastcache since it necessarily was recently accessed to reach the current node + parentNodeRLP, err := s.stateDB.TrieDB().Node(it.Parent()) + if err != nil { + return err + } + + // publish storage leaf node model + storageLeafKeyStr := common.BytesToHash(leafKey).String() + storageLeafNodeModel := &models.StorageNodeModel{ + BlockNumber: height.String(), + HeaderID: headerID, + StateKey: stateKey, + StorageKey: storageLeafKeyStr, + Removed: false, + CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(parentNodeRLP)).String(), + Diff: false, + Value: value, + } + if err := s.ipfsPublisher.PublishStorageLeafNode(storageLeafNodeModel, tx); err != nil { + return fmt.Errorf("failed to publish storage leaf node for state leaf key %s and storage leaf key %s\r\nerr: %w", stateKey, storageLeafKeyStr, err) + } + return nil +} + +// validPath checks if a path is prefix to any one of the paths in the given list +func validPath(currentPath []byte, seekingPaths [][]byte) bool { + for _, seekingPath := range seekingPaths { + if bytes.HasPrefix(seekingPath, currentPath) { + return true + } + } + return false +} + +// isWatchedAddress is used to check if a state account corresponds to one of the addresses the builder is configured to watch +func isWatchedAddress(watchedAddressesLeafPaths [][]byte, valueNodePath []byte) bool { + for _, watchedAddressPath := range watchedAddressesLeafPaths { + if bytes.Equal(watchedAddressPath, valueNodePath) { + return true + } + } + + return false +} + +// isLeaf checks if the node we are at is a leaf +func isLeaf(elements []interface{}) (bool, error) { + if len(elements) > 2 { + return false, nil + } + if len(elements) < 2 { + return false, fmt.Errorf("node cannot be less than two elements in length") + } + switch elements[0].([]byte)[0] / 16 { + case '\x00': + return false, nil + case '\x01': + return false, nil + case '\x02': + return true, nil + case '\x03': + return true, nil + default: + return false, fmt.Errorf("unknown hex prefix") + } +} diff --git a/pkg/snapshot/util.go b/pkg/snapshot/util.go index 19a4881..7e9556a 100644 --- a/pkg/snapshot/util.go +++ b/pkg/snapshot/util.go @@ -9,7 +9,7 @@ import ( "github.com/cerc-io/ipld-eth-state-snapshot/pkg/prom" file "github.com/cerc-io/ipld-eth-state-snapshot/pkg/snapshot/file" - pg "github.com/cerc-io/ipld-eth-state-snapshot/pkg/snapshot/pg" + "github.com/cerc-io/ipld-eth-state-snapshot/pkg/snapshot/pg" snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" ) From 4245b80a4a20130f1dfa55b5a3eaeab47332c5ff Mon Sep 17 00:00:00 2001 From: i-norden Date: Wed, 12 Apr 2023 13:07:55 -0500 Subject: [PATCH 07/18] go mod tidy --- go.mod | 31 +++------- go.sum | 178 ++++----------------------------------------------------- 2 files changed, 19 insertions(+), 190 deletions(-) diff --git a/go.mod b/go.mod index 34ae9b7..e5d53e8 100644 --- a/go.mod +++ b/go.mod @@ -6,9 +6,7 @@ require ( github.com/ethereum/go-ethereum v1.11.5 github.com/golang/mock v1.6.0 github.com/ipfs/go-cid v0.2.0 - github.com/ipfs/go-ipfs-blockstore v1.2.0 - github.com/ipfs/go-ipfs-ds-help v1.1.0 - github.com/jmoiron/sqlx v1.3.5 + github.com/lib/pq v1.10.7 github.com/multiformats/go-multihash v0.1.0 github.com/prometheus/client_golang v1.14.0 github.com/sirupsen/logrus v1.9.0 @@ -31,28 +29,18 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/georgysavva/scany v1.2.1 // indirect - github.com/getsentry/sentry-go v0.17.0 // indirect + github.com/getsentry/sentry-go v0.18.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect - github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/ipfs/bbloom v0.0.4 // indirect - github.com/ipfs/go-block-format v0.0.3 // indirect - github.com/ipfs/go-datastore v0.5.1 // indirect - github.com/ipfs/go-ipfs-util v0.0.2 // indirect - github.com/ipfs/go-ipld-format v0.4.0 // indirect - github.com/ipfs/go-log v1.0.5 // indirect - github.com/ipfs/go-log/v2 v2.4.0 // indirect - github.com/ipfs/go-metrics-interface v0.0.1 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.11.0 // indirect github.com/jackc/pgio v1.0.0 // indirect @@ -62,14 +50,12 @@ require ( github.com/jackc/pgtype v1.10.0 // indirect github.com/jackc/pgx/v4 v4.15.0 // indirect github.com/jackc/puddle v1.2.1 // indirect - github.com/jbenet/goprocess v0.1.4 // indirect + github.com/jmoiron/sqlx v1.3.5 // indirect github.com/klauspost/compress v1.15.15 // indirect github.com/klauspost/cpuid/v2 v2.0.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/lib/pq v1.10.7 // indirect github.com/magiconair/properties v1.8.6 // indirect - github.com/mattn/go-isatty v0.0.16 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect @@ -81,15 +67,15 @@ require ( github.com/multiformats/go-multibase v0.0.3 // indirect github.com/multiformats/go-varint v0.0.6 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.37.1 // indirect + github.com/prometheus/common v0.39.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect + github.com/shopspring/decimal v1.2.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.8.2 // indirect github.com/spf13/cast v1.5.0 // indirect @@ -97,13 +83,10 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.3.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect + github.com/thoas/go-funk v0.9.2 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/goleak v1.1.11 // indirect - go.uber.org/multierr v1.7.0 // indirect - go.uber.org/zap v1.19.1 // indirect golang.org/x/crypto v0.6.0 // indirect golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect golang.org/x/sys v0.5.0 // indirect @@ -116,4 +99,4 @@ require ( lukechampine.com/blake3 v1.1.7 // indirect ) -replace github.com/ethereum/go-ethereum v1.11.5 => github.com/cerc-io/go-ethereum v1.11.5-statediff-4.3.9-alpha +replace github.com/ethereum/go-ethereum v1.11.5 => github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.1-alpha diff --git a/go.sum b/go.sum index 9dcc29e..0978d82 100644 --- a/go.sum +++ b/go.sum @@ -49,29 +49,19 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cerc-io/go-ethereum v1.11.5-statediff-4.3.9-alpha h1:nzy/bUmzq8ImRIxchClNoO7Bytom8ETDuOFHzuHFBXs= -github.com/cerc-io/go-ethereum v1.11.5-statediff-4.3.9-alpha/go.mod h1:Q4LXiMcJCctVW1uoIuF59VRCW1W+zrc5GkewoARwAmk= +github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.1-alpha h1:x9muuG0Z2W/UAkwAq+0SXhYG9MCP6SJlGEfFNQa6JPI= +github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.1-alpha/go.mod h1:DIk2wFexjyzvyjuzSOtBEIAPRNZTnLXNbIHEyq1Igek= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -144,8 +134,8 @@ github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqG github.com/georgysavva/scany v1.2.1 h1:91PAMBpwBtDjvn46TaLQmuVhxpAG6p6sjQaU4zPHPSM= github.com/georgysavva/scany v1.2.1/go.mod h1:vGBpL5XRLOocMFFa55pj0P04DrL3I7qKVRL49K6Eu5o= github.com/getsentry/sentry-go v0.12.0/go.mod h1:NSap0JBYWzHND8oMbyi0+XZhUalc1TBdRL1M71JZW2c= -github.com/getsentry/sentry-go v0.17.0 h1:UustVWnOoDFHBS7IJUB2QK/nB5pap748ZEp0swnQJak= -github.com/getsentry/sentry-go v0.17.0/go.mod h1:B82dxtBvxG0KaPD8/hfSV+VcHD+Lg/xUS4JuQn1P4cM= +github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= +github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= @@ -154,20 +144,14 @@ github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxI github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= @@ -182,9 +166,7 @@ github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPh github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= @@ -255,10 +237,8 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= @@ -266,15 +246,10 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= @@ -289,41 +264,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1: github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= -github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-block-format v0.0.3 h1:r8t66QstRp/pd/or4dpnbVfXT5Gt7lOqRvC+/dDTpMc= -github.com/ipfs/go-block-format v0.0.3/go.mod h1:4LmD4ZUw0mhO+JSKdpWwrzATiEfM7WWgQ8H5l6P8MVk= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= -github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= github.com/ipfs/go-cid v0.2.0 h1:01JTiihFq9en9Vz0lc0VDWvZe/uBonGpzo4THP0vcQ0= github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro= -github.com/ipfs/go-datastore v0.5.0/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk= -github.com/ipfs/go-datastore v0.5.1 h1:WkRhLuISI+XPD0uk3OskB0fYFSyqK8Ob5ZYew9Qa1nQ= -github.com/ipfs/go-datastore v0.5.1/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ipfs-blockstore v1.2.0 h1:n3WTeJ4LdICWs/0VSfjHrlqpPpl6MZ+ySd3j8qz0ykw= -github.com/ipfs/go-ipfs-blockstore v1.2.0/go.mod h1:eh8eTFLiINYNSNawfZOC7HOxNTxpB1PFuA5E1m/7exE= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-ds-help v1.1.0 h1:yLE2w9RAsl31LtfMt91tRZcrx+e61O5mDxFRR994w4Q= -github.com/ipfs/go-ipfs-ds-help v1.1.0/go.mod h1:YR5+6EaebOhfcqVCyqemItCLthrpVNot+rsOU/5IatU= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= -github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= -github.com/ipfs/go-ipld-format v0.3.0/go.mod h1:co/SdBE8h99968X0hViiw1MNlh6fvxxnHpvVLnH7jSM= -github.com/ipfs/go-ipld-format v0.4.0 h1:yqJSaJftjmjc9jEOFYlpkwOLVKv68OD27jFLlSghBlQ= -github.com/ipfs/go-ipld-format v0.4.0/go.mod h1:co/SdBE8h99968X0hViiw1MNlh6fvxxnHpvVLnH7jSM= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= -github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo= -github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= -github.com/ipfs/go-log/v2 v2.4.0 h1:iR/2o9PGWanVJrBgIH5Ff8mPGOwpqLaPIAFqSnsdlzk= -github.com/ipfs/go-log/v2 v2.4.0/go.mod h1:nPZnh7Cj7lwS3LpRU5Mwr2ol1c2gXIEXuF6aywqrtmo= -github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= -github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7UaeZTSWddIk= @@ -393,32 +335,22 @@ github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dv github.com/jackc/puddle v1.2.1 h1:gI8os0wpRXFd4FiAY2dWiqRK037tjj3t7rKFeO4X5iw= github.com/jackc/puddle v1.2.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= -github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jmoiron/sqlx v1.3.1/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ= github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8= github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYbq3UhfoFmE= github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= @@ -431,11 +363,8 @@ github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBF github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -471,21 +400,17 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -497,10 +422,8 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= @@ -508,19 +431,12 @@ github.com/multiformats/go-base32 v0.0.4 h1:+qMh4a2f37b4xTNs6mqitDinryCI+tfO2dRV github.com/multiformats/go-base32 v0.0.4/go.mod h1:jNLFzjPZtp3aIARHbJRZIaPuspdH0J6q39uUM5pnABM= github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= -github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= github.com/multiformats/go-multihash v0.1.0 h1:CgAgwqk3//SVEw3T+6DqI4mWMyRuDwZtOWcJT0q9+EA= github.com/multiformats/go-multihash v0.1.0/go.mod h1:RJlXsxt6vHGaia+S8We0ErjhojtKzPP2AH4+kYM7k84= -github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= @@ -542,49 +458,28 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= -github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= -github.com/pganalyze/pg_query_go/v2 v2.2.0 h1:OW+reH+ZY7jdEuPyuLGlf1m7dLbE+fDudKXhLs0Ttpk= +github.com/pganalyze/pg_query_go/v2 v2.1.0 h1:donwPZ4G/X+kMs7j5eYtKjdziqyOLVp3pkUrzb9lDl8= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.37.1 h1:pYY6b5sGXqEB0WwcRGAoVGKbxVthy9qF17R4gbHZVe0= -github.com/prometheus/common v0.37.1/go.mod h1:jEuMeTn4pKGSAxwr7rXtOD70GeY0ERpt0d9FkKf9sK4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/common v0.39.0 h1:oOyhkDq05hPZKItWVBkJ6g6AtGxi+fy7F4JvUV8uhsI= +github.com/prometheus/common v0.39.0/go.mod h1:6XBZ7lYdLCbkAVhwRsWTZn+IN5AB9F/NXd5w0BbEX0Y= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -611,10 +506,8 @@ github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhr github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -658,7 +551,8 @@ github.com/subosito/gotenv v1.3.0 h1:mjC+YW8QpAdXibNi+vNWgzmgBH4+5l5dCXv8cNysBLI github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= -github.com/thoas/go-funk v0.9.3 h1:7+nAEx3kn5ZJcnDm2Bh23N2yOtweO14bi//dvRtgLpw= +github.com/thoas/go-funk v0.9.2 h1:oKlNYv0AY5nyf9g+/GhMgS/UO2ces0QRdPKwkhY3VCk= +github.com/thoas/go-funk v0.9.2/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q= github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms= @@ -675,7 +569,6 @@ github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBn github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= @@ -690,7 +583,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= @@ -704,33 +596,18 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= -go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= -go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= -go.uber.org/zap v1.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI= -go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -785,22 +662,18 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -828,13 +701,9 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -845,8 +714,6 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -858,16 +725,13 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -889,7 +753,6 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -903,8 +766,6 @@ golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -913,7 +774,6 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -922,29 +782,23 @@ golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -954,7 +808,6 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -962,7 +815,6 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220922220347-f3bd1da661af h1:Yx9k8YCG3dvF87UAn2tu2HQLf2dt/eR1bXxpLMWeH+Y= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1023,8 +875,6 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1128,11 +978,10 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= @@ -1146,11 +995,8 @@ gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7 gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= From 0a04baab17e79969737e13f9e631e57fe22632c8 Mon Sep 17 00:00:00 2001 From: i-norden Date: Wed, 12 Apr 2023 13:08:06 -0500 Subject: [PATCH 08/18] bump db version in docker compose --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 525066b..19e04fc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: restart: on-failure depends_on: - ipld-eth-db - image: git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:v4.2.3-alpha + image: git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:v5.0.1-alpha environment: DATABASE_USER: "vdbm" DATABASE_NAME: "vulcanize_testing" From 4ee75a33719d072f309a1d21cf97e609af4c7c83 Mon Sep 17 00:00:00 2001 From: i-norden Date: Wed, 10 May 2023 13:11:12 -0500 Subject: [PATCH 09/18] update publisher interface --- cmd/inplaceStateSnapshot.go | 63 ----- fixture/leaf_keys.go | 5 + fixture/node_paths.go | 359 ---------------------------- pkg/snapshot/file/publisher.go | 37 +-- pkg/snapshot/file/publisher_test.go | 3 +- pkg/snapshot/pg/publisher.go | 38 +-- pkg/snapshot/pg/publisher_test.go | 4 +- pkg/types/publisher.go | 4 +- 8 files changed, 16 insertions(+), 497 deletions(-) delete mode 100644 cmd/inplaceStateSnapshot.go create mode 100644 fixture/leaf_keys.go delete mode 100644 fixture/node_paths.go diff --git a/cmd/inplaceStateSnapshot.go b/cmd/inplaceStateSnapshot.go deleted file mode 100644 index 8ea28ff..0000000 --- a/cmd/inplaceStateSnapshot.go +++ /dev/null @@ -1,63 +0,0 @@ -// VulcanizeDB -// Copyright © 2022 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 . - -package cmd - -import ( - "github.com/sirupsen/logrus" - "github.com/spf13/cobra" - "github.com/spf13/viper" - - "github.com/cerc-io/ipld-eth-state-snapshot/pkg/snapshot" -) - -// inPlaceStateSnapshotCmd represents the inPlaceStateSnapshot command -var inPlaceStateSnapshotCmd = &cobra.Command{ - Use: "inPlaceStateSnapshot", - Short: "Take an in-place state snapshot in the database", - Long: `Usage: - - ./ipld-eth-state-snapshot inPlaceStateSnapshot --config={path to toml config file}`, - Run: func(cmd *cobra.Command, args []string) { - subCommand = cmd.CalledAs() - logWithCommand = *logrus.WithField("SubCommand", subCommand) - inPlaceStateSnapshot() - }, -} - -func inPlaceStateSnapshot() { - config := snapshot.NewInPlaceSnapshotConfig() - - startHeight := viper.GetUint64(snapshot.SNAPSHOT_START_HEIGHT_TOML) - endHeight := viper.GetUint64(snapshot.SNAPSHOT_END_HEIGHT_TOML) - - params := snapshot.InPlaceSnapshotParams{StartHeight: uint64(startHeight), EndHeight: uint64(endHeight)} - if err := snapshot.CreateInPlaceSnapshot(config, params); err != nil { - logWithCommand.Fatal(err) - } - - logWithCommand.Infof("snapshot taken at height %d starting from height %d", endHeight, startHeight) -} - -func init() { - rootCmd.AddCommand(inPlaceStateSnapshotCmd) - - inPlaceStateSnapshotCmd.PersistentFlags().String(snapshot.SNAPSHOT_START_HEIGHT_CLI, "", "start block height for in-place snapshot") - inPlaceStateSnapshotCmd.PersistentFlags().String(snapshot.SNAPSHOT_END_HEIGHT_CLI, "", "end block height for in-place snapshot") - - viper.BindPFlag(snapshot.SNAPSHOT_START_HEIGHT_TOML, inPlaceStateSnapshotCmd.PersistentFlags().Lookup(snapshot.SNAPSHOT_START_HEIGHT_CLI)) - viper.BindPFlag(snapshot.SNAPSHOT_END_HEIGHT_TOML, inPlaceStateSnapshotCmd.PersistentFlags().Lookup(snapshot.SNAPSHOT_END_HEIGHT_CLI)) -} diff --git a/fixture/leaf_keys.go b/fixture/leaf_keys.go new file mode 100644 index 0000000..3e3c244 --- /dev/null +++ b/fixture/leaf_keys.go @@ -0,0 +1,5 @@ +package fixture + +var Block1_StateNodeLeafKeys = [][]byte{ + +} diff --git a/fixture/node_paths.go b/fixture/node_paths.go deleted file mode 100644 index 34f2023..0000000 --- a/fixture/node_paths.go +++ /dev/null @@ -1,359 +0,0 @@ -package fixture - -var Block1_StateNodePaths = [][]byte{ - []byte{}, - []byte{0}, - []byte{0, 0}, - []byte{0, 2}, - []byte{0, 2, 1}, - []byte{0, 2, 8}, - []byte{0, 2, 12}, - []byte{0, 3}, - []byte{0, 4}, - []byte{0, 6}, - []byte{0, 6, 3}, - []byte{0, 6, 13}, - []byte{0, 7}, - []byte{0, 8}, - []byte{0, 8, 7}, - []byte{0, 8, 11}, - []byte{0, 9}, - []byte{0, 9, 9}, - []byte{0, 9, 10}, - []byte{0, 12}, - []byte{0, 13}, - []byte{0, 14}, - []byte{1}, - []byte{1, 2}, - []byte{1, 2, 5}, - []byte{1, 2, 7}, - []byte{1, 3}, - []byte{1, 3, 1}, - []byte{1, 3, 11}, - []byte{1, 4}, - []byte{1, 5}, - []byte{1, 5, 11}, - []byte{1, 5, 12}, - []byte{1, 5, 15}, - []byte{1, 6}, - []byte{1, 8}, - []byte{1, 10}, - []byte{1, 13}, - []byte{1, 14}, - []byte{1, 14, 2}, - []byte{1, 14, 11}, - []byte{1, 15}, - []byte{1, 15, 9}, - []byte{1, 15, 15}, - []byte{2}, - []byte{2, 0}, - []byte{2, 0, 9}, - []byte{2, 0, 14}, - []byte{2, 1}, - []byte{2, 1, 1}, - []byte{2, 1, 3}, - []byte{2, 1, 14}, - []byte{2, 5}, - []byte{2, 6}, - []byte{2, 9}, - []byte{2, 9, 1}, - []byte{2, 9, 7}, - []byte{2, 11}, - []byte{2, 11, 7}, - []byte{2, 11, 13}, - []byte{2, 13}, - []byte{2, 13, 1}, - []byte{2, 13, 15}, - []byte{2, 15}, - []byte{3}, - []byte{3, 0}, - []byte{3, 0, 0}, - []byte{3, 0, 1}, - []byte{3, 2}, - []byte{3, 2, 3}, - []byte{3, 2, 15}, - []byte{3, 3}, - []byte{3, 4}, - []byte{3, 4, 2}, - []byte{3, 4, 4}, - []byte{3, 4, 5}, - []byte{3, 6}, - []byte{3, 8}, - []byte{3, 9}, - []byte{3, 10}, - []byte{3, 10, 2}, - []byte{3, 10, 8}, - []byte{3, 10, 12}, - []byte{3, 11}, - []byte{3, 12}, - []byte{3, 13}, - []byte{3, 14}, - []byte{3, 14, 4}, - []byte{3, 14, 9}, - []byte{3, 14, 14}, - []byte{3, 14, 14, 10}, - []byte{3, 14, 14, 15}, - []byte{4}, - []byte{4, 0}, - []byte{4, 0, 6}, - []byte{4, 0, 15}, - []byte{4, 1}, - []byte{4, 2}, - []byte{4, 2, 1}, - []byte{4, 2, 11}, - []byte{4, 3}, - []byte{4, 5}, - []byte{4, 6}, - []byte{4, 7}, - []byte{4, 8}, - []byte{4, 11}, - []byte{4, 11, 6}, - []byte{4, 11, 9}, - []byte{4, 11, 12}, - []byte{4, 14}, - []byte{5}, - []byte{5, 0}, - []byte{5, 0, 3}, - []byte{5, 0, 9}, - []byte{5, 0, 15}, - []byte{5, 1}, - []byte{5, 1, 14}, - []byte{5, 1, 15}, - []byte{5, 2}, - []byte{5, 2, 8}, - []byte{5, 2, 10}, - []byte{5, 3}, - []byte{5, 4}, - []byte{5, 4, 6}, - []byte{5, 4, 12}, - []byte{5, 6}, - []byte{5, 8}, - []byte{5, 8, 3}, - []byte{5, 8, 11}, - []byte{5, 10}, - []byte{5, 11}, - []byte{5, 12}, - []byte{5, 13}, - []byte{5, 15}, - []byte{6}, - []byte{6, 0}, - []byte{6, 2}, - []byte{6, 2, 3}, - []byte{6, 2, 9}, - []byte{6, 4}, - []byte{6, 4, 0}, - []byte{6, 4, 0, 0}, - []byte{6, 4, 0, 5}, - []byte{6, 5}, - []byte{6, 5, 4}, - []byte{6, 5, 10}, - []byte{6, 5, 12}, - []byte{6, 5, 13}, - []byte{6, 6}, - []byte{6, 6, 0}, - []byte{6, 6, 8}, - []byte{6, 8}, - []byte{6, 8, 4}, - []byte{6, 8, 4, 2}, - []byte{6, 8, 4, 9}, - []byte{6, 8, 9}, - []byte{6, 10}, - []byte{6, 10, 1}, - []byte{6, 10, 14}, - []byte{6, 11}, - []byte{6, 11, 2}, - []byte{6, 11, 12}, - []byte{6, 11, 14}, - []byte{6, 13}, - []byte{6, 13, 2}, - []byte{6, 13, 12}, - []byte{7}, - []byte{7, 1}, - []byte{7, 5}, - []byte{7, 7}, - []byte{7, 8}, - []byte{7, 8, 2}, - []byte{7, 8, 5}, - []byte{7, 9}, - []byte{7, 13}, - []byte{7, 13, 1}, - []byte{7, 13, 1, 0}, - []byte{7, 13, 1, 13}, - []byte{7, 13, 7}, - []byte{7, 14}, - []byte{7, 14, 8}, - []byte{7, 14, 11}, - []byte{8}, - []byte{8, 0}, - []byte{8, 0, 3}, - []byte{8, 0, 11}, - []byte{8, 2}, - []byte{8, 4}, - []byte{8, 8}, - []byte{8, 9}, - []byte{8, 9, 3}, - []byte{8, 9, 13}, - []byte{8, 10}, - []byte{8, 12}, - []byte{8, 12, 3}, - []byte{8, 12, 15}, - []byte{8, 13}, - []byte{8, 15}, - []byte{8, 15, 8}, - []byte{8, 15, 13}, - []byte{9}, - []byte{9, 0}, - []byte{9, 5}, - []byte{9, 6}, - []byte{9, 6, 10}, - []byte{9, 6, 14}, - []byte{9, 7}, - []byte{9, 9}, - []byte{9, 14}, - []byte{9, 15}, - []byte{9, 15, 0}, - []byte{9, 15, 4}, - []byte{9, 15, 10}, - []byte{10}, - []byte{10, 0}, - []byte{10, 0, 9}, - []byte{10, 0, 10}, - []byte{10, 0, 15}, - []byte{10, 2}, - []byte{10, 3}, - []byte{10, 6}, - []byte{10, 8}, - []byte{10, 9}, - []byte{10, 10}, - []byte{10, 10, 5}, - []byte{10, 10, 8}, - []byte{10, 13}, - []byte{10, 13, 0}, - []byte{10, 13, 13}, - []byte{10, 14}, - []byte{10, 14, 4}, - []byte{10, 14, 11}, - []byte{10, 14, 11, 8}, - []byte{10, 14, 11, 14}, - []byte{10, 15}, - []byte{11}, - []byte{11, 0}, - []byte{11, 0, 2}, - []byte{11, 0, 15}, - []byte{11, 1}, - []byte{11, 2}, - []byte{11, 3}, - []byte{11, 4}, - []byte{11, 5}, - []byte{11, 7}, - []byte{11, 7, 12}, - []byte{11, 7, 15}, - []byte{11, 8}, - []byte{11, 8, 8}, - []byte{11, 8, 15}, - []byte{11, 9}, - []byte{11, 11}, - []byte{11, 12}, - []byte{11, 13}, - []byte{11, 14}, - []byte{11, 14, 0}, - []byte{11, 14, 0, 1}, - []byte{11, 14, 0, 3}, - []byte{11, 14, 8}, - []byte{11, 14, 13}, - []byte{12}, - []byte{12, 0}, - []byte{12, 0, 0}, - []byte{12, 0, 1}, - []byte{12, 0, 1, 3}, - []byte{12, 0, 1, 11}, - []byte{12, 0, 15}, - []byte{12, 2}, - []byte{12, 2, 9}, - []byte{12, 2, 12}, - []byte{12, 4}, - []byte{12, 5}, - []byte{12, 6}, - []byte{12, 6, 0}, - []byte{12, 6, 4}, - []byte{12, 6, 14}, - []byte{12, 7}, - []byte{12, 7, 0}, - []byte{12, 7, 12}, - []byte{12, 7, 13}, - []byte{12, 9}, - []byte{12, 11}, - []byte{12, 12}, - []byte{13}, - []byte{13, 2}, - []byte{13, 2, 0}, - []byte{13, 2, 2}, - []byte{13, 2, 4}, - []byte{13, 3}, - []byte{13, 3, 7}, - []byte{13, 3, 10}, - []byte{13, 5}, - []byte{13, 8}, - []byte{13, 8, 1}, - []byte{13, 8, 15}, - []byte{13, 9}, - []byte{13, 9, 0}, - []byte{13, 9, 14}, - []byte{13, 10}, - []byte{13, 12}, - []byte{13, 12, 8}, - []byte{13, 12, 11}, - []byte{13, 13}, - []byte{13, 13, 7}, - []byte{13, 13, 12}, - []byte{13, 14}, - []byte{14}, - []byte{14, 0}, - []byte{14, 1}, - []byte{14, 2}, - []byte{14, 2, 2}, - []byte{14, 2, 12}, - []byte{14, 3}, - []byte{14, 4}, - []byte{14, 5}, - []byte{14, 6}, - []byte{14, 6, 9}, - []byte{14, 6, 12}, - []byte{14, 7}, - []byte{14, 7, 4}, - []byte{14, 7, 12}, - []byte{14, 8}, - []byte{14, 8, 3}, - []byte{14, 8, 12}, - []byte{14, 8, 12, 0}, - []byte{14, 8, 12, 6}, - []byte{14, 10}, - []byte{14, 10, 6}, - []byte{14, 10, 12}, - []byte{14, 11}, - []byte{14, 11, 8}, - []byte{14, 11, 13}, - []byte{14, 12}, - []byte{14, 14}, - []byte{14, 14, 3}, - []byte{14, 14, 9}, - []byte{15}, - []byte{15, 0}, - []byte{15, 5}, - []byte{15, 6}, - []byte{15, 9}, - []byte{15, 9, 0}, - []byte{15, 9, 2}, - []byte{15, 9, 3}, - []byte{15, 11}, - []byte{15, 11, 1}, - []byte{15, 11, 6}, - []byte{15, 12}, - []byte{15, 12, 3}, - []byte{15, 12, 14}, - []byte{15, 12, 14, 7}, - []byte{15, 12, 14, 13}, - []byte{15, 13}, - []byte{15, 14}, - []byte{15, 15}, -} diff --git a/pkg/snapshot/file/publisher.go b/pkg/snapshot/file/publisher.go index 5604100..8a77325 100644 --- a/pkg/snapshot/file/publisher.go +++ b/pkg/snapshot/file/publisher.go @@ -28,10 +28,8 @@ import ( "github.com/lib/pq" "github.com/ipfs/go-cid" - "github.com/multiformats/go-multihash" "github.com/sirupsen/logrus" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/statediff/indexer/ipld" "github.com/ethereum/go-ethereum/statediff/indexer/models" @@ -162,23 +160,12 @@ func (p *publisher) BeginTx() (snapt.Tx, error) { return fileTx{writers}, nil } -// PublishRaw derives a cid from raw bytes and provided codec and multihash type, and writes it to the db tx -// returns the CID -func (tx fileWriters) publishRaw(codec uint64, raw []byte, height *big.Int) (cid string, err error) { - c, err := ipld.RawdataToCid(codec, raw, multihash.KECCAK_256) - if err != nil { - return - } - cid = c.String() - return tx.publishIPLD(c, raw, height) -} - -func (tx fileWriters) publishIPLD(c cid.Cid, raw []byte, height *big.Int) (string, error) { - return c.String(), tx.write(&schema.TableIPLDBlock, height.String(), c.String(), raw) +func (tx fileWriters) publishIPLD(c cid.Cid, raw []byte, height *big.Int) error { + return tx.write(&schema.TableIPLDBlock, height.String(), c.String(), raw) } // PublishIPLD writes an IPLD to the ipld.blocks blockstore -func (p *publisher) PublishIPLD(c cid.Cid, raw []byte, height *big.Int, snapTx snapt.Tx) (string, error) { +func (p *publisher) PublishIPLD(c cid.Cid, raw []byte, height *big.Int, snapTx snapt.Tx) error { tx := snapTx.(fileTx) return tx.publishIPLD(c, raw, height) } @@ -190,7 +177,7 @@ func (p *publisher) PublishHeader(header *types.Header) error { if err != nil { return err } - if _, err = p.writers.publishIPLD(headerNode.Cid(), headerNode.RawData(), header.Number); err != nil { + if err := p.writers.publishIPLD(headerNode.Cid(), headerNode.RawData(), header.Number); err != nil { return err } @@ -272,22 +259,6 @@ func (p *publisher) PublishStorageLeafNode(storageNode *models.StorageNodeModel, return nil } -// PublishCode writes code to the ipfs backing pg datastore -func (p *publisher) PublishCode(height *big.Int, codeHash common.Hash, codeBytes []byte, snapTx snapt.Tx) error { - c := ipld.Keccak256ToCid(ipld.RawBinary, codeHash.Bytes()) - - tx := snapTx.(fileTx) - if _, err := tx.publishIPLD(c, codeBytes, height); err != nil { - return err - } - // increment code node counter. - atomic.AddUint64(&p.codeNodeCounter, 1) - prom.IncCodeNodeCount() - - p.currBatchSize++ - return nil -} - func (p *publisher) PrepareTxForBatch(tx snapt.Tx, maxBatchSize uint) (snapt.Tx, error) { return tx, nil } diff --git a/pkg/snapshot/file/publisher_test.go b/pkg/snapshot/file/publisher_test.go index 1f2d8a1..69541e6 100644 --- a/pkg/snapshot/file/publisher_test.go +++ b/pkg/snapshot/file/publisher_test.go @@ -39,8 +39,7 @@ func writeFiles(t *testing.T, dir string) *publisher { tx, err := pub.BeginTx() test.NoError(t, err) - headerID := fixt.Block1_Header.Hash().String() - test.NoError(t, pub.PublishStateLeafNode(&fixt.Block1_StateNode0, headerID, fixt.Block1_Header.Number, tx)) + test.NoError(t, pub.PublishStateLeafNode(&fixt.Block1_StateNode0, tx)) test.NoError(t, tx.Commit()) return pub diff --git a/pkg/snapshot/pg/publisher.go b/pkg/snapshot/pg/publisher.go index 7378e09..b928934 100644 --- a/pkg/snapshot/pg/publisher.go +++ b/pkg/snapshot/pg/publisher.go @@ -24,11 +24,9 @@ import ( "github.com/ipfs/go-cid" "github.com/lib/pq" - "github.com/multiformats/go-multihash" "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/statediff/indexer/database/sql" "github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres" @@ -89,24 +87,13 @@ func (p *publisher) BeginTx() (snapt.Tx, error) { }}, nil } -// PublishRaw derives a cid from raw bytes and provided codec and multihash type, and writes it to the db tx -// returns the CID -func (tx pubTx) publishRaw(codec uint64, raw []byte, height *big.Int) (cid string, err error) { - c, err := ipld.RawdataToCid(codec, raw, multihash.KECCAK_256) - if err != nil { - return - } - cid = c.String() - return tx.publishIPLD(c, raw, height) -} - -func (tx pubTx) publishIPLD(c cid.Cid, raw []byte, height *big.Int) (string, error) { +func (tx pubTx) publishIPLD(c cid.Cid, raw []byte, height *big.Int) error { _, err := tx.Exec(schema.TableIPLDBlock.ToInsertStatement(false), height.Uint64(), c.String(), raw) - return c.String(), err + return err } // PublishIPLD writes an IPLD to the ipld.blocks blockstore -func (p *publisher) PublishIPLD(c cid.Cid, raw []byte, height *big.Int, snapTx snapt.Tx) (string, error) { +func (p *publisher) PublishIPLD(c cid.Cid, raw []byte, height *big.Int, snapTx snapt.Tx) error { tx := snapTx.(pubTx) return tx.publishIPLD(c, raw, height) } @@ -130,7 +117,7 @@ func (p *publisher) PublishHeader(header *types.Header) (err error) { } }() - if _, err = tx.publishIPLD(headerNode.Cid(), headerNode.RawData(), header.Number); err != nil { + if err := tx.publishIPLD(headerNode.Cid(), headerNode.RawData(), header.Number); err != nil { return err } @@ -202,23 +189,6 @@ func (p *publisher) PublishStorageLeafNode(storageNode *models.StorageNodeModel, return err } -// PublishCode writes code to the ipfs backing pg datastore -func (p *publisher) PublishCode(height *big.Int, codeHash common.Hash, codeBytes []byte, snapTx snapt.Tx) error { - c := ipld.Keccak256ToCid(ipld.RawBinary, codeHash.Bytes()) - - tx := snapTx.(pubTx) - if _, err := tx.publishIPLD(c, codeBytes, height); err != nil { - return err - } - - // increment code node counter. - atomic.AddUint64(&p.codeNodeCounter, 1) - prom.IncCodeNodeCount() - - p.currBatchSize++ - return nil -} - func (p *publisher) PrepareTxForBatch(tx snapt.Tx, maxBatchSize uint) (snapt.Tx, error) { var err error // maximum batch size reached, commit the current transaction and begin a new transaction. diff --git a/pkg/snapshot/pg/publisher_test.go b/pkg/snapshot/pg/publisher_test.go index d084bf4..5f44ea4 100644 --- a/pkg/snapshot/pg/publisher_test.go +++ b/pkg/snapshot/pg/publisher_test.go @@ -33,9 +33,7 @@ func writeData(t *testing.T, db *postgres.DB) *publisher { tx, err := pub.BeginTx() test.NoError(t, err) - headerID := fixt.Block1_Header.Hash().String() - stateNode := &fixt.Block1_StateNode0 - test.NoError(t, pub.PublishStateLeafNode(&fixt.Block1_StateNode0, headerID, fixt.Block1_Header.Number, tx)) + test.NoError(t, pub.PublishStateLeafNode(&fixt.Block1_StateNode0, tx)) test.NoError(t, tx.Commit()) return pub diff --git a/pkg/types/publisher.go b/pkg/types/publisher.go index f34fc32..679cca3 100644 --- a/pkg/types/publisher.go +++ b/pkg/types/publisher.go @@ -6,7 +6,6 @@ import ( "github.com/ethereum/go-ethereum/statediff/indexer/models" "github.com/ipfs/go-cid" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -14,8 +13,7 @@ type Publisher interface { PublishHeader(header *types.Header) error PublishStateLeafNode(node *models.StateNodeModel, tx Tx) error PublishStorageLeafNode(node *models.StorageNodeModel, tx Tx) error - PublishCode(height *big.Int, codeHash common.Hash, codeBytes []byte, tx Tx) error - PublishIPLD(c cid.Cid, raw []byte, height *big.Int, tx Tx) (string, error) + PublishIPLD(c cid.Cid, raw []byte, height *big.Int, tx Tx) error BeginTx() (Tx, error) PrepareTxForBatch(tx Tx, batchSize uint) (Tx, error) } From 32b637671dd589a3652a9ebb0c7ba544308d8b65 Mon Sep 17 00:00:00 2001 From: i-norden Date: Wed, 10 May 2023 13:11:23 -0500 Subject: [PATCH 10/18] use v5.0.2 statediffing geth --- go.mod | 4 ++-- go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index e5d53e8..9978868 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ require ( github.com/golang/mock v1.6.0 github.com/ipfs/go-cid v0.2.0 github.com/lib/pq v1.10.7 - github.com/multiformats/go-multihash v0.1.0 github.com/prometheus/client_golang v1.14.0 github.com/sirupsen/logrus v1.9.0 github.com/spf13/cobra v1.5.0 @@ -65,6 +64,7 @@ require ( github.com/multiformats/go-base32 v0.0.4 // indirect github.com/multiformats/go-base36 v0.1.0 // indirect github.com/multiformats/go-multibase v0.0.3 // indirect + github.com/multiformats/go-multihash v0.1.0 // indirect github.com/multiformats/go-varint v0.0.6 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml v1.9.5 // indirect @@ -99,4 +99,4 @@ require ( lukechampine.com/blake3 v1.1.7 // indirect ) -replace github.com/ethereum/go-ethereum v1.11.5 => github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.1-alpha +replace github.com/ethereum/go-ethereum v1.11.5 => github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.2-alpha diff --git a/go.sum b/go.sum index 0978d82..e81f6fa 100644 --- a/go.sum +++ b/go.sum @@ -59,8 +59,8 @@ github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPx github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.1-alpha h1:x9muuG0Z2W/UAkwAq+0SXhYG9MCP6SJlGEfFNQa6JPI= -github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.1-alpha/go.mod h1:DIk2wFexjyzvyjuzSOtBEIAPRNZTnLXNbIHEyq1Igek= +github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.2-alpha h1:QFr7avu0VLqVWowBvYtsFVVM4MukrXpWFhoAXWVEFHA= +github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.2-alpha/go.mod h1:DIk2wFexjyzvyjuzSOtBEIAPRNZTnLXNbIHEyq1Igek= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= From fdb105b769d278bec6adba08c7defac0aa164e57 Mon Sep 17 00:00:00 2001 From: i-norden Date: Wed, 10 May 2023 13:11:42 -0500 Subject: [PATCH 11/18] update compose --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 19e04fc..efab53b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: image: git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:v5.0.1-alpha environment: DATABASE_USER: "vdbm" - DATABASE_NAME: "vulcanize_testing" + DATABASE_NAME: "cerc_testing" DATABASE_PASSWORD: "password" DATABASE_HOSTNAME: "ipld-eth-db" DATABASE_PORT: 5432 @@ -19,7 +19,7 @@ services: command: ["postgres", "-c", "log_statement=all"] environment: POSTGRES_USER: "vdbm" - POSTGRES_DB: "vulcanize_testing" + POSTGRES_DB: "cerc_testing" POSTGRES_PASSWORD: "password" ports: - "127.0.0.1:8077:5432" From 3d8064ccbbda368d075703fd3bae28236256e762 Mon Sep 17 00:00:00 2001 From: i-norden Date: Fri, 12 May 2023 09:58:46 -0500 Subject: [PATCH 12/18] finish updating test fixtures --- fixture/leaf_keys.go | 263 ++++++++++++++++++++++++++++++++++++++++++- fixture/service.go | 118 +++++++++---------- 2 files changed, 320 insertions(+), 61 deletions(-) diff --git a/fixture/leaf_keys.go b/fixture/leaf_keys.go index 3e3c244..8fcd4c1 100644 --- a/fixture/leaf_keys.go +++ b/fixture/leaf_keys.go @@ -1,5 +1,264 @@ package fixture -var Block1_StateNodeLeafKeys = [][]byte{ - +var Block1_StateNodeLeafKeys = []string{ + "0x291b6bbca879d684337ee5e2bca5d18cfb2d3b7a97c8187e703309564280295e", + "0x021fe3360ba8c02e194f8e7facdeb9088b3cf433b6498bd6900d50df0266ffe3", + "0x7820b41394d7f30f2b02f24f8a33afe8b98cd68827ec651aec3ba33e41206fe2", + "0xf908d785cef1abc9fcea55c07490d16b4825e8a6a7c8fb157ed2900bf4af58b9", + "0xd207b05b684ba18361df8e81e846d10365ffcf04f7840403c5bacf77add4c50f", + "0x5037b71f063bfe647233f570aa06602b1e6b5124db0b1fe998975f93b0fb1084", + "0xb02c4d58a3800d93f95f2eb4850b3d242756bf1ca3099bc43907af6dff0bf337", + "0x300d2dbe83a6ba7fd75737c8d7453d984e7938ba7ae113d3da2ad7433061157b", + "0x80382280e2f4a8ea9001c8e22332a3dc3d3a692b549d3c90f65796270e1eb770", + "0x087fb108e6836a088e06156b1a26210d1f5284296b30b0bb0b3d1c2a7e01ac11", + "0x71a3c7f8d0fe8abc9fbab1860ad576eddff2144763937195ea4f012fc625b053", + "0xb8864cb7c6215e99ffe5db7b22b3129e93b9a38b9b54193a0e3d7c8251657173", + "0x881a506039e25a818f35aa0e3ec58c64df5c106245dc25ef6fa4cf1eb1aab56a", + "0x40637a529320dace54763c2e6ac52c522c8a446ba9b6f54daf84c0e442124b93", + "0xa092c3f36135f79c57aa5683d97e5d5750c37d0bd0ada215e9a96856c56d7e91", + "0x684272547bac4c083b7380f054d08a5030862a5f06a2367f3b8e880c4b7370ed", + "0x18dcd435bf7d1820085f6c46d587cae669ca7c2d3ad4cea9db320a0b3c8bd21d", + "0xc00c28a6bfe2829613432a2c21eefc25da5bad983c5430ca28bc1a92d2b65ec5", + "0xf03db4f61547c9d8c58b4f37f84f74eff767c24cf81b957662e96622f2ac4d19", + "0x38401b4e97e67c4a6d8095979b4c1ecb9eaf5726fc8a12798975a7653e980872", + "0x992470b3e52c94f7bd5d4962a1798a41425bea74ad087a7f53aebb785401df3d", + "0xe015d2e4c085291611298460602b913b5f19272715fcaa48258efe24cf21885e", + "0x2092b5602121cc484fa55b90cea0be17d931184263925a864e0d5d43a20d67b0", + "0xe83c2c56f351d8c25863a55ece938ffcb6cdf2978eb34ea1a19591884d3885f3", + "0x489fe686547f4a999d2818aedbc18b735ed2cd502c30124a0b8af861b2251f91", + "0x90b0d289ea211dca8e020c9cc8c5d6ba2f416fe15fa692b47184a4b946b2214d", + "0x6042501054831920bc9d50a33d6be1b5a8214c31ba9416958f8996cdb6ddb05c", + "0x125adc67efe8bf6808c02bd3ae20262953b5e45dab4eb9386441cf6ec7381844", + "0xd81c5d559ba870e90a2b617cf0542695e9a626619b59148b40295a0ba55ca66e", + "0x5839262442bd87bdce9bcd8e97628a84fd07aaf55ba8c4c29e1ae91cb17cb222", + "0xa876da518a393dbd067dc72abfa08d475ed6447fca96d92ec3f9e7eba503ca61", + "0xc93e183a9dd09cdd44ca2a9eb6b94f970f8fa309b0f9cfd823572c23aad58fb2", + "0x75422a3d36c93fcbccad2e502775226f375e264e35fc55ac20df1e9f050e8b8c", + "0x20ebfef43639215aeb35e1e00bc96174f52155afb781659f34628d1f3f7ae018", + "0x20ebfef43639215aeb35e1e00bc96174f52155afb781659f34628d1f3f7ae018", + "0x005e54f1867fd030f90673b8b625ac8f0656e44a88cfc0b3af3e3f3c3d486960", + "0x1a6d9674aec5c8329252cb634022308bf4c98e70edec613d925ab781483445a4", + "0x5095b76023974440e6c155e26b3f7084f0b1901a0df2183dcfebe01f326d5e96", + "0x58bb8d7ba2f52228853238b26bfe3eb9607cea944e7020458981618efe8280a1", + "0xf92f9911e6d5b40e46f574db0a406d360f91c8de842ded48c8c699080985b4cf", + "0x785a32bf0f42bd6c986b900070bd70ff4ed5eaad448e57cf5d997224c3f87c2c", + "0x9546dea22f2479752816b65aa9db1b835efefbc1ed11804699683897cda4227e", + "0x39c8bb92227ba91a2657f29c5498f5c5b07ae36369c8d9283444f477930c79be", + "0x75422a3d36c93fcbccad2e502775226f375e264e35fc55ac20df1e9f050e8b8c", + "0x9ee40dcbc49746e31a754155515aaa232bf0bdbfd5a7ab77ea9cd39f4b7282a1", + "0xe8c07bab8822eeeb875236e148f781341157f9bfc56c1c53972489ff4009695b", + "0xb0fe18e510f695dbf24ad56fb3b647aa09f8e19021abe80686a66a2e653cb12d", + "0xf5b693085beb21b0878c7e5fab7519ce0d6105354cf6744dbfb73e3745e929e4", + "0xa0a22226f85371b5e5e4173b33a1b9629d745961f36e9b0510c591f11e3dd95b", + "0x08b3f9a96baba12f47430f2b0e2851f407e8ca355bb8a9a69242bc99aecc2cf3", + "0xc01318ac6e0d2cc08468abc1df6f2c9ec3fc5cfbfe5efec83aab250cfc83ef3f", + "0x8938be2ad9950390d6d92213ca102fc21a4304c88354d0e74f4b3ff696ce5791", + "0x623f300bf600b7b050b9b70fa57140c59a5f0b9fc5b9d0bdab11d108a71fc1a3", + "0xb8f37a61c26d388306ad9dee25e72aa86a49903a1fbbe6205211b47d1f39f77f", + "0x127ec70ea0d8a7b6244ae7d951b2204f75336cf21f49df6370ab920534c95728", + "0x68492f20c1d7597425c8a53a7f5e380fbce058d1bfea2521a7e8af03c387e1a0", + "0xf93d447fcf86f847e6609bfb3100aa5d07df37f2c72cbc4961e3a0f86a7c24b7", + "0x3a2c7d5164f6a1d8cbc5d9e228253eae4a66d8b0d550d07c53ec84d47ed17172", + "0xf93d447fcf86f847e6609bfb3100aa5d07df37f2c72cbc4961e3a0f86a7c24b7", + "0x4b6029773e7175f32398422fd18c6cb095e5278ac7be41ca4a5a6c0a6dda1a71", + "0xd222125724b9df1f4a92e1284dbc871a9156c253572df0a38ae146ac03b62af4", + "0x5a4be2322eb50cfea1051978c284526cd5a6e28caca681855736a5d3c31d9bad", + "0x89d04bcba396d12de1ed36f41df60ce0ae0449bae83f14c740451cf19362ae8f", + "0xd8ffcbc0be38306e539da616161c64ef7bc0f0281d62e5296bc8eb6ea709cb0b", + "0x96ad0b27ef10fa7a9940299df122d31222cc911bd2c91d2740f25a0dc931f4c0", + "0x40f85cb8136e95238cea4cb951a2ee645a4998c108831d5abe1d8f48696864c3", + "0xcb44297958c82fe80fb882f2c8a085a38556247b3c3f665eca382d27e26e3bbc", + "0x6298deb7c736dc50b4590ca066b72173d4e2c3f75bb109396f32eaaf9ad11bc8", + "0x3019c0a91ba30d346a55890b1b07287d8aae35baa8c4068ef8f1de66084aca75", + "0xb9af72fc0534a4a5a94eb1f64cb1bd6c425acba3249fb8441e7411e9be9ec1f3", + "0x80be858ab09789d26cf1128775756a8abe1c8ffc4218d3e990b3d25a82583255", + "0x0999f18de77e9451867cb1935f9acd56f79cbc11d04826c3da6b420a4f4bbe21", + "0xb14d9fdc657d712208d6e7c2cfbf62f7ad7ba1bfff2e63e6caee2b0bf5bad0fd", + "0xa93db8611e8d0c159eb724d2aea72763dfb5a6909a8516467c79d0386d61a511", + "0xc01b3857946cb77af9fb09394c4a359fba6df202c77d3e07e53177f3f18a55f2", + "0x79deb2f042f1717cc882c5a38bbb6c524932352ff25baeb8b8fd2225095e29ae", + "0x50ff4d47a46c9cd35b029e95ef9c957e57da987491f6e7be242e72bc5d3e8086", + "0xe8c6b410e2984be3bed9a84b76fbbd647f5fa56e65e36c264903275aa22cdb0d", + "0xe1e23690e890cdec6eb19b06f5d31d422b5c17bd4c435afb2a2532180011453f", + "0x9f0dbaecc6581cfbb57cd6c6f50e24c23ad4fcdf228140c0cb51a8a4edf5d0b0", + "0xf67f470df15c88b9beaf3fad72890a64f8851d01ece546b0c9fb3bdf92041a35", + "0x1d50131be868de2741cb775d0ff800631f96065f40b60845bce72e782718af23", + "0xa0f1ddc6e3aad69109e0e8c5d15e8800e220b192f85f369e0bef5cf858dccf9a", + "0x689802d6ed1a28b049e9d4fe5334c5902fd9bc00c42821c82f82ee2da10be908", + "0x1318a4c2bc731718857238ec2c42e4a95c0aeb7290a60c8abb110c2e638341c2", + "0x21120e1be03d384ee32a9bd7268578d8829f271540c848c97a495990bc48f582", + "0x297d3acffb942c7e6f3fb029b735338ac34e39c4ce9e852f64d50fb57cc97ec0", + "0x7744be2427cacf17062cb030d30e34c3b543b28a83707df04e64d3f7ddb471b8", + "0x028e62cb4665fce19ae1fc13a604618d7d20be037fc68b63beb3384dfa5ab776", + "0xcce46204baa86f733abf208b358ba8b807081d6d46a407745238aef2c133fd4d", + "0xaa546817dabffc9c4249830a0af5cf43c6ece6562720990736199e570f621d7c", + "0xfb1d6797796ad9edd1b8b41030035a003eb6286ae2fc1a8296b509891acfa033", + "0xb25939867994cd8e5a18f341628420fa8ab88b2f5d05ffe51291654922f5454f", + "0x2b7afbb14b4c902f37163b15f70fe8335dec4e26fbae4718c03f19da5aecbe8b", + "0x1e22733f173fbc95fa079ed50ec24c498a8aad2515d827e5ff8200c240e9cdc9", + "0x4b945ef2e8c78482bbffcbdf4921cd375065e3b5024a3bed469a9f34b2e773e7", + "0x13b8f5750961b5588bc69fbd0b701461854e110fd78c14767515bdd882725975", + "0x41351b958be1e95cdc37f7d2d654315e33ff7f45bac9179f9242fdc828c8d2e3", + "0x9f4e60123db23e3f3055f75087248fd5923d469e76d344d28b4f24a449ca6398", + "0x7d1009331195f6a3c2eee6ac4b4664f61c777500c163ee84769913578a33bdf2", + "0xbb62e8d8d0eb3d7432758c244131f1649874367cc52a4fa4fd0609def9e57389", + "0xe22d496c425479acb445c4040bdb5e17fa461de175eaaa77aa79e23b5b19f761", + "0xd24e8fff20c5317074c54fd54ca9f1fc8fef36bb70c44b55f90a70c621b91f9a", + "0xd90bcdecb44a3402e2a1b5d3a321b51e415e298ebaca3c95d91443adc03f6cec", + "0x826ce1d60ac9f0ab5944acf1c06700a585f8407d670495c7811b97cf8263b434", + "0x2139fa1aaa3d60e53d070d5a1f1ac9c8211f41b2dd5a1813416c8447a7759557", + "0x96e16af9aa5f894c43514d940687dafaa5ad04ea78a3b0080319370e454602d2", + "0x6400fc32c5b2d3580c0e19889487cf9e057d6b82a99bf30eb6e539b7cde52655", + "0x02cb51767354e1fe6bd4a49b64b3721ffddbc95fed1b8ead005c39bbc07bc4d8", + "0x3a82e1e58ae6f14fbbeb35b6d833330c4fb5b3cb770391f5cc340949c6254e83", + "0xa216c0a47b12c20d5ac5c381464a89521d8b0c1a5cb328aeabb29b70bc3347d4", + "0xea674e603f60ba1e252419d86d0485fd3f46ca6abbf4c65afee0a9ba29059655", + "0x8ae586aa1ec2c29aced4feb5adf9336541769b93cd5b8cc1b64b7d831c7b0ec2", + "0x323e393774eeec8e9d596258267d0133a5b2f01c567822a4ff018488671ecb6e", + "0x51ee1e08db014fc699587667b7256e7b9090e1755c587420cff5fbe0e20194fc", + "0x6a1c4e8b7c710531c9e66166d0629ff443df19cefa081eb4fffcc7d267ce7c92", + "0x09af9e7ea2370ab3e3ee7f0a465a7dacb6c9b7e65196dc496d5570a0d8020bda", + "0x5b70e80538acdabd6137353b0f9d8d149f4dba91e8be2e7946e409bfdbe685b9", + "0xc0f4fde474181fca3d1fb6e0dc118a71457fe7cc5d4f1e426c92e1767eb885a0", + "0x4bce4e0299e5362578a95a27bcb779b9a89232296388db803909696f90635581", + "0x1ebfd7dbb6804351804443df01a482e6451912b884cd26b31504bb77bbec9862", + "0x03089e01be9eb2af5ff5fa1c5983c6c6fb78dd734658d1f8f11d4f8d27a23fd5", + "0xb31ba6d576dbde0542d30a9264e2c71be270e3eb4f5910567a8c1c0619a2e5ec", + "0xaa8d9c947771632a645c67655595b61da72837bfa97f30f417dbaed82f2f11c3", + "0x32fc4fd3fc836c6db0058fd20ff7e8ca611885eb7215b39f97d2b4e797dca254", + "0x5c33820c3d76f4de8d1e0eca24c7d2fbef76189b6a43a7afea4dfda5b50edb96", + "0x6aefc729e28e1bbd2e63dd0803314deb808ab044909af882b7935dd05f5939a4", + "0x0c3a3c99f34afe9d2c8cecc90524ef63afc9fc13384d5d931281f414d5d487c0", + "0x9fa95d10732f34365f34f5a2f7702a9dae40c583105c40921a5052dca1f9f793", + "0xeacbb86ec518baa710dea5ed986162f21df2a98d2119f6cacbb01e8d9a77a629", + "0x7d1d5f3a14c0ab133b65698c2d62c818c65f13306ccbfd61aa4b7590bb78660c", + "0xfb6ab511cf5bcb157f833241e74ead7128a21818c2b5080be21ee9f85ff5d523", + "0x21ea8bdf8a4ea6dc9e204591d88c3b5b19533d33bfbc59c08cca266c3c87a960", + "0x9782bb006174ed014c59e6eee381c6e10bc9304226edb99edd6f8e9041e9d9a7", + "0xbc0cb591a67822e88dcebb8991bca5b7305b5858d65bc2b5e6605e481a650588", + "0x8484452e4f0c1a9f115c52b4ac78a0de2f1b0ab1a4aae8390426ac71e03f8779", + "0x2bd9aebde44794e6db317be6d83c5a266e1a96e18e04bc7073998bb779cfe2fe", + "0xd9ed35852650f28d7a8f73c7ba49bcd72d97edf8d731797e5a2728559b865552", + "0x1468288056310c82aa4c01a7e12a10f8111a0560e72b700555479031b86c357d", + "0xfc39bbcf08818ec3329e5769dff3fbdad66e6312a961acb32c1b203edf70aeba", + "0x5d9114e8c0b1e858bf7322eec122e3fc4b0988f146620def0fde9dbd322f3a03", + "0x4e09550da9ca55ba375e56c525b49b27814d20165528e4e7f309878221b2878b", + "0xe2c8bbf962c30afe9c35e9d7e036ef496b52cb770c645a76f2cee5f8811a9830", + "0xbddec651652e0aa17e056de1790554aeca5fa248cecc4131d189dacd26c4ca55", + "0x51f0e21d8c8aeef60da6ae58d10dcf1f42e7d9a0cb8ee2b4a97caa566a152b61", + "0x421df1fa259221d02aa4956eb0d35ace318ca24c0a33a64c1af96cf67cf245b6", + "0xd37476a178ee68b02b3de0edee1ebb57e1638eebf58b3e256322e0da1189f272", + "0xa3b41c13f6e16fd2242a43b041cfd1f02cbb4cf06943d14365bb8f0a30ff507a", + "0x3ac3fe84c663607ebbe01c6b008d02b92ed4feab26ed8171014853c0f9419cc8", + "0xad00cf4d7db523f20b5000bd1469a11d70b73feadd36578abdb9f3558bdd3674", + "0x8c3ab0970b73895b8c9959bae685c3a19f45eb5ad89d42b52a340ec4ac204d19", + "0x2d15e1e82ca50b7334be8990b93a8b043e771340cc9398baa23845763c696d22", + "0x331d99c6bec3aecbec962be74b25448511983b013c0876f6f4e6029773dfad61", + "0x258487f1d48945c7743c412b0f026d722a4641d5978f11a0b44dbf7c1d274d41", + "0x528b55564e8518548e42b534da3a526179b820f264ee7c6929d00b0b6a31cfc2", + "0xc2911b75be7d3fdb9442b900ca8f7205d6d52fdb3505e77ea8676f811a6d5ea1", + "0xda0d7fc05c32bbba16518f9f2936fd75140d5c99b95ae536205ba9caf1868378", + "0x26dbcce1b599ebed46e2569579562031255ea9a1c1c575fdddb0003f4d389165", + "0x8cfefa9806c99db8bea1ed8e534f6dcdb835cd1410f1f287ea4293e29a3eacc0", + "0xbe017710d6bfb0ac7a8d140333127571809eaf2b590900f168545daea3865f60", + "0x42b45de6853d406783b6b50c378bfb61d6ce5271b3bf813cc2b959055fc12f98", + "0x2df378e8ecee785e1d65200d738178432cbc9ad55c49ea5af905629d348416c2", + "0xe36c0f154a365e086c687050cee74bddde9997a1dedeb0e55217368c0ab6baa4", + "0xa62e9dc15a35c1ab9d0ac4345b1f02fd8e8070883a33651c0c143b2582708268", + "0x04242954a5cb9748d3f66bcd4583fd3830287aa585bebd9dd06fa6625976be49", + "0xb41089e529c1ff6c4d6583ecfca7ea6419bf39e0d418686bb7a24424c670b332", + "0xd3a7e59f888a7ac07a211c717c07b82970d94597f6365cf8c93d51ac9d45c597", + "0xaddb0d4b14749bb4b5cd858f29a4b4225138c3953090ce45204458dcd53749e4", + "0x34275c313c5286317794f0154f8e4ffacfc80d9d0c5b184d2482e7f9211ffc3e", + "0xfce7321f278a2973bf5c67757ea7690649295d53967daa3ae858695be336abe2", + "0x1f99af2df2da9c0176bdb3e995bdfa47ffbfe6a3aacf8e54401f4dac2ece9338", + "0x6b2c03103b55a45cc1e4550889a9396e7e331b5cf1729e4871ff4dee701139e9", + "0x640528e5cf143f173d29cd8b4f896a1c6128f3416c887c10d4a11898841b4a82", + "0xe4295c5aa043a60d279854f7424e21250d5c1e1f9959549e90bc926d70e97068", + "0xae49f4417048cacc01716a2d804f699d8ec34ead735e1c61604996ac37f35157", + "0x52a6fb56e13d45fe16456e828c8c375b0decaae2d644b76f8a9b0a741de1ed89", + "0x5f9e4ee172469cfda38a7457ef192b6efb169fedb73943e4c987d4eb910189d4", + "0x43926296aa3c8efab7e2ff9bc644236193fa657726127559ba0668734d1b2790", + "0xd52688a8f926c816ca1e079067caba944f158e764817b83fc43594370ca9cf62", + "0xb53f6bc81ecfaf0cf4c3dcd9527e3c0f6910383acf964ed14b194fa660d30b10", + "0x0d21eb4f7c202eeccd6d87627f3d512e630d4d05578585847168758fd1aaed22", + "0x1ffff1a455b66d52107a26231feefb0f3565067e9544cf9470d975f01111b1cf", + "0xdc8829261b6bfd53ab7daac305c2ad0ed15423234128bdc5b86a2e9eaf6157e4", + "0x6bcfd58769c6966e31aabe28addce6151f2dd2ea1d9c307e09c6c9db95b6b103", + "0x7d766503b9158ee06b0a587859f6e24974c78c3a64b6e4d8aefbcb8ad3bc2127", + "0xeb885fa37ef7e686a7f8dd3d9004de555526310e78dcbf857c9b0a31e40b9736", + "0x34447afb686b4074d3b93b99076a60b5f5a902fa32df18d85fc1d13ada8cdb71", + "0x2f1b6a8f228675a171126d1781aeb52756d6fe5685af8c7ec23dc8187d783d1f", + "0x6545d98b7c7dd9e023753a64c515e69e19e72b18f163831c08c7f559dd8134b5", + "0x15b381b518c6b754185d6903caf17b4f8dc30babfedf8072b118bbc3eec3013f", + "0x06339935111b4a563a28a91c253b638af868b3af7c372cab497cac4f6cb2c0aa", + "0x45b0937bfe39b0fdadcaa8974daf324193624b47f4918234645819823dbec07f", + "0x8dd81a60355138e9a80054603fe23d7896544254f66e236d478a9b033c3a0330", + "0x3ba5ac70a18399817ccbe8bd4d9c78115136cc61699d51af87608af520226c32", + "0x0e8271a44c634b7fedcd00cb09afea2a70ac8380b6bf5f61ff07e793ee3f6d4c", + "0x34562e3ace608bdd75a10eb153cbc2c00e69b935d42f57c193c38ef6d674abac", + "0x06d9e4b9abc0b8978120d451eb4cca4f72ff1d97321713e0ef379a157b8f2b60", + "0x65a1c5667776dd9a726a67038e45e040b1fa463ed55f753c2156b355616f2c82", + "0xdcbad7acc8ff4bb5562dc1a37e87244df11ed754f8f25ebb6fc23320e5268b3f", + "0xe55b734df35ab6d576607e01c42f21d275cd9c0f86fbb3100241a14ba0c7672f", + "0xb7c8c273af675612bc8ee68c7a419b671e678e63fb9ed62646358d70adb82434", + "0x15c53c582284ec93075084bae0536b5ab7ae44a44ee2718489b72be3aa78c3c7", + "0xfced34088582b4a78f611c7366195e3e94f9080637f4104bbbd0d07ffb783d49", + "0xbe03f50d58fee6912ddb6cdfd5c26302db94c986ad69eb4e7fb32768636bc9e6", + "0x6be4eb2fb308fd641346533a4acb9c4cca3e2d478e9075522646c972a2062985", + "0xebd4d964df19c1598d3ce8354498f4f0cadb39d700af15ba6a42f8f6444c27d0", + "0x5380c7b7ae81a58eb98d9c78de4a1fd7fd9535fc953ed2be602daaa41767312a", + "0x7e833b9b867caae3d5e2b64c13a744f0e5cc1bff50fdb3713e3c505114a07de1", + "0xaeb868cc8cd000167af8b0f4dadd2e348e543a019cd0b1312dbedeb4ecdc592a", + "0xb7fc8b1cc055dd94a0f598f5ce4f8e121a8e3e4ac752b027ba3e2e99ed10c7b8", + "0x3c9bd268aedc8dbb36db0a4664e17b83abcfd87e404901eee7bd5704a95064ee", + "0xc2cf8e05450be6d2c98edc5df219a4cbd86dc60667b4a7810257177dc73217ed", + "0x07c57780db2d0b81258ad3be5df2c3a9e89e4c06bfaddc3a1f4e3b9401215947", + "0x7eb6fdadc6703ad64a7ccd5feddc788dc92efac7e066e01d5eb7176e91a6331d", + "0x6d2032b002dda8c5280bf48213d7b981476a9a8e53a69a39c625e5c8129e9287", + "0x65ca73153cb8f02233c0d12f996e3dc1584f0426285f63bf41bec91a86d3c36e", + "0xaebe9973fc4849a27521c2a71aab7673ddab83cc88e91abec675c1c471abf927", + "0xe690b239ba3aaf993e443ae14aeffc44cf8d9931a79baed9fa141d0e4506e131", + "0xbe8f0a3d1c2d7a0fc2342f9a4c78e00fe38a7f26da345758cb2b8efd052bcd55", + "0xeca6cdd9768090f90960cf9bad47705ca3b19a54c8ec8186e2987ffdd3a8435b", + "0x15fefe8613a1e673567aac83294fa0da6d048e5c7642227017441c9f899fed1b", + "0xfdfacf5483fdda2fc98d08bcce1a68d5d308d3ad88ee21b50004fd694ba6f805", + "0x36b3096c912adc7674ca92b68ddb3b0494e9b988fbef1bed7938e8fac4c2df7a", + "0x8f8755e5d8418704774f38ac79dd944c223bae9ae361c5efdd614d09c60fdcfc", + "0xdd7ad9673f823444e5194d5ab0eca9a1fb7bd3770d0fdc62ce3e180037158773", + "0x46f3f8cc486e8047567212c0f011c065466bcb76647dcf87d42756d7fbbfcb4b", + "0x546690cf9510b4b7732d2c99c7c2d994f6668b7d7f75a1d28c0eba53f784fe1e", + "0xc49241829446ad570b5b97d38a504782a6522204c67d5f29b61515246d0410dc", + "0x8fd56ff474602c98136f4a9389e3e2b5d7e78ec55d5edb63fb477d7281424515", + "0x471703c5eda8644a64cec152c58f5aacec93d72fb0bfa705f0473f9043a8357c", + "0xddc48afbdb1661c8789b447f581ae07eb1863b24e50865dfacacf0aef7a4f9dc", + "0xe6c05c2ebac68df110b9966cbf92414a6ddcf3b67fc77901a5fa049da0cfb109", + "0x3da06a67e7fee9c938155c50e6cec9da70b66679e777da6f02149c6674cd9105", + "0xaf03175444dc43cc33391c4c4010eac15d401b2eb5ffc7bc778abe372f28ce37", + "0xee317a72c6604e9e4abcba1ad9d6159a00d9168558be819e4393936aa1eee432", + "0x162386be0a525c5a9e6110c7244a375038c525fe102df224286161b1289bc716", + "0x54c901f415ecf89c46159b356a4a95e9e5666bc88f8bf4bf5d9c15aac8709e0a", + "0xbeda4b34674f3b9d0aaf6c3946c05b73b4e7ac680c7084d41dc8f0bd3bb38031", + "0x65d07b4d81508c24f55172afab2935db210689baba6270991f0218356705dc1c", + "0xfe6a58207750197f48cb90864096850259845c2c8e90c74433325c0b144bf8bb", + "0xc57975ae690f9a6554015459db6c13e8c6dbf6e4cc0f5cf986afd1210c233abf", + "0xee9d69f02d1245985cab3ed816bc86177c83e0701cc5515de9932aa065886407", + "0x6dc809012cc91335a5ea4e186bd04479aac7dae1bcbd023bf660213a69f4fdbd", + "0x3e400fa3269849dec0cbf4edbd663657c73bdc8c97c07aa166dd8b49f0b14028", + "0x56d423ba59df7075b27e5d573ad8399ac6ab8a7541efb9a1e646a67244301fed", + "0xe748320edc6a9c30d249d75af74a19ade7f69c56e5e0d3a9adb17fee1b0a4bef", + "0xde6e6fcaefc39f05e5912014093f38926987bb7b125e51b49ddfb49b03e36c50", + "0xfffa0eae268038cfa984647a1d0635beb86eda9fb7b500688f3189520cfa9ee5", + "0x660f4f93865ad80d0c9f1159bc17ecaa398a0f4af3a374dd033b20029378980a", + "0xe7cf18b96a1c12507c9a95b7f48c3e012651793a196ce2b81aaa6cb185dc03b6", + "0xc60f70699042477727e7230f64b5c94d8dcb2c7815f8c2542722fcef900dd238", + "0x6688c7b8c02428a3ba7e0b83237978a46faf9a632fc615dfcf7226473c244004", + "0x3e9a637c5898b70506a347ae7b5768d1a84022f9702e8268e8a5bade8194dd47", + "0x3eea7e8e2ca3e385fe39d605086b049b99df1adab85a1c6569873424f488c5ad", + "0xc6474110edeef59c48841b35aed37057feb211e738124285a233e77e53152a57", + "0x3eef5a1ec65e8ae1c87be5edc45099ac9e7783d4b8075810ba688eb479e7a730", + "0xc6e7f2ef75851a2b752eb247b5701aa5f24d0c867534330c74c51c1ae91319f7", + "0xc705619eb7a97a01d24e21cda98066d40aeb6d6ce6fb9e9a4880d86fe4432b13", + "0xc7caa90744f6b0e1fadfc5c21ccc5de0057447d6160835e35e25a82fc391d051", + "0xc7dd5ab81d775d5c8b283ddf787bc88c61e766b7b418c0d6375683f59fe6e5a9", } diff --git a/fixture/service.go b/fixture/service.go index fcec6bc..2c520af 100644 --- a/fixture/service.go +++ b/fixture/service.go @@ -98,75 +98,75 @@ var Chain2_Block32_Header = types.Header{ // State nodes for all paths at height 32 // Total 7 -var chain2_Block32_stateNode0RLP = []byte{248, 145, 128, 128, 128, 160, 151, 6, 152, 177, 246, 151, 39, 79, 71, 219, 192, 153, 253, 0, 46, 66, 56, 238, 116, 176, 237, 244, 79, 132, 49, 29, 30, 82, 108, 53, 191, 204, 128, 128, 160, 46, 224, 200, 157, 30, 24, 225, 92, 222, 131, 123, 169, 124, 86, 228, 124, 79, 136, 236, 83, 185, 22, 67, 136, 5, 73, 46, 110, 136, 138, 101, 63, 128, 128, 160, 104, 220, 31, 84, 240, 26, 100, 148, 110, 49, 52, 120, 81, 119, 30, 251, 196, 107, 11, 134, 124, 238, 93, 61, 109, 109, 181, 208, 10, 189, 17, 92, 128, 128, 160, 171, 149, 11, 254, 75, 39, 224, 164, 133, 151, 153, 47, 109, 134, 15, 169, 139, 206, 132, 93, 220, 210, 0, 225, 235, 118, 121, 247, 173, 12, 135, 133, 128, 128, 128, 128} -var chain2_Block32_stateNode0CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode0RLP)) -var chain2_Block32_stateNode1RLP = []byte{248, 81, 128, 128, 128, 160, 209, 34, 171, 171, 30, 147, 168, 199, 137, 152, 249, 118, 14, 166, 1, 169, 116, 224, 82, 196, 237, 83, 255, 188, 228, 197, 7, 178, 144, 137, 77, 55, 128, 128, 128, 128, 128, 160, 135, 96, 108, 173, 177, 63, 201, 196, 26, 204, 72, 118, 17, 30, 76, 117, 155, 63, 68, 187, 4, 249, 78, 69, 161, 82, 178, 234, 164, 48, 158, 173, 128, 128, 128, 128, 128, 128, 128} -var chain2_Block32_stateNode1CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode1RLP)) -var chain2_Block32_stateNode2RLP = []byte{248, 105, 160, 32, 21, 58, 188, 102, 126, 135, 59, 96, 54, 200, 164, 107, 221, 132, 126, 42, 222, 63, 137, 185, 51, 28, 120, 239, 37, 83, 254, 161, 148, 197, 13, 184, 70, 248, 68, 1, 128, 160, 168, 127, 48, 6, 204, 116, 51, 247, 216, 182, 191, 182, 185, 124, 223, 202, 239, 15, 67, 91, 253, 165, 42, 2, 54, 10, 211, 250, 242, 149, 205, 139, 160, 224, 22, 140, 8, 116, 27, 79, 113, 64, 185, 215, 180, 38, 38, 236, 164, 5, 87, 211, 15, 88, 153, 138, 185, 94, 186, 125, 137, 164, 198, 141, 192} -var chain2_Block32_stateNode2CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode2RLP)) -var chain2_Block32_stateNode3RLP = []byte{248, 105, 160, 32, 252, 41, 63, 199, 2, 228, 43, 156, 2, 63, 9, 72, 38, 84, 93, 180, 47, 192, 253, 242, 186, 3, 27, 181, 34, 213, 239, 145, 122, 110, 219, 184, 70, 248, 68, 1, 128, 160, 25, 80, 158, 144, 166, 222, 32, 247, 189, 42, 34, 60, 40, 240, 56, 105, 251, 184, 132, 209, 219, 59, 60, 16, 221, 204, 228, 74, 76, 113, 37, 226, 160, 224, 22, 140, 8, 116, 27, 79, 113, 64, 185, 215, 180, 38, 38, 236, 164, 5, 87, 211, 15, 88, 153, 138, 185, 94, 186, 125, 137, 164, 198, 141, 192} -var chain2_Block32_stateNode3CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode3RLP)) -var chain2_Block32_stateNode4RLP = []byte{248, 118, 160, 55, 171, 60, 13, 215, 117, 244, 72, 175, 127, 180, 18, 67, 65, 94, 214, 251, 151, 93, 21, 48, 162, 216, 40, 246, 155, 234, 115, 70, 35, 26, 215, 184, 83, 248, 81, 10, 141, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 160, 197, 210, 70, 1, 134, 247, 35, 60, 146, 126, 125, 178, 220, 199, 3, 192, 229, 0, 182, 83, 202, 130, 39, 59, 123, 250, 216, 4, 93, 133, 164, 112} -var chain2_Block32_stateNode4CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode4RLP)) -var chain2_Block32_stateNode5RLP = []byte{248, 105, 160, 51, 151, 227, 61, 237, 218, 71, 99, 174, 161, 67, 252, 97, 81, 235, 205, 154, 147, 246, 45, 183, 166, 165, 86, 212, 108, 88, 93, 130, 173, 42, 252, 184, 70, 248, 68, 1, 128, 160, 54, 174, 96, 33, 243, 186, 113, 120, 188, 222, 254, 210, 63, 40, 4, 130, 154, 156, 66, 247, 130, 93, 88, 113, 144, 78, 47, 252, 174, 140, 130, 45, 160, 29, 80, 58, 104, 206, 141, 36, 93, 124, 217, 67, 93, 183, 43, 71, 98, 114, 126, 124, 105, 229, 48, 218, 194, 109, 83, 20, 76, 13, 102, 156, 130} -var chain2_Block32_stateNode5CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode5RLP)) -var chain2_Block32_stateNode6RLP = []byte{248, 105, 160, 58, 188, 94, 219, 48, 85, 131, 227, 63, 102, 50, 44, 238, 228, 48, 136, 170, 153, 39, 125, 167, 114, 254, 181, 5, 53, 18, 208, 58, 10, 112, 43, 184, 70, 248, 68, 1, 128, 160, 54, 174, 96, 33, 243, 186, 113, 120, 188, 222, 254, 210, 63, 40, 4, 130, 154, 156, 66, 247, 130, 93, 88, 113, 144, 78, 47, 252, 174, 140, 130, 45, 160, 29, 80, 58, 104, 206, 141, 36, 93, 124, 217, 67, 93, 183, 43, 71, 98, 114, 126, 124, 105, 229, 48, 218, 194, 109, 83, 20, 76, 13, 102, 156, 130} -var chain2_Block32_stateNode6CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(chain2_Block32_stateNode6RLP)) +var Chain2_Block32_stateNode0RLP = []byte{248, 145, 128, 128, 128, 160, 151, 6, 152, 177, 246, 151, 39, 79, 71, 219, 192, 153, 253, 0, 46, 66, 56, 238, 116, 176, 237, 244, 79, 132, 49, 29, 30, 82, 108, 53, 191, 204, 128, 128, 160, 46, 224, 200, 157, 30, 24, 225, 92, 222, 131, 123, 169, 124, 86, 228, 124, 79, 136, 236, 83, 185, 22, 67, 136, 5, 73, 46, 110, 136, 138, 101, 63, 128, 128, 160, 104, 220, 31, 84, 240, 26, 100, 148, 110, 49, 52, 120, 81, 119, 30, 251, 196, 107, 11, 134, 124, 238, 93, 61, 109, 109, 181, 208, 10, 189, 17, 92, 128, 128, 160, 171, 149, 11, 254, 75, 39, 224, 164, 133, 151, 153, 47, 109, 134, 15, 169, 139, 206, 132, 93, 220, 210, 0, 225, 235, 118, 121, 247, 173, 12, 135, 133, 128, 128, 128, 128} +var Chain2_Block32_stateNode0CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(Chain2_Block32_stateNode0RLP)) +var Chain2_Block32_stateNode1RLP = []byte{248, 81, 128, 128, 128, 160, 209, 34, 171, 171, 30, 147, 168, 199, 137, 152, 249, 118, 14, 166, 1, 169, 116, 224, 82, 196, 237, 83, 255, 188, 228, 197, 7, 178, 144, 137, 77, 55, 128, 128, 128, 128, 128, 160, 135, 96, 108, 173, 177, 63, 201, 196, 26, 204, 72, 118, 17, 30, 76, 117, 155, 63, 68, 187, 4, 249, 78, 69, 161, 82, 178, 234, 164, 48, 158, 173, 128, 128, 128, 128, 128, 128, 128} +var Chain2_Block32_stateNode1CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(Chain2_Block32_stateNode1RLP)) +var Chain2_Block32_stateNode2RLP = []byte{248, 105, 160, 32, 21, 58, 188, 102, 126, 135, 59, 96, 54, 200, 164, 107, 221, 132, 126, 42, 222, 63, 137, 185, 51, 28, 120, 239, 37, 83, 254, 161, 148, 197, 13, 184, 70, 248, 68, 1, 128, 160, 168, 127, 48, 6, 204, 116, 51, 247, 216, 182, 191, 182, 185, 124, 223, 202, 239, 15, 67, 91, 253, 165, 42, 2, 54, 10, 211, 250, 242, 149, 205, 139, 160, 224, 22, 140, 8, 116, 27, 79, 113, 64, 185, 215, 180, 38, 38, 236, 164, 5, 87, 211, 15, 88, 153, 138, 185, 94, 186, 125, 137, 164, 198, 141, 192} +var Chain2_Block32_stateNode2CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(Chain2_Block32_stateNode2RLP)) +var Chain2_Block32_stateNode3RLP = []byte{248, 105, 160, 32, 252, 41, 63, 199, 2, 228, 43, 156, 2, 63, 9, 72, 38, 84, 93, 180, 47, 192, 253, 242, 186, 3, 27, 181, 34, 213, 239, 145, 122, 110, 219, 184, 70, 248, 68, 1, 128, 160, 25, 80, 158, 144, 166, 222, 32, 247, 189, 42, 34, 60, 40, 240, 56, 105, 251, 184, 132, 209, 219, 59, 60, 16, 221, 204, 228, 74, 76, 113, 37, 226, 160, 224, 22, 140, 8, 116, 27, 79, 113, 64, 185, 215, 180, 38, 38, 236, 164, 5, 87, 211, 15, 88, 153, 138, 185, 94, 186, 125, 137, 164, 198, 141, 192} +var Chain2_Block32_stateNode3CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(Chain2_Block32_stateNode3RLP)) +var Chain2_Block32_stateNode4RLP = []byte{248, 118, 160, 55, 171, 60, 13, 215, 117, 244, 72, 175, 127, 180, 18, 67, 65, 94, 214, 251, 151, 93, 21, 48, 162, 216, 40, 246, 155, 234, 115, 70, 35, 26, 215, 184, 83, 248, 81, 10, 141, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 160, 197, 210, 70, 1, 134, 247, 35, 60, 146, 126, 125, 178, 220, 199, 3, 192, 229, 0, 182, 83, 202, 130, 39, 59, 123, 250, 216, 4, 93, 133, 164, 112} +var Chain2_Block32_stateNode4CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(Chain2_Block32_stateNode4RLP)) +var Chain2_Block32_stateNode5RLP = []byte{248, 105, 160, 51, 151, 227, 61, 237, 218, 71, 99, 174, 161, 67, 252, 97, 81, 235, 205, 154, 147, 246, 45, 183, 166, 165, 86, 212, 108, 88, 93, 130, 173, 42, 252, 184, 70, 248, 68, 1, 128, 160, 54, 174, 96, 33, 243, 186, 113, 120, 188, 222, 254, 210, 63, 40, 4, 130, 154, 156, 66, 247, 130, 93, 88, 113, 144, 78, 47, 252, 174, 140, 130, 45, 160, 29, 80, 58, 104, 206, 141, 36, 93, 124, 217, 67, 93, 183, 43, 71, 98, 114, 126, 124, 105, 229, 48, 218, 194, 109, 83, 20, 76, 13, 102, 156, 130} +var Chain2_Block32_stateNode5CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(Chain2_Block32_stateNode5RLP)) +var Chain2_Block32_stateNode6RLP = []byte{248, 105, 160, 58, 188, 94, 219, 48, 85, 131, 227, 63, 102, 50, 44, 238, 228, 48, 136, 170, 153, 39, 125, 167, 114, 254, 181, 5, 53, 18, 208, 58, 10, 112, 43, 184, 70, 248, 68, 1, 128, 160, 54, 174, 96, 33, 243, 186, 113, 120, 188, 222, 254, 210, 63, 40, 4, 130, 154, 156, 66, 247, 130, 93, 88, 113, 144, 78, 47, 252, 174, 140, 130, 45, 160, 29, 80, 58, 104, 206, 141, 36, 93, 124, 217, 67, 93, 183, 43, 71, 98, 114, 126, 124, 105, 229, 48, 218, 194, 109, 83, 20, 76, 13, 102, 156, 130} +var Chain2_Block32_stateNode6CID = ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(Chain2_Block32_stateNode6RLP)) var Chain2_Block32_StateIPLDs = []models.IPLDModel{ { BlockNumber: Chain2_Block32_Header.Number.String(), - Key: chain2_Block32_stateNode0CID.String(), - Data: chain2_Block32_stateNode0RLP, + Key: Chain2_Block32_stateNode0CID.String(), + Data: Chain2_Block32_stateNode0RLP, }, { BlockNumber: Chain2_Block32_Header.Number.String(), - Key: chain2_Block32_stateNode1CID.String(), - Data: chain2_Block32_stateNode1RLP, + Key: Chain2_Block32_stateNode1CID.String(), + Data: Chain2_Block32_stateNode1RLP, }, { BlockNumber: Chain2_Block32_Header.Number.String(), - Key: chain2_Block32_stateNode2CID.String(), - Data: chain2_Block32_stateNode2RLP, + Key: Chain2_Block32_stateNode2CID.String(), + Data: Chain2_Block32_stateNode2RLP, }, { BlockNumber: Chain2_Block32_Header.Number.String(), - Key: chain2_Block32_stateNode3CID.String(), - Data: chain2_Block32_stateNode3RLP, + Key: Chain2_Block32_stateNode3CID.String(), + Data: Chain2_Block32_stateNode3RLP, }, { BlockNumber: Chain2_Block32_Header.Number.String(), - Key: chain2_Block32_stateNode4CID.String(), - Data: chain2_Block32_stateNode4RLP, + Key: Chain2_Block32_stateNode4CID.String(), + Data: Chain2_Block32_stateNode4RLP, }, { BlockNumber: Chain2_Block32_Header.Number.String(), - Key: chain2_Block32_stateNode5CID.String(), - Data: chain2_Block32_stateNode5RLP, + Key: Chain2_Block32_stateNode5CID.String(), + Data: Chain2_Block32_stateNode5RLP, }, { BlockNumber: Chain2_Block32_Header.Number.String(), - Key: chain2_Block32_stateNode6CID.String(), - Data: chain2_Block32_stateNode6RLP, + Key: Chain2_Block32_stateNode6CID.String(), + Data: Chain2_Block32_stateNode6RLP, }, } var Chain2_Block32_StateNodes = []models.StateNodeModel{ { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), - CID: chain2_Block32_stateNode2CID.String(), + CID: Chain2_Block32_stateNode2CID.String(), Diff: false, - Balance: "1000", + Balance: "0", Nonce: 1, - CodeHash: crypto.Keccak256Hash([]byte{}).Hex(), - StorageRoot: crypto.Keccak256Hash(Block1_EmptyRootNodeRLP).Hex(), + CodeHash: common.HexToHash("0xe0168c08741b4f7140b9d7b42626eca40557d30f58998ab95eba7d89a4c68dc0").Hex(), + StorageRoot: common.HexToHash("0xa87f3006cc7433f7d8b6bfb6b97cdfcaef0f435bfda52a02360ad3faf295cd8b").Hex(), Removed: false, StateKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", }, { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), - CID: chain2_Block32_stateNode3CID.String(), + CID: Chain2_Block32_stateNode3CID.String(), Diff: false, Balance: "1000", Nonce: 1, @@ -178,7 +178,7 @@ var Chain2_Block32_StateNodes = []models.StateNodeModel{ { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), - CID: chain2_Block32_stateNode4CID.String(), + CID: Chain2_Block32_stateNode4CID.String(), Diff: false, Balance: "1000", Nonce: 1, @@ -190,7 +190,7 @@ var Chain2_Block32_StateNodes = []models.StateNodeModel{ { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), - CID: chain2_Block32_stateNode5CID.String(), + CID: Chain2_Block32_stateNode5CID.String(), Diff: false, Balance: "1000", Nonce: 1, @@ -202,12 +202,12 @@ var Chain2_Block32_StateNodes = []models.StateNodeModel{ { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), - CID: chain2_Block32_stateNode6CID.String(), + CID: Chain2_Block32_stateNode6CID.String(), Diff: false, - Balance: "1000", + Balance: "0", Nonce: 1, - CodeHash: crypto.Keccak256Hash([]byte{}).Hex(), - StorageRoot: crypto.Keccak256Hash(Block1_EmptyRootNodeRLP).Hex(), + CodeHash: common.HexToHash("0x1d503a68ce8d245d7cd9435db72b4762727e7c69e530dac26d53144c0d669c82").Hex(), + StorageRoot: common.HexToHash("0x36ae6021f3ba7178bcdefed23f2804829a9c42f7825d5871904e2ffcae8c822d").Hex(), Removed: false, StateKey: "0xcabc5edb305583e33f66322ceee43088aa99277da772feb5053512d03a0a702b", }, @@ -352,9 +352,9 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ Removed: false, StorageKey: "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace", CID: chain2_Block32_storageNode2CID.String(), - Value: []byte{}, + Value: []byte{137, 54, 53, 201, 173, 197, 222, 160, 0, 0}, StateKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", - }, + }, // 0 { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), @@ -362,9 +362,9 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ Removed: false, StorageKey: "0x4e2cec6f4784547e5042a1638086e3188929f34f3c0005f8dec366c96e8195ac", CID: chain2_Block32_storageNode3CID.String(), - Value: []byte{}, + Value: []byte{100}, StateKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", - }, + }, // 1 { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), @@ -372,9 +372,9 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ Removed: false, StorageKey: "0x6aa02a11dd4d2597318b71d493b145ddf6ae0817a9d3947f45d529a6a75f2bef", CID: chain2_Block32_storageNode4CID.String(), - Value: []byte{}, + Value: []byte{137, 54, 53, 201, 173, 197, 222, 159, 255, 156}, StateKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", - }, + }, // 2 { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), @@ -384,7 +384,7 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ CID: chain2_Block32_storageNode5CID.String(), Value: []byte{}, StateKey: "0x39fc293fc702e42b9c023f094826545db42fc0fdf2ba031bb522d5ef917a6edb'", - }, + }, // 3 { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), @@ -392,9 +392,9 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ Removed: false, StorageKey: "0x8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b", CID: chain2_Block32_storageNode6CID.String(), - Value: []byte{}, + Value: []byte{160, 71, 76, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, StateKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", - }, + }, // 4 { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), @@ -404,7 +404,7 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ CID: chain2_Block32_storageNode7CID.String(), Value: []byte{}, StateKey: "0x39fc293fc702e42b9c023f094826545db42fc0fdf2ba031bb522d5ef917a6edb'", - }, + }, // 5 { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), @@ -412,9 +412,9 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ Removed: false, StorageKey: "0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b", CID: chain2_Block32_storageNode8CID.String(), - Value: []byte{}, + Value: []byte{160, 71, 111, 108, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, StateKey: "0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d", - }, + }, // 6 { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), @@ -424,7 +424,7 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ CID: chain2_Block32_storageNode10CID.String(), Value: []byte{}, StateKey: "0x39fc293fc702e42b9c023f094826545db42fc0fdf2ba031bb522d5ef917a6edb'", - }, + }, // 7 { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), @@ -434,7 +434,7 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ CID: chain2_Block32_storageNode11CID.String(), Value: []byte{}, StateKey: "0x39fc293fc702e42b9c023f094826545db42fc0fdf2ba031bb522d5ef917a6edb'", - }, + }, // 8 { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), @@ -442,9 +442,9 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ Removed: false, StorageKey: "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563", CID: chain2_Block32_storageNode14CID.String(), - Value: []byte{}, + Value: []byte{'\x01'}, StateKey: "0xcabc5edb305583e33f66322ceee43088aa99277da772feb5053512d03a0a702b", - }, + }, // 9 { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), @@ -454,7 +454,7 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ CID: chain2_Block32_storageNode15CID.String(), Value: []byte{}, StateKey: "0x9397e33dedda4763aea143fc6151ebcd9a93f62db7a6a556d46c585d82ad2afc", - }, + }, // 10 { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), @@ -462,9 +462,9 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ Removed: false, StorageKey: "0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6", CID: chain2_Block32_storageNode16CID.String(), - Value: []byte{}, + Value: []byte{'\x04'}, StateKey: "0xcabc5edb305583e33f66322ceee43088aa99277da772feb5053512d03a0a702b", - }, + }, // 11 { BlockNumber: Chain2_Block32_Header.Number.String(), HeaderID: Chain2_Block32_Header.Hash().Hex(), @@ -474,7 +474,7 @@ var Chain2_Block32_StorageNodes = []models.StorageNodeModel{ CID: chain2_Block32_storageNode17CID.String(), Value: []byte{}, StateKey: "0x9397e33dedda4763aea143fc6151ebcd9a93f62db7a6a556d46c585d82ad2afc", - }, + }, // 12 } // Contracts used in chain2 From 4081787b03dc3ddbe01dfa52eaa4c83093048410 Mon Sep 17 00:00:00 2001 From: i-norden Date: Fri, 12 May 2023 10:06:54 -0500 Subject: [PATCH 13/18] fix service.go: prevent panics on subtrie iterators with odd-length prefix-paths --- pkg/snapshot/service.go | 57 +++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/pkg/snapshot/service.go b/pkg/snapshot/service.go index 4053961..1ef6374 100644 --- a/pkg/snapshot/service.go +++ b/pkg/snapshot/service.go @@ -219,10 +219,10 @@ func (s *Service) createSnapshot(ctx context.Context, it trie.NodeIterator, head // end path for the concurrent iterator var endPath []byte - if iter, ok := it.(*trackedIter); ok { - seekedPath = &iter.seekedPath + if i, ok := it.(*trackedIter); ok { + seekedPath = &i.seekedPath recoveredPath = append(recoveredPath, *seekedPath...) - endPath = iter.endPath + endPath = i.endPath } else { return errors.New("untracked iterator") } @@ -257,7 +257,7 @@ func (s *Service) createSubTrieSnapshot(ctx context.Context, tx Tx, prefixPath [ // if node path is empty and prefix is nil, it's the root node if prefixPath == nil { // create snapshot of node, if it is a leaf this will also create snapshot of entire storage trie - if err := s.createNodeSnapshot(tx, subTrieIt, headerID, height, seekingPaths); err != nil { + if err := s.createNodeSnapshot(tx, subTrieIt, headerID, height, seekingPaths, prefixPath); err != nil { return err } updateSeekedPath(seekedPath, subTrieIt.Path()) @@ -307,7 +307,7 @@ func (s *Service) createSubTrieSnapshot(ctx context.Context, tx Tx, prefixPath [ // if the node is along paths of interest // create snapshot of node, if it is a leaf this will also create snapshot of entire storage trie - if err := s.createNodeSnapshot(tx, subTrieIt, headerID, height, seekingPaths); err != nil { + if err := s.createNodeSnapshot(tx, subTrieIt, headerID, height, seekingPaths, prefixPath); err != nil { return err } // update seeked path after node has been processed @@ -358,7 +358,8 @@ func (s *Service) createSubTrieIt(prefixPath []byte, hash common.Hash, recovered // createNodeSnapshot indexes the current node // entire storage trie is also indexed (if available) -func (s *Service) createNodeSnapshot(tx Tx, it trie.NodeIterator, headerID string, height *big.Int, watchedAddressesLeafPaths [][]byte) error { +func (s *Service) createNodeSnapshot(tx Tx, it trie.NodeIterator, headerID string, height *big.Int, + watchedAddressesLeafPaths [][]byte, prefixPath []byte) error { tx, err := s.ipfsPublisher.PrepareTxForBatch(tx, s.maxBatchSize) if err != nil { return err @@ -369,7 +370,7 @@ func (s *Service) createNodeSnapshot(tx Tx, it trie.NodeIterator, headerID strin // if it is a "value" node, we will index the value by leaf key // publish codehash => code mappings // take storage snapshot - if err := s.processStateValueNode(it, headerID, height, watchedAddressesLeafPaths, tx); err != nil { + if err := s.processStateValueNode(it, headerID, height, prefixPath, watchedAddressesLeafPaths, tx); err != nil { return err } } else { // trie nodes will be written to blockstore only @@ -391,8 +392,8 @@ func (s *Service) createNodeSnapshot(tx Tx, it trie.NodeIterator, headerID strin return err } if ok { - nodePath := make([]byte, len(it.Path())) - copy(nodePath, it.Path()) + // create the full node path as it.Path() doesn't include the path before subtrie root + nodePath := append(prefixPath, it.Path()...) partialPath := trie.CompactToHex(elements[0].([]byte)) valueNodePath := append(nodePath, partialPath...) if !isWatchedAddress(watchedAddressesLeafPaths, valueNodePath) { @@ -403,7 +404,7 @@ func (s *Service) createNodeSnapshot(tx Tx, it trie.NodeIterator, headerID strin } nodeHash := make([]byte, len(it.Hash().Bytes())) copy(nodeHash, it.Hash().Bytes()) - if _, err := s.ipfsPublisher.PublishIPLD(ipld.Keccak256ToCid(ipld.MEthStateTrie, nodeHash), nodeVal, height, tx); err != nil { + if err := s.ipfsPublisher.PublishIPLD(ipld.Keccak256ToCid(ipld.MEthStateTrie, nodeHash), nodeVal, height, tx); err != nil { return err } } @@ -412,11 +413,13 @@ func (s *Service) createNodeSnapshot(tx Tx, it trie.NodeIterator, headerID strin } // reminder: it.Leaf() == true when the iterator is positioned at a "value node" which is not something that actually exists in an MMPT -func (s *Service) processStateValueNode(it trie.NodeIterator, headerID string, height *big.Int, +func (s *Service) processStateValueNode(it trie.NodeIterator, headerID string, height *big.Int, prefixPath []byte, watchedAddressesLeafPaths [][]byte, tx Tx) error { + // create the full node path as it.Path() doesn't include the path before subtrie root + nodePath := append(prefixPath, it.Path()...) // skip if it is not a watched address // If we aren't watching any specific addresses, we are watching everything - if len(watchedAddressesLeafPaths) > 0 && !isWatchedAddress(watchedAddressesLeafPaths, it.Path()) { + if len(watchedAddressesLeafPaths) > 0 && !isWatchedAddress(watchedAddressesLeafPaths, nodePath) { return nil } @@ -428,8 +431,24 @@ func (s *Service) processStateValueNode(it trie.NodeIterator, headerID string, h if err := rlp.DecodeBytes(accountRLP, &account); err != nil { return fmt.Errorf("error decoding account for leaf value at leaf key %x\nerror: %v", it.LeafKey(), err) } - leafKey := make([]byte, len(it.LeafKey())) - copy(leafKey, it.LeafKey()) + + // since this is a "value node", we need to move up to the "parent" node which is the actual leaf node + // it should be in the fastcache since it necessarily was recently accessed to reach the current "node" + parentNodeRLP, err := s.stateDB.TrieDB().Node(it.Parent()) + if err != nil { + return err + } + var nodeElements []interface{} + if err = rlp.DecodeBytes(parentNodeRLP, &nodeElements); err != nil { + return err + } + parentSubPath := make([]byte, len(it.ParentPath())) + copy(parentSubPath, it.ParentPath()) + parentPath := append(prefixPath, parentSubPath...) + partialPath := trie.CompactToHex(nodeElements[0].([]byte)) + valueNodePath := append(parentPath, partialPath...) + encodedPath := trie.HexToCompact(valueNodePath) + leafKey := encodedPath[1:] // write codehash => code mappings if we have a contract if !bytes.Equal(account.CodeHash, emptyCodeHash) { @@ -438,17 +457,11 @@ func (s *Service) processStateValueNode(it trie.NodeIterator, headerID string, h if err != nil { return fmt.Errorf("failed to retrieve code for codehash %s\r\n error: %v", codeHash.String(), err) } - if _, err := s.ipfsPublisher.PublishIPLD(ipld.Keccak256ToCid(ipld.RawBinary, codeHash.Bytes()), code, height, tx); err != nil { + if err := s.ipfsPublisher.PublishIPLD(ipld.Keccak256ToCid(ipld.RawBinary, codeHash.Bytes()), code, height, tx); err != nil { return err } } - // since this is a "value node", we need to move up to the "parent" node which is the actual leaf node - // it should be in the fastcache since it necessarily was recently accessed to reach the current node - parentNodeRLP, err := s.stateDB.TrieDB().Node(it.Parent()) - if err != nil { - return err - } // publish the state leaf model stateKeyStr := common.BytesToHash(leafKey).String() stateLeafNodeModel := &models.StateNodeModel{ @@ -495,7 +508,7 @@ func (s *Service) storageSnapshot(sr common.Hash, stateKey, headerID string, hei copy(nodeVal, it.NodeBlob()) nodeHash := make([]byte, len(it.Hash().Bytes())) copy(nodeHash, it.Hash().Bytes()) - if _, err := s.ipfsPublisher.PublishIPLD(ipld.Keccak256ToCid(ipld.MEthStorageTrie, nodeHash), nodeVal, height, tx); err != nil { + if err := s.ipfsPublisher.PublishIPLD(ipld.Keccak256ToCid(ipld.MEthStorageTrie, nodeHash), nodeVal, height, tx); err != nil { return nil, err } } From 7af17b1851e40468d4c328d8bf5e997c42bbd077 Mon Sep 17 00:00:00 2001 From: i-norden Date: Fri, 12 May 2023 10:07:12 -0500 Subject: [PATCH 14/18] update test helpers --- test/helper.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/helper.go b/test/helper.go index 72d225c..552c27c 100644 --- a/test/helper.go +++ b/test/helper.go @@ -21,7 +21,7 @@ var ( DefaultPgConfig = postgres.Config{ Hostname: "localhost", Port: 8077, - DatabaseName: "vulcanize_testing", + DatabaseName: "cerc_testing", Username: "vdbm", Password: "password", @@ -48,7 +48,7 @@ func NoError(t *testing.T, err error) { // ExpectEqual asserts the provided interfaces are deep equal func ExpectEqual(t *testing.T, want, got interface{}) { if !reflect.DeepEqual(want, got) { - t.Fatalf("Values not equal:\nExpected:\t%v\nActual:\t\t%v", want, got) + t.Fatalf("Values not equal:\nExpected:\t%+v\nActual:\t\t%+v", want, got) } } From ea4c1042c44f64c3f4986145b0cbc2de51f5ecb0 Mon Sep 17 00:00:00 2001 From: i-norden Date: Fri, 12 May 2023 10:07:28 -0500 Subject: [PATCH 15/18] update service_test with new fixtures --- pkg/snapshot/service_test.go | 371 ++++++++++++++++++++++------------- 1 file changed, 233 insertions(+), 138 deletions(-) diff --git a/pkg/snapshot/service_test.go b/pkg/snapshot/service_test.go index 8cff6d2..93f0c08 100644 --- a/pkg/snapshot/service_test.go +++ b/pkg/snapshot/service_test.go @@ -3,7 +3,6 @@ package snapshot import ( "errors" "fmt" - "math/big" "math/rand" "os" "path/filepath" @@ -13,6 +12,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/statediff/indexer/models" "github.com/golang/mock/gomock" fixt "github.com/cerc-io/ipld-eth-state-snapshot/fixture" @@ -22,11 +22,13 @@ import ( ) var ( - stateNodeNotIndexedErr = "state node not indexed for path %v" - storageNodeNotIndexedErr = "storage node not indexed for state path %v, storage path %v" + stateNodeDuplicateErr = "state node indexed multiple times (%d) for state key %v" + storageNodeDuplicateErr = "storage node indexed multiple times (%d) for state key %v and storage key %v" + stateNodeNotIndexedErr = "state node not indexed for state key %v" + storageNodeNotIndexedErr = "storage node not indexed for state key %v, storage key %v" - unexpectedStateNodeErr = "got unexpected state node for path %v" - unexpectedStorageNodeErr = "got unexpected storage node for state path %v, storage path %v" + unexpectedStateNodeErr = "got unexpected state node for state key %v" + unexpectedStorageNodeErr = "got unexpected storage node for state key %v, storage key %v" extraNodesIndexedErr = "number of nodes indexed (%v) is more than expected (max %v)" ) @@ -54,10 +56,9 @@ func makeMocks(t *testing.T) (*mock.MockPublisher, *mock.MockTx) { func TestCreateSnapshot(t *testing.T) { runCase := func(t *testing.T, workers int) { - // map: expected state path -> struct{}{} - expectedStateNodePaths := sync.Map{} - for _, path := range fixt.Block1_StateNodePaths { - expectedStateNodePaths.Store(string(path), struct{}{}) + expectedStateLeafKeys := sync.Map{} + for _, key := range fixt.Block1_StateNodeLeafKeys { + expectedStateLeafKeys.Store(key, struct{}{}) } pub, tx := makeMocks(t) @@ -68,23 +69,27 @@ func TestCreateSnapshot(t *testing.T) { AnyTimes() tx.EXPECT().Commit(). Times(workers) - pub.EXPECT().PublishStateNode( + pub.EXPECT().PublishStateLeafNode( gomock.Any(), - gomock.Eq(fixt.Block1_Header.Hash().String()), - gomock.Eq(fixt.Block1_Header.Number), gomock.Eq(tx)). - DoAndReturn(func(node *snapt.Node, _ string, _ *big.Int, _ snapt.Tx) error { - if _, ok := expectedStateNodePaths.Load(string(node.Path)); ok { - expectedStateNodePaths.Delete(string(node.Path)) + Do(func(stateNode *models.StateNodeModel, _ snapt.Tx) error { + if stateNode.BlockNumber != fixt.Block1_Header.Number.String() { + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) + } + if stateNode.HeaderID != fixt.Block1_Header.Hash().String() { + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) + } + if _, ok := expectedStateLeafKeys.Load(stateNode.StateKey); ok { + expectedStateLeafKeys.Delete(stateNode.StateKey) } else { - t.Fatalf(unexpectedStateNodeErr, node.Path) + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) } return nil }). - Times(len(fixt.Block1_StateNodePaths)) - - // TODO: fixtures for storage node - // pub.EXPECT().PublishStorageNode(gomock.Eq(fixt.StorageNode), gomock.Eq(int64(0)), gomock.Any()) + AnyTimes() + pub.EXPECT().PublishIPLD(gomock.Any(), gomock.Any(), gomock.Eq(fixt.Block1_Header.Number), gomock.Eq(tx)). + AnyTimes() + // Note: block 1 doesn't have storage nodes. TODO: add fixtures with storage nodes chainDataPath, ancientDataPath := fixt.GetChainDataPath("chaindata") config := testConfig(chainDataPath, ancientDataPath) @@ -107,8 +112,8 @@ func TestCreateSnapshot(t *testing.T) { } // Check if all expected state nodes are indexed - expectedStateNodePaths.Range(func(key, value any) bool { - t.Fatalf(stateNodeNotIndexedErr, []byte(key.(string))) + expectedStateLeafKeys.Range(func(key, value any) bool { + t.Fatalf(stateNodeNotIndexedErr, key.(string)) return true }) } @@ -119,14 +124,19 @@ func TestCreateSnapshot(t *testing.T) { } } -type indexedNode struct { - value snapt.Node +type indexedStateLeafNode struct { + value models.StateNodeModel + isIndexed bool +} + +type indexedStorageLeafNode struct { + value models.StorageNodeModel isIndexed bool } type storageNodeKey struct { - statePath string - storagePath string + stateKey string + storageKey string } func TestAccountSelectiveSnapshot(t *testing.T) { @@ -135,21 +145,20 @@ func TestAccountSelectiveSnapshot(t *testing.T) { common.HexToAddress("0x825a6eec09e44Cb0fa19b84353ad0f7858d7F61a"): {}, common.HexToAddress("0x0616F59D291a898e796a1FAD044C5926ed2103eC"): {}, } + expectedStateNodeIndexes := []int{0, 4} - expectedStateNodeIndexes := []int{0, 1, 2, 6} + stateKey33 := common.HexToHash("0x33153abc667e873b6036c8a46bdd847e2ade3f89b9331c78ef2553fea194c50d").String() + expectedStorageNodeIndexes33 := []int{0, 1, 2, 4, 6} - statePath33 := []byte{3, 3} - expectedStorageNodeIndexes33 := []int{0, 1, 2, 3, 4, 6, 8} - - statePath12 := []byte{12} - expectedStorageNodeIndexes12 := []int{12, 14, 16} + stateKey12 := common.HexToHash("0xcabc5edb305583e33f66322ceee43088aa99277da772feb5053512d03a0a702b").String() + expectedStorageNodeIndexes12 := []int{9, 11} runCase := func(t *testing.T, workers int) { expectedStateNodes := sync.Map{} for _, expectedStateNodeIndex := range expectedStateNodeIndexes { - path := fixt.Chain2_Block32_StateNodes[expectedStateNodeIndex].Path - expectedStateNodes.Store(string(path), indexedNode{ + key := fixt.Chain2_Block32_StateNodes[expectedStateNodeIndex].StateKey + expectedStateNodes.Store(key, indexedStateLeafNode{ value: fixt.Chain2_Block32_StateNodes[expectedStateNodeIndex], isIndexed: false, }) @@ -158,31 +167,33 @@ func TestAccountSelectiveSnapshot(t *testing.T) { expectedStorageNodes := sync.Map{} for _, expectedStorageNodeIndex := range expectedStorageNodeIndexes33 { - path := fixt.Chain2_Block32_StorageNodes[expectedStorageNodeIndex].Path - key := storageNodeKey{ - statePath: string(statePath33), - storagePath: string(path), + key := fixt.Chain2_Block32_StorageNodes[expectedStorageNodeIndex].StorageKey + keys := storageNodeKey{ + stateKey: stateKey33, + storageKey: key, } - value := indexedNode{ - value: fixt.Chain2_Block32_StorageNodes[expectedStorageNodeIndex].Node, + value := indexedStorageLeafNode{ + value: fixt.Chain2_Block32_StorageNodes[expectedStorageNodeIndex], isIndexed: false, } - expectedStorageNodes.Store(key, value) + expectedStorageNodes.Store(keys, value) } for _, expectedStorageNodeIndex := range expectedStorageNodeIndexes12 { - path := fixt.Chain2_Block32_StorageNodes[expectedStorageNodeIndex].Path - key := storageNodeKey{ - statePath: string(statePath12), - storagePath: string(path), + key := fixt.Chain2_Block32_StorageNodes[expectedStorageNodeIndex].StorageKey + keys := storageNodeKey{ + stateKey: stateKey12, + storageKey: key, } - value := indexedNode{ - value: fixt.Chain2_Block32_StorageNodes[expectedStorageNodeIndex].Node, + value := indexedStorageLeafNode{ + value: fixt.Chain2_Block32_StorageNodes[expectedStorageNodeIndex], isIndexed: false, } - expectedStorageNodes.Store(key, value) + expectedStorageNodes.Store(keys, value) } + var count int + pub, tx := makeMocks(t) pub.EXPECT().PublishHeader(gomock.Eq(&fixt.Chain2_Block32_Header)) pub.EXPECT().BeginTx().Return(tx, nil). @@ -191,58 +202,66 @@ func TestAccountSelectiveSnapshot(t *testing.T) { AnyTimes() tx.EXPECT().Commit(). Times(workers) - pub.EXPECT().PublishCode(gomock.Eq(fixt.Chain2_Block32_Header.Number), gomock.Any(), gomock.Any(), gomock.Eq(tx)). - AnyTimes() - pub.EXPECT().PublishStateNode( + pub.EXPECT().PublishStateLeafNode( gomock.Any(), - gomock.Eq(fixt.Chain2_Block32_Header.Hash().String()), - gomock.Eq(fixt.Chain2_Block32_Header.Number), gomock.Eq(tx)). - Do(func(node *snapt.Node, _ string, _ *big.Int, _ snapt.Tx) error { - key := string(node.Path) + Do(func(stateNode *models.StateNodeModel, _ snapt.Tx) error { + count++ + if stateNode.BlockNumber != fixt.Chain2_Block32_Header.Number.String() { + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) + } + if stateNode.HeaderID != fixt.Chain2_Block32_Header.Hash().String() { + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) + } + key := stateNode.StateKey // Check published nodes if expectedStateNode, ok := expectedStateNodes.Load(key); ok { - expectedVal := expectedStateNode.(indexedNode).value - test.ExpectEqual(t, expectedVal, *node) + expectedVal := expectedStateNode.(indexedStateLeafNode).value + test.ExpectEqual(t, expectedVal, *stateNode) // Mark expected node as indexed - expectedStateNodes.Store(key, indexedNode{ + expectedStateNodes.Store(key, indexedStateLeafNode{ value: expectedVal, isIndexed: true, }) } else { - t.Fatalf(unexpectedStateNodeErr, node.Path) + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) } return nil }). AnyTimes() - pub.EXPECT().PublishStorageNode( - gomock.Any(), - gomock.Eq(fixt.Chain2_Block32_Header.Hash().String()), - gomock.Eq(new(big.Int).SetUint64(snapShotHeight)), + pub.EXPECT().PublishStorageLeafNode( gomock.Any(), gomock.Eq(tx)). - Do(func(node *snapt.Node, _ string, _ *big.Int, statePath []byte, _ snapt.Tx) error { + Do(func(storageNode *models.StorageNodeModel, _ snapt.Tx) error { + if storageNode.BlockNumber != fixt.Chain2_Block32_Header.Number.String() { + t.Fatalf(unexpectedStorageNodeErr, storageNode.StateKey, storageNode.StorageKey) + } + if storageNode.HeaderID != fixt.Chain2_Block32_Header.Hash().String() { + t.Fatalf(unexpectedStorageNodeErr, storageNode.StateKey, storageNode.StorageKey) + } key := storageNodeKey{ - statePath: string(statePath), - storagePath: string(node.Path), + stateKey: storageNode.StateKey, + storageKey: storageNode.StorageKey, } // Check published nodes if expectedStorageNode, ok := expectedStorageNodes.Load(key); ok { - expectedVal := expectedStorageNode.(indexedNode).value - test.ExpectEqual(t, expectedVal, *node) + expectedVal := expectedStorageNode.(indexedStorageLeafNode).value + test.ExpectEqual(t, expectedVal, *storageNode) // Mark expected node as indexed - expectedStorageNodes.Store(key, indexedNode{ + expectedStorageNodes.Store(key, indexedStorageLeafNode{ value: expectedVal, isIndexed: true, }) } else { - t.Fatalf(unexpectedStorageNodeErr, statePath, node.Path) + t.Fatalf(unexpectedStorageNodeErr, storageNode.StateKey, storageNode.StorageKey) } return nil }). AnyTimes() + pub.EXPECT().PublishIPLD(gomock.Any(), gomock.Any(), gomock.Eq(fixt.Chain2_Block32_Header.Number), gomock.Eq(tx)). + AnyTimes() chainDataPath, ancientDataPath := fixt.GetChainDataPath("chain2data") config := testConfig(chainDataPath, ancientDataPath) @@ -265,15 +284,15 @@ func TestAccountSelectiveSnapshot(t *testing.T) { } expectedStateNodes.Range(func(key, value any) bool { - if !value.(indexedNode).isIndexed { - t.Fatalf(stateNodeNotIndexedErr, []byte(key.(string))) + if !value.(indexedStateLeafNode).isIndexed { + t.Fatalf(stateNodeNotIndexedErr, key) return false } return true }) expectedStorageNodes.Range(func(key, value any) bool { - if !value.(indexedNode).isIndexed { - t.Fatalf(storageNodeNotIndexedErr, []byte(key.(storageNodeKey).statePath), []byte(key.(storageNodeKey).storagePath)) + if !value.(indexedStorageLeafNode).isIndexed { + t.Fatalf(storageNodeNotIndexedErr, key.(storageNodeKey).stateKey, key.(storageNodeKey).storageKey) return false } return true @@ -287,12 +306,11 @@ func TestAccountSelectiveSnapshot(t *testing.T) { } func TestRecovery(t *testing.T) { - maxPathLength := 4 runCase := func(t *testing.T, workers int, interruptAt int32) { // map: expected state path -> number of times it got published - expectedStateNodePaths := sync.Map{} - for _, path := range fixt.Block1_StateNodePaths { - expectedStateNodePaths.Store(string(path), 0) + expectedStateNodeKeys := sync.Map{} + for _, key := range fixt.Block1_StateNodeLeafKeys { + expectedStateNodeKeys.Store(key, 0) } var indexedStateNodesCount int32 @@ -301,22 +319,32 @@ func TestRecovery(t *testing.T) { pub.EXPECT().BeginTx().Return(tx, nil).MaxTimes(workers) pub.EXPECT().PrepareTxForBatch(gomock.Any(), gomock.Any()).Return(tx, nil).AnyTimes() tx.EXPECT().Commit().MaxTimes(workers) - pub.EXPECT().PublishStateNode(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). - DoAndReturn(func(node *snapt.Node, _ string, _ *big.Int, _ snapt.Tx) error { + pub.EXPECT().PublishStateLeafNode( + gomock.Any(), + gomock.Eq(tx)). + DoAndReturn(func(stateNode *models.StateNodeModel, _ snapt.Tx) error { + if stateNode.BlockNumber != fixt.Block1_Header.Number.String() { + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) + } + if stateNode.HeaderID != fixt.Block1_Header.Hash().String() { + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) + } // Start throwing an error after a certain number of state nodes have been indexed if indexedStateNodesCount >= interruptAt { - return errors.New("failingPublishStateNode") + return errors.New("failingPublishStateLeafNode") } else { - if prevCount, ok := expectedStateNodePaths.Load(string(node.Path)); ok { - expectedStateNodePaths.Store(string(node.Path), prevCount.(int)+1) + if prevCount, ok := expectedStateNodeKeys.Load(stateNode.StateKey); ok { + expectedStateNodeKeys.Store(stateNode.StateKey, prevCount.(int)+1) atomic.AddInt32(&indexedStateNodesCount, 1) } else { - t.Fatalf(unexpectedStateNodeErr, node.Path) + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) } } return nil }). MaxTimes(int(interruptAt) + workers) + pub.EXPECT().PublishIPLD(gomock.Any(), gomock.Any(), gomock.Eq(fixt.Block1_Header.Number), gomock.Eq(tx)). + AnyTimes() chainDataPath, ancientDataPath := fixt.GetChainDataPath("chaindata") config := testConfig(chainDataPath, ancientDataPath) @@ -348,17 +376,27 @@ func TestRecovery(t *testing.T) { recoveryPub.EXPECT().BeginTx().Return(tx, nil).AnyTimes() recoveryPub.EXPECT().PrepareTxForBatch(gomock.Any(), gomock.Any()).Return(tx, nil).AnyTimes() tx.EXPECT().Commit().AnyTimes() - recoveryPub.EXPECT().PublishStateNode(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). - DoAndReturn(func(node *snapt.Node, _ string, _ *big.Int, _ snapt.Tx) error { - if prevCount, ok := expectedStateNodePaths.Load(string(node.Path)); ok { - expectedStateNodePaths.Store(string(node.Path), prevCount.(int)+1) + recoveryPub.EXPECT().PublishStateLeafNode( + gomock.Any(), + gomock.Eq(tx)). + DoAndReturn(func(stateNode *models.StateNodeModel, _ snapt.Tx) error { + if stateNode.BlockNumber != fixt.Block1_Header.Number.String() { + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) + } + if stateNode.HeaderID != fixt.Block1_Header.Hash().String() { + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) + } + if prevCount, ok := expectedStateNodeKeys.Load(stateNode.StateKey); ok { + expectedStateNodeKeys.Store(stateNode.StateKey, prevCount.(int)+1) atomic.AddInt32(&indexedStateNodesCount, 1) } else { - t.Fatalf(unexpectedStateNodeErr, node.Path) + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) } return nil }). AnyTimes() + recoveryPub.EXPECT().PublishIPLD(gomock.Any(), gomock.Any(), gomock.Eq(fixt.Block1_Header.Number), gomock.Eq(tx)). + AnyTimes() // Create a new snapshot service for recovery recoveryService, err := NewSnapshotService(edb, recoveryPub, recovery) @@ -381,15 +419,15 @@ func TestRecovery(t *testing.T) { } // Check if all state nodes are indexed after recovery - expectedStateNodePaths.Range(func(key, value any) bool { + expectedStateNodeKeys.Range(func(key, value any) bool { if value.(int) == 0 { - t.Fatalf(stateNodeNotIndexedErr, []byte(key.(string))) + t.Fatalf(stateNodeNotIndexedErr, key.(string)) } return true }) // nodes along the recovery path get reindexed - maxStateNodesCount := len(fixt.Block1_StateNodePaths) + workers*maxPathLength + maxStateNodesCount := len(fixt.Block1_StateNodeLeafKeys) if indexedStateNodesCount > int32(maxStateNodesCount) { t.Fatalf(extraNodesIndexedErr, indexedStateNodesCount, maxStateNodesCount) } @@ -400,7 +438,7 @@ func TestRecovery(t *testing.T) { interrupts := make([]int32, numInterrupts) for i := 0; i < numInterrupts; i++ { rand.Seed(time.Now().UnixNano()) - interrupts[i] = rand.Int31n(int32(len(fixt.Block1_StateNodePaths))) + interrupts[i] = rand.Int31n(int32(len(fixt.Block1_StateNodeLeafKeys) / 2)) } for _, tc := range testCases { @@ -411,57 +449,87 @@ func TestRecovery(t *testing.T) { } func TestAccountSelectiveRecovery(t *testing.T) { - maxPathLength := 2 snapShotHeight := uint64(32) watchedAddresses := map[common.Address]struct{}{ common.HexToAddress("0x825a6eec09e44Cb0fa19b84353ad0f7858d7F61a"): {}, common.HexToAddress("0x0616F59D291a898e796a1FAD044C5926ed2103eC"): {}, } - expectedStateNodeIndexes := []int{0, 1, 2, 6} + expectedStateNodeIndexes := []int{0, 4} + expectedStorageNodeIndexes := []int{0, 1, 2, 4, 6, 9, 11} runCase := func(t *testing.T, workers int, interruptAt int32) { // map: expected state path -> number of times it got published - expectedStateNodePaths := sync.Map{} + expectedStateNodeKeys := sync.Map{} for _, expectedStateNodeIndex := range expectedStateNodeIndexes { - path := fixt.Chain2_Block32_StateNodes[expectedStateNodeIndex].Path - expectedStateNodePaths.Store(string(path), 0) + key := fixt.Chain2_Block32_StateNodes[expectedStateNodeIndex].StateKey + expectedStateNodeKeys.Store(key, 0) } - var indexedStateNodesCount int32 + expectedStorageNodeKeys := sync.Map{} + for _, expectedStorageNodeIndex := range expectedStorageNodeIndexes { + stateKey := fixt.Chain2_Block32_StorageNodes[expectedStorageNodeIndex].StateKey + storageKey := fixt.Chain2_Block32_StorageNodes[expectedStorageNodeIndex].StorageKey + keys := storageNodeKey{ + stateKey: stateKey, + storageKey: storageKey, + } + expectedStorageNodeKeys.Store(keys, 0) + } + var indexedStateNodesCount, indexedStorageNodesCount int32 pub, tx := makeMocks(t) pub.EXPECT().PublishHeader(gomock.Eq(&fixt.Chain2_Block32_Header)) pub.EXPECT().BeginTx().Return(tx, nil).Times(workers) pub.EXPECT().PrepareTxForBatch(gomock.Any(), gomock.Any()).Return(tx, nil).AnyTimes() tx.EXPECT().Commit().Times(workers) - pub.EXPECT().PublishStateNode( + pub.EXPECT().PublishStateLeafNode( gomock.Any(), - gomock.Eq(fixt.Chain2_Block32_Header.Hash().String()), - gomock.Eq(fixt.Chain2_Block32_Header.Number), gomock.Eq(tx)). - DoAndReturn(func(node *snapt.Node, _ string, _ *big.Int, _ snapt.Tx) error { + DoAndReturn(func(stateNode *models.StateNodeModel, _ snapt.Tx) error { + if stateNode.BlockNumber != fixt.Chain2_Block32_Header.Number.String() { + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) + } + if stateNode.HeaderID != fixt.Chain2_Block32_Header.Hash().String() { + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) + } // Start throwing an error after a certain number of state nodes have been indexed if indexedStateNodesCount >= interruptAt { - return errors.New("failingPublishStateNode") + return errors.New("failingPublishStateLeafNode") } else { - if prevCount, ok := expectedStateNodePaths.Load(string(node.Path)); ok { - expectedStateNodePaths.Store(string(node.Path), prevCount.(int)+1) + if prevCount, ok := expectedStateNodeKeys.Load(stateNode.StateKey); ok { + expectedStateNodeKeys.Store(stateNode.StateKey, prevCount.(int)+1) atomic.AddInt32(&indexedStateNodesCount, 1) } else { - t.Fatalf(unexpectedStateNodeErr, node.Path) + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) } } return nil }). MaxTimes(int(interruptAt) + workers) - pub.EXPECT().PublishStorageNode( - gomock.Any(), - gomock.Eq(fixt.Chain2_Block32_Header.Hash().String()), - gomock.Eq(new(big.Int).SetUint64(snapShotHeight)), + pub.EXPECT().PublishStorageLeafNode( gomock.Any(), gomock.Eq(tx)). + Do(func(storageNode *models.StorageNodeModel, _ snapt.Tx) error { + if storageNode.BlockNumber != fixt.Chain2_Block32_Header.Number.String() { + t.Fatalf(unexpectedStorageNodeErr, storageNode.StateKey, storageNode.StorageKey) + } + if storageNode.HeaderID != fixt.Chain2_Block32_Header.Hash().String() { + t.Fatalf(unexpectedStorageNodeErr, storageNode.StateKey, storageNode.StorageKey) + } + keys := storageNodeKey{ + stateKey: storageNode.StateKey, + storageKey: storageNode.StorageKey, + } + if prevCount, ok := expectedStorageNodeKeys.Load(keys); ok { + expectedStorageNodeKeys.Store(keys, prevCount.(int)+1) + atomic.AddInt32(&indexedStorageNodesCount, 1) + } else { + t.Fatalf(unexpectedStorageNodeErr, storageNode.StateKey, storageNode.StorageKey) + } + return nil + }). AnyTimes() - pub.EXPECT().PublishCode(gomock.Eq(fixt.Chain2_Block32_Header.Number), gomock.Any(), gomock.Any(), gomock.Eq(tx)). + pub.EXPECT().PublishIPLD(gomock.Any(), gomock.Any(), gomock.Eq(fixt.Chain2_Block32_Header.Number), gomock.Eq(tx)). AnyTimes() chainDataPath, ancientDataPath := fixt.GetChainDataPath("chain2data") @@ -494,29 +562,49 @@ func TestAccountSelectiveRecovery(t *testing.T) { recoveryPub.EXPECT().BeginTx().Return(tx, nil).MaxTimes(workers) recoveryPub.EXPECT().PrepareTxForBatch(gomock.Any(), gomock.Any()).Return(tx, nil).AnyTimes() tx.EXPECT().Commit().MaxTimes(workers) - recoveryPub.EXPECT().PublishStateNode( + recoveryPub.EXPECT().PublishStateLeafNode( gomock.Any(), - gomock.Eq(fixt.Chain2_Block32_Header.Hash().String()), - gomock.Eq(fixt.Chain2_Block32_Header.Number), gomock.Eq(tx)). - DoAndReturn(func(node *snapt.Node, _ string, _ *big.Int, _ snapt.Tx) error { - if prevCount, ok := expectedStateNodePaths.Load(string(node.Path)); ok { - expectedStateNodePaths.Store(string(node.Path), prevCount.(int)+1) + DoAndReturn(func(stateNode *models.StateNodeModel, _ snapt.Tx) error { + if stateNode.BlockNumber != fixt.Chain2_Block32_Header.Number.String() { + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) + } + if stateNode.HeaderID != fixt.Chain2_Block32_Header.Hash().String() { + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) + } + if prevCount, ok := expectedStateNodeKeys.Load(stateNode.StateKey); ok { + expectedStateNodeKeys.Store(stateNode.StateKey, prevCount.(int)+1) atomic.AddInt32(&indexedStateNodesCount, 1) } else { - t.Fatalf(unexpectedStateNodeErr, node.Path) + t.Fatalf(unexpectedStateNodeErr, stateNode.StateKey) } return nil }). AnyTimes() - recoveryPub.EXPECT().PublishStorageNode( - gomock.Any(), - gomock.Eq(fixt.Chain2_Block32_Header.Hash().String()), - gomock.Eq(new(big.Int).SetUint64(snapShotHeight)), + recoveryPub.EXPECT().PublishStorageLeafNode( gomock.Any(), gomock.Eq(tx)). + Do(func(storageNode *models.StorageNodeModel, _ snapt.Tx) error { + if storageNode.BlockNumber != fixt.Chain2_Block32_Header.Number.String() { + t.Fatalf(unexpectedStorageNodeErr, storageNode.StateKey, storageNode.StorageKey) + } + if storageNode.HeaderID != fixt.Chain2_Block32_Header.Hash().String() { + t.Fatalf(unexpectedStorageNodeErr, storageNode.StateKey, storageNode.StorageKey) + } + keys := storageNodeKey{ + stateKey: storageNode.StateKey, + storageKey: storageNode.StorageKey, + } + if prevCount, ok := expectedStorageNodeKeys.Load(keys); ok { + expectedStorageNodeKeys.Store(keys, prevCount.(int)+1) + atomic.AddInt32(&indexedStorageNodesCount, 1) + } else { + t.Fatalf(unexpectedStorageNodeErr, storageNode.StateKey, storageNode.StorageKey) + } + return nil + }). AnyTimes() - recoveryPub.EXPECT().PublishCode(gomock.Eq(fixt.Chain2_Block32_Header.Number), gomock.Any(), gomock.Any(), gomock.Eq(tx)). + recoveryPub.EXPECT().PublishIPLD(gomock.Any(), gomock.Any(), gomock.Eq(fixt.Chain2_Block32_Header.Number), gomock.Eq(tx)). AnyTimes() // Create a new snapshot service for recovery @@ -539,32 +627,39 @@ func TestAccountSelectiveRecovery(t *testing.T) { } } - // Check if all expected state nodes are indexed after recovery - expectedStateNodePaths.Range(func(key, value any) bool { + // Check if all expected state nodes are indexed after recovery, but not in duplicate + expectedStateNodeKeys.Range(func(key, value any) bool { if value.(int) == 0 { - t.Fatalf(stateNodeNotIndexedErr, []byte(key.(string))) + t.Fatalf(stateNodeNotIndexedErr, key.(string)) } + /* TODO: fix/figure out + if value.(int) > 1 { + t.Fatalf(stateNodeDuplicateErr, value.(int), key.(string)) + } + */ + return true + }) + expectedStorageNodeKeys.Range(func(key, value any) bool { + if value.(int) == 0 { + t.Fatalf(storageNodeNotIndexedErr, key.(storageNodeKey).stateKey, key.(storageNodeKey).storageKey) + } + /* TODO: fix/figure out + if value.(int) > 1 { + t.Fatalf(storageNodeDuplicateErr, value.(int), key.(storageNodeKey).stateKey, key.(storageNodeKey).storageKey) + } + */ return true }) - // nodes along the recovery path get reindexed - maxStateNodesCount := len(expectedStateNodeIndexes) + workers*maxPathLength + maxStateNodesCount := len(expectedStateNodeIndexes) + workers if indexedStateNodesCount > int32(maxStateNodesCount) { t.Fatalf(extraNodesIndexedErr, indexedStateNodesCount, maxStateNodesCount) } } testCases := []int{1, 2, 4, 8, 16, 32} - numInterrupts := 2 - interrupts := make([]int32, numInterrupts) - for i := 0; i < numInterrupts; i++ { - rand.Seed(time.Now().UnixNano()) - interrupts[i] = rand.Int31n(int32(len(expectedStateNodeIndexes))) - } for _, tc := range testCases { - for _, interrupt := range interrupts { - t.Run(fmt.Sprint("case", tc, interrupt), func(t *testing.T) { runCase(t, tc, interrupt) }) - } + t.Run(fmt.Sprint("case", tc, 1), func(t *testing.T) { runCase(t, tc, 1) }) } } From 2dd92214674e00e6168dee834dfcbf116bf46921 Mon Sep 17 00:00:00 2001 From: i-norden Date: Fri, 12 May 2023 10:27:20 -0500 Subject: [PATCH 16/18] update go mod --- go.mod | 10 +++++----- go.sum | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 9978868..b2e1eff 100644 --- a/go.mod +++ b/go.mod @@ -34,11 +34,11 @@ require ( github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/golang/snappy v0.0.4 // indirect + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.2.0 // indirect + github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.11.0 // indirect @@ -89,8 +89,8 @@ require ( github.com/yusufpapurcu/wmi v1.2.2 // indirect golang.org/x/crypto v0.6.0 // indirect golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect @@ -99,4 +99,4 @@ require ( lukechampine.com/blake3 v1.1.7 // indirect ) -replace github.com/ethereum/go-ethereum v1.11.5 => github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.2-alpha +replace github.com/ethereum/go-ethereum v1.11.5 => github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.3-alpha diff --git a/go.sum b/go.sum index e81f6fa..e5f7bd1 100644 --- a/go.sum +++ b/go.sum @@ -59,8 +59,8 @@ github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPx github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.2-alpha h1:QFr7avu0VLqVWowBvYtsFVVM4MukrXpWFhoAXWVEFHA= -github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.2-alpha/go.mod h1:DIk2wFexjyzvyjuzSOtBEIAPRNZTnLXNbIHEyq1Igek= +github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.3-alpha h1:rhRmK/NeWMnQ07E4DuLb7WSh9FMotlXMPPaOrf8GJwM= +github.com/cerc-io/go-ethereum v1.11.5-statediff-5.0.3-alpha/go.mod h1:DIk2wFexjyzvyjuzSOtBEIAPRNZTnLXNbIHEyq1Igek= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -204,8 +204,9 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -254,8 +255,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= -github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= +github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= @@ -794,8 +795,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -808,8 +809,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 6de5b9e96c091db2dfe1072c9aacfcc4a039c161 Mon Sep 17 00:00:00 2001 From: i-norden Date: Fri, 12 May 2023 10:41:18 -0500 Subject: [PATCH 17/18] update misc --- .gitignore | 1 + environments/example.toml | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index f8df831..4b9b68b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ ipld-eth-state-snapshot mocks/ .vscode output_dir*/ +log_file diff --git a/environments/example.toml b/environments/example.toml index c911703..5eb8f36 100644 --- a/environments/example.toml +++ b/environments/example.toml @@ -1,12 +1,13 @@ [database] - name = "vulcanize_public" + name = "cerc_testing" hostname = "localhost" - port = 5432 - user = "postgres" + port = 8077 + user = "vdbm" + password = "password" [leveldb] - path = "/Users/iannorden/Library/Ethereum/geth/chaindata" - ancient = "/Users/iannorden/Library/Ethereum/geth/chaindata/ancient" + path = "/Users/user/go/src/github.com/cerc-io/ipld-eth-state-snapshot/fixture/chain2data" + ancient = "/Users/user/go/src/github.com/cerc-io/ipld-eth-state-snapshot/fixture/chain2data/ancient" [log] level = "info" @@ -22,7 +23,7 @@ [snapshot] mode = "file" workers = 4 - blockHeight = -1 + blockHeight = 32 recoveryFile = "recovery_file" startHeight = 1 From 98015c4c872bd492c6a494ddea57fa61f65e5a1c Mon Sep 17 00:00:00 2001 From: i-norden Date: Fri, 12 May 2023 11:11:00 -0500 Subject: [PATCH 18/18] fix NUMERIC formattign error --- pkg/snapshot/file/publisher.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/snapshot/file/publisher.go b/pkg/snapshot/file/publisher.go index 8a77325..c13025d 100644 --- a/pkg/snapshot/file/publisher.go +++ b/pkg/snapshot/file/publisher.go @@ -191,9 +191,9 @@ func (p *publisher) PublishHeader(header *types.Header) error { header.Hash().Hex(), header.ParentHash.Hex(), headerNode.Cid().String(), - 0, + "0", pq.StringArray([]string{p.nodeInfo.ID}), - 0, + "0", header.Root.Hex(), header.TxHash.Hex(), header.ReceiptHash.Hex(),