Author SHA1 Message Date
telackey a6301feb30 Tweak defaults 2022-10-11 16:10:39 -05:00
telackey 4b3ec1b5a0 Typo 2022-10-11 16:06:01 -05:00
telackey 534b0fe31d Add docker-compose.yml 2022-10-11 16:01:30 -05:00
4 changed files with 83 additions and 35 deletions
+36
View File
@@ -0,0 +1,36 @@
version: "3.2"
services:
ipld-eth-beacon-db:
hostname: ipld-eth-beacon-db
env_file:
- docker.env
restart: always
build:
dockerfile: ../ipld-eth-beacon-db/Dockerfile
context: ../ipld-eth-beacon-db
image: cerc/ipld-eth-beacon-db:local
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "5432"]
interval: 5s
timeout: 3s
retries: 5
volumes:
- vdb_db_eth-beacon_db:/var/lib/postgresql/data
ports:
- "5432"
command: ["postgres", "-c", "log_min_duration_statement=250"]
ipld-eth-beacon-indexer:
hostname: ipld-eth-beacon-indexer
env_file:
- docker.env
restart: always
build:
dockerfile: ./Dockerfile
context: .
depends_on:
- ipld-eth-beacon-db
image: cerc/ipld-eth-beacon-indexer:local
volumes:
vdb_db_eth-beacon_db:
+28
View File
@@ -0,0 +1,28 @@
POSTGRES_HOST=ipld-eth-beacon-db
POSTGRES_PASSWORD=CHANGEME
POSTGRES_PORT=5432
POSTGRES_USER=ethbeacondb
POSTGRES_DB=ethbeacondb
LIGHTHOUSE_HOST=host.docker.internal
LIGHTHOUSE_PORT=5052
LIGHTHOUSE_PROTOCOL=http
CAPTURE_MODE=head
LOG_LEVEL=debug
BC_MAX_HISTORIC_PROCESS_WORKER=2
BC_UNIQUE_NODE_IDENTIFIER=100
BC_CHECK_DB=true
BC_BEACON_STATE_PROCESSING_ENABLED=false
BC_BEACON_BLOCK_PROCESSING_ENABLED=true
BC_MINIMUM_SLOT=4700013
KG_INCREMENT=10000
KG_PROCESS_KNOWN_GAPS_ENABLED=true
KG_MAX_KNOWN_GAPS_WORKER=2
KG_MINIMUM_SLOT=4700013
PROM_HOST=host.docker.internal
PROM_PORT=9000
PROM_METRICS_ENABLED=false
+7 -33
View File
@@ -17,14 +17,12 @@ import (
"github.com/vulcanize/ipld-eth-beacon-indexer/pkg/beaconclient"
"github.com/vulcanize/ipld-eth-beacon-indexer/pkg/database/sql"
"math/big"
"os"
"strconv"
"time"
)
var _ = Describe("e2emerge", Label("e2e"), func() {
e2eConfig := TestConfig
e2eConfig.port = getEnvInt("TEST_E2E_LIGHTHOUSE_PORT", 5052)
e2eConfig.port = 5052
e2eConfig.performBeaconStateProcessing = false
e2eConfig.performBeaconBlockProcessing = true
@@ -125,10 +123,10 @@ func sendTestTx() (*SentTx, error) {
tx, err := sendTransaction(
ctx,
eth,
getEnvStr("TEST_E2E_FROM_ADDR", "0xe6ce22afe802caf5ff7d3845cec8c736ecc8d61f"),
getEnvStr("TEST_E2E_TO_ADDR", "0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"),
int64(getEnvInt("TEST_E2E_AMOUNT", 10)),
getEnvStr("TEST_E2E_SIGNING_KEY", "0x888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218"),
"0xe6ce22afe802caf5ff7d3845cec8c736ecc8d61f",
"0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a",
10,
"0x888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218",
)
Expect(err).ToNot(HaveOccurred())
@@ -157,7 +155,7 @@ func sendTestTx() (*SentTx, error) {
}
func createClient() (*ethclient.Client, error) {
return ethclient.Dial(getEnvStr("TEST_E2E_GETH_URL", "http://localhost:8545"))
return ethclient.Dial("http://localhost:8545")
}
// sendTransaction sends a transaction with 1 ETH to a specified address.
@@ -167,7 +165,7 @@ func sendTransaction(ctx context.Context, eth *ethclient.Client, fromAddr string
to = common.HexToAddress(toAddr)
sk = crypto.ToECDSAUnsafe(common.FromHex(signingKey))
value = big.NewInt(amount)
gasLimit = uint64(getEnvInt("TEST_E2E_GAS_LIMIT", 21000))
gasLimit = uint64(21000)
)
// Retrieve the chainid (needed for signer)
chainid, err := eth.ChainID(ctx)
@@ -182,8 +180,6 @@ func sendTransaction(ctx context.Context, eth *ethclient.Client, fromAddr string
// Get suggested gas price
tipCap, _ := eth.SuggestGasTipCap(ctx)
feeCap, _ := eth.SuggestGasPrice(ctx)
log.Info("Tip cap: ", tipCap)
log.Info("Fee cap: ", feeCap)
// Create a new transaction
tx := types.NewTx(
&types.DynamicFeeTx{
@@ -201,25 +197,3 @@ func sendTransaction(ctx context.Context, eth *ethclient.Client, fromAddr string
// Send the transaction to our node
return signedTx, eth.SendTransaction(ctx, signedTx)
}
func getEnvStr(envVar string, def string) string {
value, set := os.LookupEnv(envVar)
if set {
return value
} else {
return def
}
}
func getEnvInt(envVar string, def int) int {
value, set := os.LookupEnv(envVar)
if set {
number, err := strconv.Atoi(value)
if err != nil {
return def
}
return number
} else {
return def
}
}
+12 -2
View File
@@ -3,6 +3,7 @@ package beaconclient_test
import (
log "github.com/sirupsen/logrus"
"os"
"strconv"
"time"
. "github.com/onsi/ginkgo/v2"
@@ -14,9 +15,9 @@ var (
prodConfig = Config{
protocol: os.Getenv("bc_protocol"),
address: os.Getenv("bc_address"),
port: getEnvInt(os.Getenv("bc_port"), 5052),
port: getEnvInt(os.Getenv("bc_port")),
dbHost: os.Getenv("db_host"),
dbPort: getEnvInt(os.Getenv("db_port"), 8076),
dbPort: getEnvInt(os.Getenv("db_port")),
dbName: os.Getenv("db_name"),
dbUser: os.Getenv("db_user"),
dbPassword: os.Getenv("db_password"),
@@ -61,6 +62,15 @@ var _ = Describe("Systemvalidation", Label("system"), func() {
})
})
// Wrapper function to get int env variables.
func getEnvInt(envVar string) int {
val, err := strconv.Atoi(envVar)
if err != nil {
return 0
}
return val
}
// Start head tracking and wait for the expected results.
func processProdHeadBlocks(bc *beaconclient.BeaconClient, expectedInserts, expectedReorgs, expectedKnownGaps, expectedKnownGapsReprocessError uint64) {
go bc.CaptureHead()