linting fixes
This commit is contained in:
parent
5f4968b3cd
commit
9a67034f29
@ -315,10 +315,7 @@ func (sdi *StateDiffIndexer) processReceiptsAndTxs(tx *BatchTx, args processArgs
|
|||||||
Data: trx.Data(),
|
Data: trx.Data(),
|
||||||
CID: txNode.Cid().String(),
|
CID: txNode.Cid().String(),
|
||||||
MhKey: shared.MultihashKeyFromCID(txNode.Cid()),
|
MhKey: shared.MultihashKeyFromCID(txNode.Cid()),
|
||||||
}
|
Type: trx.Type(),
|
||||||
txType := trx.Type()
|
|
||||||
if txType != types.LegacyTxType {
|
|
||||||
txModel.Type = &txType
|
|
||||||
}
|
}
|
||||||
if _, err := fmt.Fprintf(sdi.dump, "%+v\r\n", txModel); err != nil {
|
if _, err := fmt.Fprintf(sdi.dump, "%+v\r\n", txModel); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -366,10 +366,7 @@ func (sdi *StateDiffIndexer) processReceiptsAndTxs(tx *BatchTx, args processArgs
|
|||||||
Data: trx.Data(),
|
Data: trx.Data(),
|
||||||
CID: txNode.Cid().String(),
|
CID: txNode.Cid().String(),
|
||||||
MhKey: shared.MultihashKeyFromCID(txNode.Cid()),
|
MhKey: shared.MultihashKeyFromCID(txNode.Cid()),
|
||||||
}
|
Type: trx.Type(),
|
||||||
txType := trx.Type()
|
|
||||||
if txType != types.LegacyTxType {
|
|
||||||
txModel.Type = &txType
|
|
||||||
}
|
}
|
||||||
txID, err := sdi.dbWriter.upsertTransactionCID(tx.dbtx, txModel, args.headerID)
|
txID, err := sdi.dbWriter.upsertTransactionCID(tx.dbtx, txModel, args.headerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -67,7 +67,6 @@ type Tx interface {
|
|||||||
// ScannableRow interface to accommodate different concrete row types
|
// ScannableRow interface to accommodate different concrete row types
|
||||||
type ScannableRow interface {
|
type ScannableRow interface {
|
||||||
Scan(dest ...interface{}) error
|
Scan(dest ...interface{}) error
|
||||||
StructScan(dest interface{}) error
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Result interface to accommodate different concrete result types
|
// Result interface to accommodate different concrete result types
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/jmoiron/sqlx"
|
||||||
"github.com/multiformats/go-multihash"
|
"github.com/multiformats/go-multihash"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
@ -76,7 +77,7 @@ func TestPGXIndexerLegacy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
header := new(res)
|
header := new(res)
|
||||||
|
|
||||||
err = db.QueryRow(context.Background(), pgStr, legacyData.BlockNumber.Uint64()).StructScan(header)
|
err = db.QueryRow(context.Background(), pgStr, legacyData.BlockNumber.Uint64()).(*sqlx.Row).StructScan(header)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
test_helpers.ExpectEqual(t, header.CID, legacyHeaderCID.String())
|
test_helpers.ExpectEqual(t, header.CID, legacyHeaderCID.String())
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
||||||
dshelp "github.com/ipfs/go-ipfs-ds-help"
|
dshelp "github.com/ipfs/go-ipfs-ds-help"
|
||||||
|
"github.com/jmoiron/sqlx"
|
||||||
"github.com/multiformats/go-multihash"
|
"github.com/multiformats/go-multihash"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
@ -164,7 +165,7 @@ func TestPGXIndexer(t *testing.T) {
|
|||||||
BaseFee *int64 `db:"base_fee"`
|
BaseFee *int64 `db:"base_fee"`
|
||||||
}
|
}
|
||||||
header := new(res)
|
header := new(res)
|
||||||
err = db.QueryRow(context.Background(), pgStr, mocks.BlockNumber.Uint64()).StructScan(header)
|
err = db.QueryRow(context.Background(), pgStr, mocks.BlockNumber.Uint64()).(*sqlx.Row).StructScan(header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -216,12 +217,12 @@ func TestPGXIndexer(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
txTypePgStr := `SELECT tx_type FROM eth.transaction_cids WHERE cid = $1`
|
||||||
switch c {
|
switch c {
|
||||||
case trx1CID.String():
|
case trx1CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, tx1)
|
test_helpers.ExpectEqual(t, data, tx1)
|
||||||
var txType *uint8
|
var txType *uint8
|
||||||
pgStr = `SELECT tx_type FROM eth.transaction_cids WHERE cid = $1`
|
err = db.Get(context.Background(), &txType, txTypePgStr, c)
|
||||||
err = db.Get(context.Background(), &txType, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -231,8 +232,7 @@ func TestPGXIndexer(t *testing.T) {
|
|||||||
case trx2CID.String():
|
case trx2CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, tx2)
|
test_helpers.ExpectEqual(t, data, tx2)
|
||||||
var txType *uint8
|
var txType *uint8
|
||||||
pgStr = `SELECT tx_type FROM eth.transaction_cids WHERE cid = $1`
|
err = db.Get(context.Background(), &txType, txTypePgStr, c)
|
||||||
err = db.Get(context.Background(), &txType, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -242,8 +242,7 @@ func TestPGXIndexer(t *testing.T) {
|
|||||||
case trx3CID.String():
|
case trx3CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, tx3)
|
test_helpers.ExpectEqual(t, data, tx3)
|
||||||
var txType *uint8
|
var txType *uint8
|
||||||
pgStr = `SELECT tx_type FROM eth.transaction_cids WHERE cid = $1`
|
err = db.Get(context.Background(), &txType, txTypePgStr, c)
|
||||||
err = db.Get(context.Background(), &txType, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -253,8 +252,7 @@ func TestPGXIndexer(t *testing.T) {
|
|||||||
case trx4CID.String():
|
case trx4CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, tx4)
|
test_helpers.ExpectEqual(t, data, tx4)
|
||||||
var txType *uint8
|
var txType *uint8
|
||||||
pgStr = `SELECT tx_type FROM eth.transaction_cids WHERE cid = $1`
|
err = db.Get(context.Background(), &txType, txTypePgStr, c)
|
||||||
err = db.Get(context.Background(), &txType, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -284,8 +282,7 @@ func TestPGXIndexer(t *testing.T) {
|
|||||||
case trx5CID.String():
|
case trx5CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, tx5)
|
test_helpers.ExpectEqual(t, data, tx5)
|
||||||
var txType *uint8
|
var txType *uint8
|
||||||
pgStr = `SELECT tx_type FROM eth.transaction_cids WHERE cid = $1`
|
err = db.Get(context.Background(), &txType, txTypePgStr, c)
|
||||||
err = db.Get(context.Background(), &txType, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -398,6 +395,7 @@ func TestPGXIndexer(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postStatePgStr := `SELECT post_state FROM eth.receipt_cids WHERE leaf_cid = $1`
|
||||||
switch c {
|
switch c {
|
||||||
case rct1CID.String():
|
case rct1CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, rct1)
|
test_helpers.ExpectEqual(t, data, rct1)
|
||||||
@ -411,8 +409,7 @@ func TestPGXIndexer(t *testing.T) {
|
|||||||
case rct2CID.String():
|
case rct2CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, rct2)
|
test_helpers.ExpectEqual(t, data, rct2)
|
||||||
var postState string
|
var postState string
|
||||||
pgStr = `SELECT post_state FROM eth.receipt_cids WHERE leaf_cid = $1`
|
err = db.Get(context.Background(), &postState, postStatePgStr, c)
|
||||||
err = db.Get(context.Background(), &postState, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -420,8 +417,7 @@ func TestPGXIndexer(t *testing.T) {
|
|||||||
case rct3CID.String():
|
case rct3CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, rct3)
|
test_helpers.ExpectEqual(t, data, rct3)
|
||||||
var postState string
|
var postState string
|
||||||
pgStr = `SELECT post_state FROM eth.receipt_cids WHERE leaf_cid = $1`
|
err = db.Get(context.Background(), &postState, postStatePgStr, c)
|
||||||
err = db.Get(context.Background(), &postState, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -429,8 +425,7 @@ func TestPGXIndexer(t *testing.T) {
|
|||||||
case rct4CID.String():
|
case rct4CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, rct4)
|
test_helpers.ExpectEqual(t, data, rct4)
|
||||||
var postState string
|
var postState string
|
||||||
pgStr = `SELECT post_state FROM eth.receipt_cids WHERE leaf_cid = $1`
|
err = db.Get(context.Background(), &postState, postStatePgStr, c)
|
||||||
err = db.Get(context.Background(), &postState, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -438,8 +433,7 @@ func TestPGXIndexer(t *testing.T) {
|
|||||||
case rct5CID.String():
|
case rct5CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, rct5)
|
test_helpers.ExpectEqual(t, data, rct5)
|
||||||
var postState string
|
var postState string
|
||||||
pgStr = `SELECT post_state FROM eth.receipt_cids WHERE leaf_cid = $1`
|
err = db.Get(context.Background(), &postState, postStatePgStr, c)
|
||||||
err = db.Get(context.Background(), &postState, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/statediff/indexer/shared"
|
"github.com/ethereum/go-ethereum/statediff/indexer/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DriverType to explicity type the kind of sql driver we are using
|
// DriverType to explicitly type the kind of sql driver we are using
|
||||||
type DriverType string
|
type DriverType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -105,8 +105,7 @@ func (pgx *PGXDriver) createNode() error {
|
|||||||
|
|
||||||
// QueryRow satisfies sql.Database
|
// QueryRow satisfies sql.Database
|
||||||
func (pgx *PGXDriver) QueryRow(ctx context.Context, sql string, args ...interface{}) sql.ScannableRow {
|
func (pgx *PGXDriver) QueryRow(ctx context.Context, sql string, args ...interface{}) sql.ScannableRow {
|
||||||
rows, _ := pgx.pool.Query(ctx, sql, args...)
|
return pgx.pool.QueryRow(ctx, sql, args...)
|
||||||
return rowsWrapper{rows: rows}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exec satisfies sql.Database
|
// Exec satisfies sql.Database
|
||||||
@ -160,20 +159,6 @@ func (pgx *PGXDriver) Context() context.Context {
|
|||||||
return pgx.ctx
|
return pgx.ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
type rowsWrapper struct {
|
|
||||||
rows pgx.Rows
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scan satisfies sql.ScannableRow
|
|
||||||
func (r rowsWrapper) Scan(dest ...interface{}) error {
|
|
||||||
return (pgx.Row)(r.rows).Scan(dest...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// StructScan satisfies sql.ScannableRow
|
|
||||||
func (r rowsWrapper) StructScan(dest interface{}) error {
|
|
||||||
return pgxscan.ScanRow(dest, r.rows)
|
|
||||||
}
|
|
||||||
|
|
||||||
type resultWrapper struct {
|
type resultWrapper struct {
|
||||||
ct pgconn.CommandTag
|
ct pgconn.CommandTag
|
||||||
}
|
}
|
||||||
@ -234,8 +219,7 @@ type pgxTxWrapper struct {
|
|||||||
|
|
||||||
// QueryRow satisfies sql.Tx
|
// QueryRow satisfies sql.Tx
|
||||||
func (t pgxTxWrapper) QueryRow(ctx context.Context, sql string, args ...interface{}) sql.ScannableRow {
|
func (t pgxTxWrapper) QueryRow(ctx context.Context, sql string, args ...interface{}) sql.ScannableRow {
|
||||||
rows, _ := t.tx.Query(ctx, sql, args...)
|
return t.tx.QueryRow(ctx, sql, args...)
|
||||||
return rowsWrapper{rows: rows}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exec satisfies sql.Tx
|
// Exec satisfies sql.Tx
|
||||||
|
@ -20,15 +20,15 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres"
|
|
||||||
"github.com/ethereum/go-ethereum/statediff/indexer/interfaces"
|
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
|
"github.com/jmoiron/sqlx"
|
||||||
"github.com/multiformats/go-multihash"
|
"github.com/multiformats/go-multihash"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"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"
|
||||||
|
"github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres"
|
||||||
|
"github.com/ethereum/go-ethereum/statediff/indexer/interfaces"
|
||||||
"github.com/ethereum/go-ethereum/statediff/indexer/ipld"
|
"github.com/ethereum/go-ethereum/statediff/indexer/ipld"
|
||||||
"github.com/ethereum/go-ethereum/statediff/indexer/mocks"
|
"github.com/ethereum/go-ethereum/statediff/indexer/mocks"
|
||||||
"github.com/ethereum/go-ethereum/statediff/indexer/test_helpers"
|
"github.com/ethereum/go-ethereum/statediff/indexer/test_helpers"
|
||||||
@ -85,7 +85,7 @@ func TestSQLXIndexerLegacy(t *testing.T) {
|
|||||||
BaseFee *int64 `db:"base_fee"`
|
BaseFee *int64 `db:"base_fee"`
|
||||||
}
|
}
|
||||||
header := new(res)
|
header := new(res)
|
||||||
err = db.QueryRow(context.Background(), pgStr, legacyData.BlockNumber.Uint64()).StructScan(header)
|
err = db.QueryRow(context.Background(), pgStr, legacyData.BlockNumber.Uint64()).(*sqlx.Row).StructScan(header)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
test_helpers.ExpectEqual(t, header.CID, legacyHeaderCID.String())
|
test_helpers.ExpectEqual(t, header.CID, legacyHeaderCID.String())
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
||||||
dshelp "github.com/ipfs/go-ipfs-ds-help"
|
dshelp "github.com/ipfs/go-ipfs-ds-help"
|
||||||
|
"github.com/jmoiron/sqlx"
|
||||||
"github.com/multiformats/go-multihash"
|
"github.com/multiformats/go-multihash"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
@ -190,7 +191,7 @@ func TestSQLXIndexer(t *testing.T) {
|
|||||||
BaseFee *int64 `db:"base_fee"`
|
BaseFee *int64 `db:"base_fee"`
|
||||||
}
|
}
|
||||||
header := new(res)
|
header := new(res)
|
||||||
err = db.QueryRow(context.Background(), pgStr, mocks.BlockNumber.Uint64()).StructScan(header)
|
err = db.QueryRow(context.Background(), pgStr, mocks.BlockNumber.Uint64()).(*sqlx.Row).StructScan(header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -242,50 +243,47 @@ func TestSQLXIndexer(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
txTypePgStr := `SELECT tx_type FROM eth.transaction_cids WHERE cid = $1`
|
||||||
switch c {
|
switch c {
|
||||||
case trx1CID.String():
|
case trx1CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, tx1)
|
test_helpers.ExpectEqual(t, data, tx1)
|
||||||
var txType *uint8
|
var txType uint8
|
||||||
pgStr = `SELECT tx_type FROM eth.transaction_cids WHERE cid = $1`
|
err = db.Get(context.Background(), &txType, txTypePgStr, c)
|
||||||
err = db.Get(context.Background(), &txType, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if txType != nil {
|
if txType != 0 {
|
||||||
t.Fatalf("expected nil tx_type, got %d", *txType)
|
t.Fatalf("expected LegacyTxType (0), got %d", txType)
|
||||||
}
|
}
|
||||||
case trx2CID.String():
|
case trx2CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, tx2)
|
test_helpers.ExpectEqual(t, data, tx2)
|
||||||
var txType *uint8
|
var txType uint8
|
||||||
pgStr = `SELECT tx_type FROM eth.transaction_cids WHERE cid = $1`
|
err = db.Get(context.Background(), &txType, txTypePgStr, c)
|
||||||
err = db.Get(context.Background(), &txType, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if txType != nil {
|
if txType != 0 {
|
||||||
t.Fatalf("expected nil tx_type, got %d", *txType)
|
t.Fatalf("expected LegacyTxType (0), got %d", txType)
|
||||||
}
|
}
|
||||||
case trx3CID.String():
|
case trx3CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, tx3)
|
test_helpers.ExpectEqual(t, data, tx3)
|
||||||
var txType *uint8
|
var txType uint8
|
||||||
pgStr = `SELECT tx_type FROM eth.transaction_cids WHERE cid = $1`
|
err = db.Get(context.Background(), &txType, txTypePgStr, c)
|
||||||
err = db.Get(context.Background(), &txType, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if txType != nil {
|
if txType != 0 {
|
||||||
t.Fatalf("expected nil tx_type, got %d", *txType)
|
t.Fatalf("expected LegacyTxType (0), got %d", txType)
|
||||||
}
|
}
|
||||||
case trx4CID.String():
|
case trx4CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, tx4)
|
test_helpers.ExpectEqual(t, data, tx4)
|
||||||
var txType *uint8
|
var txType uint8
|
||||||
pgStr = `SELECT tx_type FROM eth.transaction_cids WHERE cid = $1`
|
err = db.Get(context.Background(), &txType, txTypePgStr, c)
|
||||||
err = db.Get(context.Background(), &txType, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if *txType != types.AccessListTxType {
|
if txType != types.AccessListTxType {
|
||||||
t.Fatalf("expected AccessListTxType (1), got %d", *txType)
|
t.Fatalf("expected AccessListTxType (1), got %d", txType)
|
||||||
}
|
}
|
||||||
accessListElementModels := make([]models.AccessListElementModel, 0)
|
accessListElementModels := make([]models.AccessListElementModel, 0)
|
||||||
pgStr = `SELECT access_list_element.* FROM eth.access_list_element INNER JOIN eth.transaction_cids ON (tx_id = transaction_cids.id) WHERE cid = $1 ORDER BY access_list_element.index ASC`
|
pgStr = `SELECT access_list_element.* FROM eth.access_list_element INNER JOIN eth.transaction_cids ON (tx_id = transaction_cids.id) WHERE cid = $1 ORDER BY access_list_element.index ASC`
|
||||||
@ -310,8 +308,7 @@ func TestSQLXIndexer(t *testing.T) {
|
|||||||
case trx5CID.String():
|
case trx5CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, tx5)
|
test_helpers.ExpectEqual(t, data, tx5)
|
||||||
var txType *uint8
|
var txType *uint8
|
||||||
pgStr = `SELECT tx_type FROM eth.transaction_cids WHERE cid = $1`
|
err = db.Get(context.Background(), &txType, txTypePgStr, c)
|
||||||
err = db.Get(context.Background(), &txType, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -423,7 +420,7 @@ func TestSQLXIndexer(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
postStatePgStr := `SELECT post_state FROM eth.receipt_cids WHERE leaf_cid = $1`
|
||||||
switch c {
|
switch c {
|
||||||
case rct1CID.String():
|
case rct1CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, rct1)
|
test_helpers.ExpectEqual(t, data, rct1)
|
||||||
@ -437,8 +434,7 @@ func TestSQLXIndexer(t *testing.T) {
|
|||||||
case rct2CID.String():
|
case rct2CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, rct2)
|
test_helpers.ExpectEqual(t, data, rct2)
|
||||||
var postState string
|
var postState string
|
||||||
pgStr = `SELECT post_state FROM eth.receipt_cids WHERE leaf_cid = $1`
|
err = db.Get(context.Background(), &postState, postStatePgStr, c)
|
||||||
err = db.Get(context.Background(), &postState, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -446,8 +442,7 @@ func TestSQLXIndexer(t *testing.T) {
|
|||||||
case rct3CID.String():
|
case rct3CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, rct3)
|
test_helpers.ExpectEqual(t, data, rct3)
|
||||||
var postState string
|
var postState string
|
||||||
pgStr = `SELECT post_state FROM eth.receipt_cids WHERE leaf_cid = $1`
|
err = db.Get(context.Background(), &postState, postStatePgStr, c)
|
||||||
err = db.Get(context.Background(), &postState, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -455,8 +450,7 @@ func TestSQLXIndexer(t *testing.T) {
|
|||||||
case rct4CID.String():
|
case rct4CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, rct4)
|
test_helpers.ExpectEqual(t, data, rct4)
|
||||||
var postState string
|
var postState string
|
||||||
pgStr = `SELECT post_state FROM eth.receipt_cids WHERE leaf_cid = $1`
|
err = db.Get(context.Background(), &postState, postStatePgStr, c)
|
||||||
err = db.Get(context.Background(), &postState, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -464,8 +458,7 @@ func TestSQLXIndexer(t *testing.T) {
|
|||||||
case rct5CID.String():
|
case rct5CID.String():
|
||||||
test_helpers.ExpectEqual(t, data, rct5)
|
test_helpers.ExpectEqual(t, data, rct5)
|
||||||
var postState string
|
var postState string
|
||||||
pgStr = `SELECT post_state FROM eth.receipt_cids WHERE leaf_cid = $1`
|
err = db.Get(context.Background(), &postState, postStatePgStr, c)
|
||||||
err = db.Get(context.Background(), &postState, pgStr, c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ type TxModel struct {
|
|||||||
Dst string `db:"dst"`
|
Dst string `db:"dst"`
|
||||||
Src string `db:"src"`
|
Src string `db:"src"`
|
||||||
Data []byte `db:"tx_data"`
|
Data []byte `db:"tx_data"`
|
||||||
Type *uint8 `db:"tx_type"`
|
Type uint8 `db:"tx_type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AccessListElementModel is the db model for eth.access_list_entry
|
// AccessListElementModel is the db model for eth.access_list_entry
|
||||||
|
@ -27,7 +27,7 @@ type DBType string
|
|||||||
const (
|
const (
|
||||||
POSTGRES DBType = "Postgres"
|
POSTGRES DBType = "Postgres"
|
||||||
DUMP DBType = "Dump"
|
DUMP DBType = "Dump"
|
||||||
UNKOWN DBType = "Unknown"
|
UNKNOWN DBType = "Unknown"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ResolveDBType resolves a DBType from a provided string
|
// ResolveDBType resolves a DBType from a provided string
|
||||||
@ -38,6 +38,6 @@ func ResolveDBType(str string) (DBType, error) {
|
|||||||
case "dump", "d":
|
case "dump", "d":
|
||||||
return DUMP, nil
|
return DUMP, nil
|
||||||
default:
|
default:
|
||||||
return UNKOWN, fmt.Errorf("unrecognized db type string: %s", str)
|
return UNKNOWN, fmt.Errorf("unrecognized db type string: %s", str)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user