ipld-eth-statedb initialization/instantiation
This commit is contained in:
parent
df8bec1ad0
commit
4678b6a733
4
go.mod
4
go.mod
@ -13,7 +13,6 @@ require (
|
||||
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/jackc/pgx/v4 v4.18.1
|
||||
github.com/jmoiron/sqlx v1.3.5
|
||||
github.com/joho/godotenv v1.4.0
|
||||
github.com/lib/pq v1.10.6
|
||||
@ -146,6 +145,7 @@ require (
|
||||
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
||||
github.com/jackc/pgtype v1.14.0 // indirect
|
||||
github.com/jackc/pgx/v4 v4.18.1 // indirect
|
||||
github.com/jackc/puddle v1.3.0 // indirect
|
||||
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
||||
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
|
||||
@ -295,3 +295,5 @@ require (
|
||||
)
|
||||
|
||||
replace github.com/ethereum/go-ethereum v1.10.26 => github.com/cerc-io/go-ethereum v1.10.26-statediff-4.2.2-alpha
|
||||
|
||||
replace github.com/cerc-io/ipld-eth-statedb v0.0.2-alpha => /Users/iannorden/go/src/github.com/cerc-io/ipld-eth-statedb
|
||||
|
2
go.sum
2
go.sum
@ -153,8 +153,6 @@ github.com/cerc-io/go-ethereum v1.10.26-statediff-4.2.2-alpha h1:gesMZEbNU+fcAMc
|
||||
github.com/cerc-io/go-ethereum v1.10.26-statediff-4.2.2-alpha/go.mod h1:lKBVBWksSwBDR/5D9CAxaGQzDPIS3ueWb6idy7X1Shg=
|
||||
github.com/cerc-io/ipfs-ethdb/v4 v4.0.10-alpha h1:5iqNXeitkj3g7FxyKK/Pz+1HN7Ac9JZzCRj3Lv+uHiw=
|
||||
github.com/cerc-io/ipfs-ethdb/v4 v4.0.10-alpha/go.mod h1:dPscFRMvTWPKnoZ4U0D9v4bsrw6XdH7sOp8hUrVzOWA=
|
||||
github.com/cerc-io/ipld-eth-statedb v0.0.2-alpha h1:Dj6XG6T14iHRBMFYHKcnMkNsdxZ7xqAaah2Z+QiOe1k=
|
||||
github.com/cerc-io/ipld-eth-statedb v0.0.2-alpha/go.mod h1:914KQXnRylWQxRQOvlIr74NmGw7t1CyJJaEr5VSKW8E=
|
||||
github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=
|
||||
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
|
||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
|
@ -25,8 +25,6 @@ import (
|
||||
"math/big"
|
||||
"time"
|
||||
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
|
||||
validator "github.com/cerc-io/eth-ipfs-state-validator/v4/pkg"
|
||||
ipfsethdb "github.com/cerc-io/ipfs-ethdb/v4/postgres"
|
||||
"github.com/cerc-io/ipld-eth-server/v4/pkg/log"
|
||||
@ -111,7 +109,7 @@ type Backend struct {
|
||||
EthDB ethdb.Database
|
||||
StateDatabase state.Database
|
||||
// We'll use this state.Database for eth_call and any place we don't need trie access
|
||||
IpldStateDatabase ipld_eth_statedb.Database
|
||||
IpldStateDatabase ipld_eth_statedb.StateDatabase
|
||||
|
||||
Config *Config
|
||||
}
|
||||
@ -124,7 +122,7 @@ type Config struct {
|
||||
GroupCacheConfig *shared.GroupCacheConfig
|
||||
}
|
||||
|
||||
func NewEthBackend(db *sqlx.DB, pgxdb *pgxpool.Pool, c *Config) (*Backend, error) {
|
||||
func NewEthBackend(db *sqlx.DB, c *Config) (*Backend, error) {
|
||||
gcc := c.GroupCacheConfig
|
||||
|
||||
groupName := gcc.StateDB.Name
|
||||
@ -140,7 +138,7 @@ func NewEthBackend(db *sqlx.DB, pgxdb *pgxpool.Pool, c *Config) (*Backend, error
|
||||
})
|
||||
|
||||
logStateDBStatsOnTimer(ethDB.(*ipfsethdb.Database), gcc)
|
||||
ipldStateDB, err := ipld_eth_statedb.NewStateDatabaseWithPool(pgxdb)
|
||||
ipldStateDB, err := ipld_eth_statedb.NewStateDatabaseWithSqlxPool(db)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ type Service struct {
|
||||
sync.Mutex
|
||||
// Used to signal shutdown of the service
|
||||
QuitChan chan bool
|
||||
// Underlying db
|
||||
// Underlying db connection pool
|
||||
db *sqlx.DB
|
||||
// rpc client for forwarding cache misses
|
||||
client *rpc.Client
|
||||
|
Loading…
Reference in New Issue
Block a user