2023-06-21 23:25:27 +00:00
|
|
|
package validator_test
|
|
|
|
|
|
|
|
import (
|
2024-04-23 10:25:17 +00:00
|
|
|
"context"
|
2023-06-21 23:25:27 +00:00
|
|
|
"math/big"
|
|
|
|
|
2024-04-23 10:25:17 +00:00
|
|
|
"github.com/cerc-io/plugeth-statediff/indexer/database/sql/postgres"
|
2023-06-21 23:25:27 +00:00
|
|
|
"github.com/ethereum/go-ethereum/params"
|
2024-04-23 10:25:17 +00:00
|
|
|
"github.com/jmoiron/sqlx"
|
2023-06-21 23:25:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var TestChainConfig = ¶ms.ChainConfig{
|
|
|
|
ChainID: big.NewInt(1),
|
|
|
|
HomesteadBlock: big.NewInt(0),
|
|
|
|
EIP150Block: big.NewInt(0),
|
|
|
|
EIP155Block: big.NewInt(0),
|
|
|
|
EIP158Block: big.NewInt(0),
|
|
|
|
ByzantiumBlock: big.NewInt(0),
|
|
|
|
ConstantinopleBlock: big.NewInt(0),
|
|
|
|
PetersburgBlock: big.NewInt(0),
|
|
|
|
IstanbulBlock: big.NewInt(0),
|
|
|
|
MuirGlacierBlock: big.NewInt(0),
|
|
|
|
BerlinBlock: big.NewInt(0),
|
|
|
|
LondonBlock: big.NewInt(6),
|
|
|
|
ArrowGlacierBlock: big.NewInt(0),
|
|
|
|
GrayGlacierBlock: big.NewInt(0),
|
|
|
|
Ethash: new(params.EthashConfig),
|
|
|
|
}
|
2024-04-23 10:25:17 +00:00
|
|
|
|
2024-04-25 15:19:10 +00:00
|
|
|
var TestDBConfig postgres.Config
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
var err error
|
|
|
|
TestDBConfig, err = postgres.TestConfig.WithEnv()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
2024-04-23 10:25:17 +00:00
|
|
|
|
|
|
|
func SetupDB() *sqlx.DB {
|
|
|
|
db, err := postgres.ConnectSQLX(context.Background(), TestDBConfig)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return db
|
|
|
|
}
|