Skip to content

Commit

Permalink
Merge branch 'saveETH1Data' of https://github.com/prysmaticlabs/geth-…
Browse files Browse the repository at this point in the history
…sharding into saveETH1Data
  • Loading branch information
nisdas committed Dec 18, 2019
2 parents c5edd03 + 69f95a1 commit 769480a
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 26 deletions.
11 changes: 4 additions & 7 deletions INTEROP.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ Open up two terminal windows, run:

```
bazel run //beacon-chain -- \
--no-genesis-delay \
--bootstrap-node= \
--deposit-contract $(curl https://prylabs.net/contract) \
--clear-db \
--deposit-contract $(curl -s https://prylabs.net/contract) \
--force-clear-db \
--interop-num-validators 64 \
--interop-eth1data-votes
```
Expand All @@ -62,18 +61,16 @@ bazel run //validator -- --interop-num-validators 64
```

This will launch and kickstart the system with your 64 validators performing their duties accordingly.
specify which keys

### Launching from `genesis.ssz`

Assuming you generated a `genesis.ssz` file with 64 validators, open up two terminal windows, run:

```
bazel run //beacon-chain -- \
--no-genesis-delay \
--bootstrap-node= \
--deposit-contract $(curl https://prylabs.net/contract) \
--clear-db \
--deposit-contract $(curl -s https://prylabs.net/contract) \
--force-clear-db \
--interop-genesis-state /path/to/genesis.ssz \
--interop-eth1data-votes
```
Expand Down
26 changes: 22 additions & 4 deletions beacon-chain/db/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

# Build with --define=kafka_enabled=false to exclude kafka wrapper.
config_setting(
name = "kafka_disabled",
values = {"define": "kafka_enabled=false"},
)

# gazelle:ignore db.go db_kafka_wrapped.go
go_library(
name = "go_default_library",
srcs = [
"db.go",
"alias.go",
"http_backup_handler.go",
],
] + select({
"//conditions:default": [
"db_kafka_wrapped.go",
],
":kafka_disabled": [
"db.go",
],
}),
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/db",
visibility = [
"//beacon-chain:__subpackages__",
"//tools:__subpackages__",
],
deps = [
"//beacon-chain/db/iface:go_default_library",
"//beacon-chain/db/kafka:go_default_library",
"//beacon-chain/db/kv:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
] + select({
"//conditions:default": [
"//beacon-chain/db/kafka:go_default_library",
],
":kafka_disabled": [],
}),
)

go_test(
Expand Down
7 changes: 7 additions & 0 deletions beacon-chain/db/alias.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package db

import "github.com/prysmaticlabs/prysm/beacon-chain/db/iface"

// Database defines the necessary methods for Prysm's eth2 backend which may
// be implemented by any key-value or relational database in practice.
type Database = iface.Database
17 changes: 2 additions & 15 deletions beacon-chain/db/db.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
package db

import (
"github.com/prysmaticlabs/prysm/beacon-chain/db/iface"
"github.com/prysmaticlabs/prysm/beacon-chain/db/kafka"
"github.com/prysmaticlabs/prysm/beacon-chain/db/kv"
)

// Database defines the necessary methods for Prysm's eth2 backend which may
// be implemented by any key-value or relational database in practice.
type Database = iface.Database
import "github.com/prysmaticlabs/prysm/beacon-chain/db/kv"

// NewDB initializes a new DB.
func NewDB(dirPath string) (Database, error) {
db, err := kv.NewKVStore(dirPath)
if err != nil {
return nil, err
}

return kafka.Wrap(db)
return kv.NewKVStore(dirPath)
}
16 changes: 16 additions & 0 deletions beacon-chain/db/db_kafka_wrapped.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package db

import (
"github.com/prysmaticlabs/prysm/beacon-chain/db/kafka"
"github.com/prysmaticlabs/prysm/beacon-chain/db/kv"
)

// NewDB initializes a new DB with kafka wrapper.
func NewDB(dirPath string) (Database, error) {
db, err := kv.NewKVStore(dirPath)
if err != nil {
return nil, err
}

return kafka.Wrap(db)
}

0 comments on commit 769480a

Please sign in to comment.