Sync With Master (#2718)

This commit is contained in:
Nishant Das
2019-05-29 22:39:48 +08:00
committed by terence tsao
parent e7db3b2aa8
commit d3d6223b68
92 changed files with 3628 additions and 628 deletions

26
.well-known/security.txt Normal file
View File

@@ -0,0 +1,26 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Contact: mailto:security@prysmaticlabs.com
Encryption: openpgp4fpr:0AE0051D647BA3C1A917AF4072E33E4DF1A5036E
Encryption: openpgp4fpr:341396BAFACC28C5082327F889725027FC8EC0D4
Encryption: openpgp4fpr:8B7814F1B221A8E8AA465FC7BDBF744ADE1A0033
Preferred-Languages: en
Canonical: https://github.com/prysmaticlabs/prysm/tree/master/.well-known/security.txt
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEECuAFHWR7o8GpF69AcuM+TfGlA24FAlzi0WgACgkQcuM+TfGl
A241pw/+Ks3Hxx8eGbjRIeuncuK811FkCiofNJS+MY2p4W2/tIrk48DtLRx8/k5L
Dh1QyypZsqUgofrK7PbGVdEin6oEb2jYbTWUarAVTbhlsUdM4YcxwpgmGVslW7+C
Hm8wMasQZhCkFfakzhfKX5hIQoFaFI/OvtVKIQsodP8dAieCDaGmtfq1Bs1LgFqi
KrpeEdC2XbBQs33ADheC5SdGT1mnatP3VX8cOhLsfoPksYgTSpwK0clkoWs1eZOQ
l1ImfW/FJCpSndBWgBR503ZgaU3Ic+5qxmAIuUP4chl0DFRMlPFEM5OWC6JkkCOd
5kKrXGRmrhgtQg+pA3zqJnFItRj7gxPBA/ypxCkKPrLEkRvbdpdZEl5vAlYkeBL6
iKSLHnMswGKldiYxy7ofam5bM3myhYYNFb25boV5pRptrnoUmWOACHioBGQHwWNt
B0XktD0j7+pCCiJyyYxmOnElsk/Y/u4Tv5pYWvfFuxTF2XOg+P/EH64AIFLWgB1U
VnITxhakxqejCBxZkuVCFNSzt+TXG0NS9EIj/UOYBY+wxrBZ62ITjdA16RS/3n3z
DuIDtxOOwUumbOO32+a5zIb+ARmnocYJviI7FuENb01/U6qb+nm9hQI6oIpSCNsv
Pb4O/ZlOx70U/7mt4Xn/dTKH9bnKOOVhOw00KJWFfAce73AVnLA=
=Uhqg
-----END PGP SIGNATURE-----

View File

@@ -68,7 +68,8 @@ nogo(
"@org_golang_x_tools//go/analysis/passes/pkgfact:go_tool_library",
"@org_golang_x_tools//go/analysis/passes/nilness:go_tool_library",
"@org_golang_x_tools//go/analysis/passes/nilfunc:go_tool_library",
# "@org_golang_x_tools//go/analysis/passes/lostcancel:go_tool_library",
# lost cancel ignore doesn't seem to work when running with coverage
#"@org_golang_x_tools//go/analysis/passes/lostcancel:go_tool_library",
"@org_golang_x_tools//go/analysis/passes/loopclosure:go_tool_library",
"@org_golang_x_tools//go/analysis/passes/httpresponse:go_tool_library",
"@org_golang_x_tools//go/analysis/passes/findcall:go_tool_library",

View File

@@ -63,7 +63,7 @@ $ go test <file_you_are_working_on>
Changes that affect multiple files can be tested with ...
```
$ gometalinter && bazel test
$ golangci-lint run && bazel test //...
```
**10. Stage the file or files that you want to commit.**
@@ -88,10 +88,10 @@ You can use the amend flag to include previous commits that have not yet been
$ git fetch prysm
```
**13. Rebase your branch atop of the latest version of Prysm.**
**13. Pull latest version of Prysm.**
```
$ git rebase prysm/master
$ git pull origin master
```
If there are conflicts between your edits and those made by others since you started work Git will ask you to resolve them. To find out which files have conflicts run ...
@@ -115,10 +115,10 @@ The code from the Prysm repo is inserted between <<< and === while the change yo
**14. Push your changes to your fork of the Prysm repo.**
Rebasing a pull request changes the history on your branch, so Git will reject a normal git push after a rebase. Use a force push to move your changes to your fork of the repo.
Use git push to move your changes to your fork of the repo.
```
$ git push myrepo feature-in-progress-branch -f
$ git push myrepo feature-in-progress-branch
```
**15. Check to be sure your fork of the Prysm repo contains your feature branch with the latest edits.**

View File

@@ -50,10 +50,14 @@ docker pull gcr.io/prysmaticlabs/prysm/beacon-chain:latest
First, clone our repository:
```
sudo apt-get install git
git clone https://github.com/prysmaticlabs/prysm
cd prysm
```
Download the Bazel build tool by Google here and ensure it works by typing:
Download the Bazel build tool by Google here: https://docs.bazel.build/versions/master/install-ubuntu.html
And ensure it works by typing:
```
bazel version
@@ -71,17 +75,32 @@ Prysm ships with two important components: a beacon node and a validator client.
Another critical component of Ethereum 2.0 is the Validator Deposit Contract, which is a smart contract deployed on the Ethereum 1.0 chain which can be used for current holders of ETH to do a one-way transfer into Ethereum 2.0.
### Running an Ethereum 2.0 Beacon Node
With docker:
<b>With Docker</b>
Docker on Linux/Mac:
```
docker run -v /tmp/prysm-data:/data -p 4000:4000 \
gcr.io/prysmaticlabs/prysm/beacon-chain:latest \
--datadir=/data
--clear-db
```
Docker on Windows:
1) You will need to share the local drive you wish to mount to to container (e.g. C:)
1. Enter Docker settings (right click tray icon)
2. Click Shared Drives
3. Select Drive to share
4. Click Apply
2) You will next need to create a folder in the drive to use as your data directory (Docker will not create this if it does not exist). For the purposes of these instructions, C: is shared, and we created the /tmp/prysm-data/ directory within. This path must be used for the local data directory for chain data for the Beacon Node, and when creating an account and keystore for the validator, and when running the validator.
3) Run the beacon node (Docker CLI in Windows seems to have trouble ingesting with escapes and new lines, so keep it on one line):
```
docker run -it -v c:/tmp/prysm-data:/data -p 4000:4000 gcr.io/prysmaticlabs/prysm/beacon-chain:latest --datadir=/data --clear-db
```
<b>With Bazel</b>
To start your beacon node with bazel:
```
bazel run //beacon-chain -- --clear-db --datadir=/tmp/prysm-data
```
@@ -98,6 +117,15 @@ Using your validator deposit data from the previous step, use the instructions i
It'll take a while for the nodes in the network to process your deposit, but once you're active, your validator will begin doing its responsibility! In your validator client, you'll be able to frequently see your validator balance as it goes up. If you ever go offline for a while, you'll start gradually losing your deposit until you get kicked out of the system. Congratulations, you are now running Ethereum 2.0 Phase 0 :).
<b>With bazel</b>
Open another terminal window
```
cd prysm
bazel run //validator
```
# Testing
To run the unit tests of our system do:

View File

@@ -9,8 +9,8 @@ http_archive(
http_archive(
name = "io_bazel_rules_go",
sha256 = "86ae934bd4c43b99893fc64be9d9fc684b81461581df7ea8fc291c816f5ee8c5",
url = "https://github.com/bazelbuild/rules_go/releases/download/0.18.3/rules_go-0.18.3.tar.gz",
sha256 = "a82a352bffae6bee4e95f68a8d80a70e87f42c4741e6a448bec11998fcc82329",
url = "https://github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz",
)
http_archive(
@@ -21,9 +21,9 @@ http_archive(
http_archive(
name = "com_github_atlassian_bazel_tools",
sha256 = "af4908ea16b43e0c88007742a5c54997ee068fc393f9850ade2d59b1d5f49f55",
strip_prefix = "bazel-tools-31382b2267b0bc3d9771085e3503473a061593e1",
urls = ["https://github.com/atlassian/bazel-tools/archive/31382b2267b0bc3d9771085e3503473a061593e1.tar.gz"],
sha256 = "723f53b4ea6d1524c921b2bc373d3fc7d37322311d9b3bac011314f6d6a56d0d",
strip_prefix = "bazel-tools-20cbdb188d18c5470697783258cd2ec2b531b710",
urls = ["https://github.com/atlassian/bazel-tools/archive/20cbdb188d18c5470697783258cd2ec2b531b710.tar.gz"],
)
http_archive(
@@ -35,15 +35,15 @@ http_archive(
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "4c702ffeeab2d24dd4101601b6d27cf582d2e0d4cdc3abefddd4834664669b6b",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.28.0/rules_nodejs-0.28.0.tar.gz"],
sha256 = "1db950bbd27fb2581866e307c0130983471d4c3cd49c46063a2503ca7b6770a4",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.29.0/rules_nodejs-0.29.0.tar.gz"],
)
http_archive(
name = "io_bazel_rules_k8s",
sha256 = "00606b1de959028881220e2cdc1186068242de491f8782e30922e8285b5f3ad1",
strip_prefix = "rules_k8s-c1daa04ce0a83fbaa4396fb4987d7675cd24f25e",
url = "https://github.com/bazelbuild/rules_k8s/archive/c1daa04ce0a83fbaa4396fb4987d7675cd24f25e.tar.gz",
sha256 = "4c4fea5c7fb0768bd440e6bf0a893bdb0449f3f41707522eaa9ada3d1152402f",
strip_prefix = "rules_k8s-7475ba20133e4a3f585a3648db6d055e7d1c5f78",
url = "https://github.com/bazelbuild/rules_k8s/archive/7475ba20133e4a3f585a3648db6d055e7d1c5f78.tar.gz",
)
load(
@@ -117,9 +117,9 @@ proto_library(
srcs = ["src/proto/faucet.proto"],
visibility = ["//visibility:public"],
)""",
sha256 = "d57cbb11cbd8126d31385064315df731132401f5c5ea110e05ed86da350c9523",
strip_prefix = "prysm-testnet-site-3848e91aab9332a0b2c15291f65f09c94db1a84d",
url = "https://github.com/prestonvanloon/prysm-testnet-site/archive/3848e91aab9332a0b2c15291f65f09c94db1a84d.tar.gz",
sha256 = "92c8e4d408704cd636ae528aeae9b4dd7da8448ae951e76ed93c2700e56d4735",
strip_prefix = "prysm-testnet-site-5afe7bf22b10a2b65c4c6a7a767280c9f32c49a8",
url = "https://github.com/prestonvanloon/prysm-testnet-site/archive/5afe7bf22b10a2b65c4c6a7a767280c9f32c49a8.tar.gz",
)
http_archive(
@@ -182,20 +182,20 @@ go_repository(
go_repository(
name = "com_github_libp2p_go_libp2p",
commit = "4d4f98f9ae7a78727e76c0cf5609bfa09e70715a", # v0.0.20
commit = "e37301c3440bed13002e4d9f1926fb90e76cc589", # v0.0.23
importpath = "github.com/libp2p/go-libp2p",
)
go_repository(
name = "com_github_libp2p_go_libp2p_peer",
commit = "0af66450abe0a80f55c82f00b5f059cc2651498e", # v0.1.0
commit = "6312b41b8e7efdafc625d914a9b8e14b04be316c", # v0.1.1
importpath = "github.com/libp2p/go-libp2p-peer",
)
go_repository(
name = "com_github_libp2p_go_libp2p_crypto",
build_file_proto_mode = "disable_global",
commit = "b0ed0e663e8b6832bad3f4502b2f6551ff2686cd", # v0.0.1
commit = "b5d56559c07acc725b7c790138d8b66a9c6e0569", # v0.0.2
importpath = "github.com/libp2p/go-libp2p-crypto",
)
@@ -225,7 +225,7 @@ go_repository(
go_repository(
name = "com_github_libp2p_go_libp2p_host",
commit = "0edd439378603e9228acb78e0ae7e1b54b9d3f3a", # v0.0.2
commit = "520b4f10a059fd5c9a8e9473556709b64b0f66e4", # v0.0.3
importpath = "github.com/libp2p/go-libp2p-host",
)
@@ -237,7 +237,7 @@ go_repository(
go_repository(
name = "com_github_libp2p_go_libp2p_circuit",
commit = "d07cd5f739a7878121b10e54a8ead734f93e2ddf", # v0.0.4
commit = "ac02326941fa6d199a269956d5ef8f2b70ca9af0", # v0.0.6
importpath = "github.com/libp2p/go-libp2p-circuit",
)
@@ -249,7 +249,7 @@ go_repository(
go_repository(
name = "com_github_libp2p_go_libp2p_interface_connmgr",
commit = "e80dd2e9f839e44febfcb7e6b38ded8761332eb6", # v0.0.3
commit = "8a8303b8a881105c9c4ca01ab51892c7048bb429", # v0.0.4
importpath = "github.com/libp2p/go-libp2p-interface-connmgr",
)
@@ -303,7 +303,7 @@ go_repository(
go_repository(
name = "com_github_mattn_go_colorable",
commit = "3a70a971f94a22f2fa562ffcc7a0eb45f5daf045",
commit = "8029fb3788e5a4a9c00e415f586a6d033f5d38b3", # v0.1.2
importpath = "github.com/mattn/go-colorable",
)
@@ -321,7 +321,7 @@ go_repository(
go_repository(
name = "com_github_minio_sha256_simd",
commit = "2d45a736cd16732fe6a57563cc20d8b035193e58",
commit = "05b4dd3047e5d6e86cb4e0477164b850cd896261", # v0.1.0
importpath = "github.com/minio/sha256-simd",
)
@@ -358,13 +358,13 @@ go_repository(
go_repository(
name = "com_github_jbenet_goprocess",
commit = "b497e2f366b8624394fb2e89c10ab607bebdde0b",
commit = "1dc239722b2ba3784472fb5301f62640fa5a8bc3", # v0.1.3
importpath = "github.com/jbenet/goprocess",
)
go_repository(
name = "com_github_multiformats_go_multistream",
commit = "f3f44044ac2444cd3a017c0b269f8da65b0012f1", # v0.0.1
commit = "5fb8f3e4262b9fad08188e0700640003c7c5df8f", # v0.0.3
importpath = "github.com/multiformats/go-multistream",
)
@@ -400,7 +400,7 @@ go_repository(
go_repository(
name = "com_github_mattn_go_isatty",
commit = "c2a7a6ca930a4cd0bc33a3f298eb71960732a3a7", # v0.0.7
commit = "1311e847b0cb909da63b5fecfb5370aa66236465", # v0.0.8
importpath = "github.com/mattn/go-isatty",
)
@@ -430,7 +430,7 @@ go_repository(
go_repository(
name = "com_github_libp2p_go_maddr_filter",
commit = "1258bb7e3e3a37bb9a93aaf77ef88f8405b39bce", # v0.0.1
commit = "e3cdd802c04babcbec2c4711721d105cfe822cd3", # v0.0.2
importpath = "github.com/libp2p/go-maddr-filter",
)
@@ -642,7 +642,7 @@ go_repository(
go_repository(
name = "org_golang_google_api",
commit = "067bed655e9cbc26f4dbac8f8897b30756d90990", # v0.4.0
commit = "721295fe20d585ce7e948146f82188429d14da33", # v0.5.0
importpath = "google.golang.org/api",
)
@@ -672,7 +672,7 @@ go_repository(
go_repository(
name = "com_github_prometheus_client_golang",
commit = "ac0d4da0b001139583d0dfb84d614a0f907ea0a9", # v0.9.2
commit = "662e8a9ffaaa74a4d050023c2cb26902cd9bab63", # v0.9.3
importpath = "github.com/prometheus/client_golang",
)
@@ -684,7 +684,7 @@ go_repository(
go_repository(
name = "com_github_prometheus_common",
commit = "a82f4c12f983cc2649298185f296632953e50d3e", # v0.3.0
commit = "7d6a80ca5263a2575832c437c6f35181243c4bec", # v0.4.1
importpath = "github.com/prometheus/common",
)
@@ -732,14 +732,14 @@ go_repository(
go_repository(
name = "com_github_libp2p_go_mplex",
commit = "b16006283f6036f9a461f78692c397b134a75393", # v0.0.1
commit = "9c275bbc0db278ffa399cbbefcaa7aab4c9653d5", # v0.0.2
importpath = "github.com/libp2p/go-mplex",
)
go_repository(
name = "com_github_libp2p_go_libp2p_pubsub",
build_file_proto_mode = "disable_global",
commit = "25cbf38777e869acb77e8079c3c76d6b430e66ad", # v0.0.1
commit = "9db3dbdde90f44d1c420192c5cefd60682fbdbb9", # v0.0.2
importpath = "github.com/libp2p/go-libp2p-pubsub",
)
@@ -911,7 +911,7 @@ go_repository(
go_repository(
name = "com_github_spf13_cobra",
commit = "ef82de70bb3f60c65fb8eebacbb2d122ef517385", # v0.0.3
commit = "67fc4837d267bc9bfd6e47f77783fcc3dffc68de", # v0.0.4
importpath = "github.com/spf13/cobra",
)
@@ -949,7 +949,7 @@ go_repository(
go_repository(
name = "com_google_cloud_go",
commit = "fcb9a2d5f791d07be64506ab54434de65989d370", # v0.37.4
commit = "775730d6e48254a2430366162cf6298e5368833c", # v0.39.0
importpath = "cloud.google.com/go",
)
@@ -1033,7 +1033,7 @@ go_repository(
go_repository(
name = "com_github_phoreproject_bls",
commit = "afaefda3ea643e9292b6f4596403ed5c742561b4",
commit = "0b6cefc7f7eee050e3ac6d66d66ae8e469a4fbf1",
importpath = "github.com/phoreproject/bls",
)
@@ -1081,6 +1081,12 @@ go_repository(
go_repository(
name = "com_github_libp2p_go_libp2p_connmgr",
commit = "5249ec107e4544863dd8c61a6417b640d03a62a2",
commit = "5249ec107e4544863dd8c61a6417b640d03a62a2", # v0.0.4
importpath = "github.com/libp2p/go-libp2p-connmgr",
)
go_repository(
name = "com_github_joonix_log",
commit = "13fe31bbdd7a6f706b9114e188cdb53856be4d64",
importpath = "github.com/joonix/log",
)

View File

@@ -16,7 +16,9 @@ go_library(
"//shared/cmd:go_default_library",
"//shared/debug:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/logutil:go_default_library",
"//shared/version:go_default_library",
"@com_github_joonix_log//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_urfave_cli//:go_default_library",
"@com_github_x_cray_logrus_prefixed_formatter//:go_default_library",
@@ -42,7 +44,9 @@ go_image(
"//shared/cmd:go_default_library",
"//shared/debug:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/logutil:go_default_library",
"//shared/version:go_default_library",
"@com_github_joonix_log//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_urfave_cli//:go_default_library",
"@com_github_x_cray_logrus_prefixed_formatter//:go_default_library",

View File

@@ -45,7 +45,9 @@ type Service struct {
incomingChan chan *pb.Attestation
// store is the mapping of individual
// validator's public key to it's latest attestation.
store attestationStore
store attestationStore
pooledAttestations []*pb.Attestation
poolLimit int
}
// Config options for the service.
@@ -58,12 +60,14 @@ type Config struct {
func NewAttestationService(ctx context.Context, cfg *Config) *Service {
ctx, cancel := context.WithCancel(ctx)
return &Service{
ctx: ctx,
cancel: cancel,
beaconDB: cfg.BeaconDB,
incomingFeed: new(event.Feed),
incomingChan: make(chan *pb.Attestation, params.BeaconConfig().DefaultBufferSize),
store: attestationStore{m: make(map[[48]byte]*pb.Attestation)},
ctx: ctx,
cancel: cancel,
beaconDB: cfg.BeaconDB,
incomingFeed: new(event.Feed),
incomingChan: make(chan *pb.Attestation, params.BeaconConfig().DefaultBufferSize),
store: attestationStore{m: make(map[[48]byte]*pb.Attestation)},
pooledAttestations: make([]*pb.Attestation, 0, 1),
poolLimit: 1,
}
}
@@ -143,9 +147,31 @@ func (a *Service) attestationPool() {
func (a *Service) handleAttestation(ctx context.Context, msg proto.Message) error {
attestation := msg.(*pb.Attestation)
if err := a.UpdateLatestAttestation(ctx, attestation); err != nil {
return fmt.Errorf("could not update attestation pool: %v", err)
a.pooledAttestations = append(a.pooledAttestations, attestation)
if len(a.pooledAttestations) > a.poolLimit {
if err := a.BatchUpdateLatestAttestation(ctx, a.pooledAttestations); err != nil {
return err
}
state, err := a.beaconDB.HeadState(ctx)
if err != nil {
return err
}
// This sets the pool limit, once the old pool is cleared out. It does by using the number of active
// validators per slot as an estimate. The active indices here are not used in the actual processing
// of attestations.
activeIndices := helpers.ActiveValidatorIndices(state, helpers.CurrentEpoch(state))
attPerSlot := len(activeIndices) / int(params.BeaconConfig().SlotsPerEpoch)
// we only set the limit at 70% of the calculated amount to be safe so that relevant attestations
// arent carried over to the next batch.
a.poolLimit = attPerSlot * 7 / 10
if a.poolLimit == 0 {
a.poolLimit++
}
attestationPoolLimit.Set(float64(a.poolLimit))
a.pooledAttestations = make([]*pb.Attestation, 0, a.poolLimit)
}
attestationPoolSize.Set(float64(len(a.pooledAttestations)))
return nil
}
@@ -183,7 +209,7 @@ func (a *Service) BatchUpdateLatestAttestation(ctx context.Context, attestations
for _, attestation := range attestations {
if err := a.updateAttestation(beaconState, attestation); err != nil {
return err
log.Error(err)
}
}
return nil
@@ -231,12 +257,13 @@ func (a *Service) updateAttestation(beaconState *pb.BeaconState, attestation *pb
}
if i >= len(committee) {
log.Errorf("Bitfield points to an invalid index in the committee: bitfield %08b", bitfield)
continue
log.Debugf("bitfield points to an invalid index in the committee: bitfield %08b", bitfield)
return nil
}
if int(committee[i]) >= len(beaconState.ValidatorRegistry) {
log.Errorf("Index doesn't exist in validator registry: index %d", committee[i])
log.Debugf("index doesn't exist in validator registry: index %d", committee[i])
return nil
}
// If the attestation came from this attester. We use the slot committee to find the

View File

@@ -419,10 +419,67 @@ func TestUpdateLatestAttestation_InvalidIndex(t *testing.T) {
},
}
wanted := "bitfield points to an invalid index in the committee"
if err := service.UpdateLatestAttestation(ctx, attestation); err != nil {
t.Fatalf("could not update latest attestation: %v", err)
t.Error(err)
}
testutil.AssertLogsContain(t, hook, wanted)
}
func TestBatchUpdate_FromSync(t *testing.T) {
beaconDB := internal.SetupDB(t)
defer internal.TeardownDB(t, beaconDB)
ctx := context.Background()
var validators []*pb.Validator
var latestRandaoMixes [][]byte
var latestActiveIndexRoots [][]byte
for i := 0; i < 64; i++ {
validators = append(validators, &pb.Validator{
Pubkey: []byte{byte(i)},
ActivationEpoch: 0,
ExitEpoch: 10,
})
latestRandaoMixes = append(latestRandaoMixes, []byte{'A'})
latestActiveIndexRoots = append(latestActiveIndexRoots, []byte{'B'})
}
beaconState := &pb.BeaconState{
Slot: 1,
ValidatorRegistry: validators,
LatestRandaoMixes: latestRandaoMixes,
LatestActiveIndexRoots: latestActiveIndexRoots,
}
block := &pb.BeaconBlock{
Slot: 1,
}
if err := beaconDB.SaveBlock(block); err != nil {
t.Fatal(err)
}
beaconState.LatestBlock = block
if err := beaconDB.UpdateChainHead(ctx, block, beaconState); err != nil {
t.Fatal(err)
}
service := NewAttestationService(context.Background(), &Config{BeaconDB: beaconDB})
service.poolLimit = 9
for i := 0; i < 10; i++ {
attestation := &pb.Attestation{
AggregationBitfield: []byte{0x80},
Data: &pb.AttestationData{
Slot: 1,
Shard: 1,
TargetEpoch: 2,
},
}
if err := service.handleAttestation(ctx, attestation); err != nil {
t.Fatalf("could not update latest attestation: %v", err)
}
}
if len(service.pooledAttestations) != 0 {
t.Errorf("pooled attestations were not cleared out, still %d attestations in pool", len(service.pooledAttestations))
}
testutil.AssertLogsContain(t, hook, "Bitfield points to an invalid index in the committee")
}
func TestUpdateLatestAttestation_BatchUpdate(t *testing.T) {

View File

@@ -19,6 +19,15 @@ var (
Name: "total_seen_attestations",
Help: "Total number of attestations seen by the validators",
})
attestationPoolLimit = promauto.NewGauge(prometheus.GaugeOpts{
Name: "attestation_pool_limit",
Help: "The limit of the attestation pool",
})
attestationPoolSize = promauto.NewGauge(prometheus.GaugeOpts{
Name: "attestation_pool_size",
Help: "The current size of the attestation pool",
})
)
func reportVoteMetrics(index uint64, block *pb.BeaconBlock) {

View File

@@ -214,6 +214,7 @@ func (c *ChainService) AdvanceState(
beaconState *pb.BeaconState,
block *pb.BeaconBlock,
) (*pb.BeaconState, error) {
finalizedEpoch := beaconState.FinalizedEpoch
newState, err := state.ExecuteStateTransition(
ctx,
beaconState,
@@ -226,6 +227,10 @@ func (c *ChainService) AdvanceState(
if err != nil {
return beaconState, &BlockFailedProcessingErr{err}
}
// Prune the block cache on every new finalized epoch.
if newState.FinalizedEpoch > finalizedEpoch {
c.beaconDB.ClearBlockCache()
}
log.WithField(
"slotsSinceGenesis", newState.Slot,
).Info("Slot transition successfully processed")
@@ -269,13 +274,24 @@ func (c *ChainService) AdvanceState(
// validators were activated from current epoch. After it saves, current epoch key
// is deleted from ActivatedValidators mapping.
func (c *ChainService) saveValidatorIdx(state *pb.BeaconState) error {
activatedValidators := validators.ActivatedValFromEpoch(helpers.CurrentEpoch(state) + 1)
nextEpoch := helpers.CurrentEpoch(state) + 1
activatedValidators := validators.ActivatedValFromEpoch(nextEpoch)
var idxNotInState []uint64
for _, idx := range activatedValidators {
// If for some reason the activated validator indices is not in state,
// we skip them and save them to process for next epoch.
if int(idx) >= len(state.ValidatorRegistry) {
idxNotInState = append(idxNotInState, idx)
continue
}
pubKey := state.ValidatorRegistry[idx].Pubkey
if err := c.beaconDB.SaveValidatorIndex(pubKey, int(idx)); err != nil {
return fmt.Errorf("could not save validator index: %v", err)
}
}
// Since we are processing next epoch, save the can't processed validator indices
// to the epoch after that.
validators.InsertActivatedIndices(nextEpoch+1, idxNotInState)
validators.DeleteActivatedVal(helpers.CurrentEpoch(state))
return nil
}

View File

@@ -4,6 +4,7 @@ import (
"context"
"encoding/binary"
"math/big"
"reflect"
"strings"
"testing"
"time"
@@ -691,8 +692,8 @@ func TestReceiveBlock_OnChainSplit(t *testing.T) {
if err := db.SaveHistoricalState(ctx, beaconState, rootF); err != nil {
t.Fatal(err)
}
initBlockStateRoot(t, blockF, chainService)
initBlockStateRoot(t, blockF, chainService)
computedState, err := chainService.ReceiveBlock(ctx, blockF)
if err != nil {
t.Fatal(err)
@@ -816,7 +817,7 @@ func TestDeleteValidatorIdx_DeleteWorks(t *testing.T) {
db := internal.SetupDB(t)
defer internal.TeardownDB(t, db)
epoch := uint64(2)
v.InsertActivatedVal(epoch+1, []uint64{0, 1, 2})
v.InsertActivatedIndices(epoch+1, []uint64{0, 1, 2})
v.InsertExitedVal(epoch+1, []uint64{0, 2})
var validators []*pb.Validator
for i := 0; i < 3; i++ {
@@ -859,7 +860,7 @@ func TestSaveValidatorIdx_SaveRetrieveWorks(t *testing.T) {
db := internal.SetupDB(t)
defer internal.TeardownDB(t, db)
epoch := uint64(1)
v.InsertActivatedVal(epoch+1, []uint64{0, 1, 2})
v.InsertActivatedIndices(epoch+1, []uint64{0, 1, 2})
var validators []*pb.Validator
for i := 0; i < 3; i++ {
pubKeyBuf := make([]byte, params.BeaconConfig().BLSPubkeyLength)
@@ -890,3 +891,46 @@ func TestSaveValidatorIdx_SaveRetrieveWorks(t *testing.T) {
t.Errorf("Activated validators mapping for epoch %d still there", epoch)
}
}
func TestSaveValidatorIdx_IdxNotInState(t *testing.T) {
db := internal.SetupDB(t)
defer internal.TeardownDB(t, db)
epoch := uint64(100)
// Tried to insert 5 active indices to DB with only 3 validators in state.
v.InsertActivatedIndices(epoch+1, []uint64{0, 1, 2, 3, 4})
var validators []*pb.Validator
for i := 0; i < 3; i++ {
pubKeyBuf := make([]byte, params.BeaconConfig().BLSPubkeyLength)
binary.PutUvarint(pubKeyBuf, uint64(i))
validators = append(validators, &pb.Validator{
Pubkey: pubKeyBuf,
})
}
state := &pb.BeaconState{
ValidatorRegistry: validators,
Slot: epoch * params.BeaconConfig().SlotsPerEpoch,
}
chainService := setupBeaconChain(t, db, nil)
if err := chainService.saveValidatorIdx(state); err != nil {
t.Fatalf("Could not save validator idx: %v", err)
}
wantedIdx := uint64(2)
idx, err := chainService.beaconDB.ValidatorIndex(validators[wantedIdx].Pubkey)
if err != nil {
t.Fatalf("Could not get validator index: %v", err)
}
if wantedIdx != idx {
t.Errorf("Wanted: %d, got: %d", wantedIdx, idx)
}
if v.ActivatedValFromEpoch(epoch) != nil {
t.Errorf("Activated validators mapping for epoch %d still there", epoch)
}
// Verify the skipped validators are included in the next epoch.
if !reflect.DeepEqual(v.ActivatedValFromEpoch(epoch+2), []uint64{3, 4}) {
t.Error("Did not get wanted validator from activation queue")
}
}

View File

@@ -416,6 +416,9 @@ func VoteCount(block *pb.BeaconBlock, state *pb.BeaconState, targets map[uint64]
}
if bytes.Equal(blockRoot[:], ancestorRoot) {
if int(validatorIndex) >= len(state.ValidatorRegistry) {
return 0, fmt.Errorf("validator index exceeds length of registry, index: %d , registry: %d", validatorIndex, len(state.ValidatorRegistry))
}
balances += int(state.ValidatorRegistry[validatorIndex].EffectiveBalance)
}
}

View File

@@ -7,6 +7,7 @@ import (
"bytes"
"context"
"fmt"
"runtime"
"sync"
"time"
@@ -49,6 +50,7 @@ type ChainService struct {
canonicalBlocks map[uint64][]byte
canonicalBlocksLock sync.RWMutex
receiveBlockLock sync.Mutex
maxRoutines int64
}
// Config options for the service.
@@ -60,6 +62,7 @@ type Config struct {
OpsPoolService operations.OperationFeeds
DevMode bool
P2p p2p.Broadcaster
MaxRoutines int64
}
// NewChainService instantiates a new service instance that will
@@ -78,6 +81,7 @@ func NewChainService(ctx context.Context, cfg *Config) (*ChainService, error) {
stateInitializedFeed: new(event.Feed),
p2p: cfg.P2p,
canonicalBlocks: make(map[uint64][]byte),
maxRoutines: cfg.MaxRoutines,
}, nil
}
@@ -188,6 +192,9 @@ func (c *ChainService) Stop() error {
// Status always returns nil.
// TODO(1202): Add service health checks.
func (c *ChainService) Status() error {
if runtime.NumGoroutine() > int(c.maxRoutines) {
return fmt.Errorf("too many goroutines %d", runtime.NumGoroutine())
}
return nil
}

View File

@@ -35,6 +35,11 @@ var (
})
)
// ErrAlreadyInProgress appears when attempting to mark a cache as in progress while it is
// already in progress. The client should handle this error and wait for the in progress
// data to resolve via Get.
var ErrAlreadyInProgress = errors.New("already in progress")
// AttestationCache is used to store the cached results of an AttestationData request.
type AttestationCache struct {
cache *cache.FIFO
@@ -108,7 +113,7 @@ func (c *AttestationCache) MarkInProgress(req *pb.AttestationDataRequest) error
return e
}
if c.inProgress[s] {
return errors.New("already in progress")
return ErrAlreadyInProgress
}
c.inProgress[s] = true
return nil

View File

@@ -308,3 +308,17 @@ func ToCommitteeCache(slot uint64, crosslinkCommittees []*CrosslinkCommittee) *c
}
return committees
}
// VerifyAttestationBitfield verifies that an attestations bitfield is valid in respect
// to the committees at that slot.
func VerifyAttestationBitfield(bState *pb.BeaconState, att *pb.Attestation) (bool, error) {
committee, err := CrosslinkCommitteeAtEpoch(bState, att.Data.TargetEpoch, att.Data.Shard)
if err != nil {
return false, fmt.Errorf("could not retrieve crosslink committees at slot: %v", err)
}
if committee == nil {
return false, fmt.Errorf("no committee exist for shard in the attestation")
}
return VerifyBitfield(att.AggregationBitfield, len(committee))
}

View File

@@ -634,3 +634,109 @@ func TestEpochStartShard_AccurateShard(t *testing.T) {
}
}
}
func TestVerifyAttestationBitfield_OK(t *testing.T) {
if params.BeaconConfig().SlotsPerEpoch != 64 {
t.Errorf("SlotsPerEpoch should be 64 for these tests to pass")
}
validators := make([]*pb.Validator, 2*params.BeaconConfig().SlotsPerEpoch)
var activeRoots [][]byte
for i := 0; i < len(validators); i++ {
validators[i] = &pb.Validator{
ExitEpoch: params.BeaconConfig().FarFutureEpoch,
}
activeRoots = append(activeRoots, []byte{'A'})
}
state := &pb.BeaconState{
ValidatorRegistry: validators,
LatestActiveIndexRoots: activeRoots,
LatestRandaoMixes: activeRoots,
}
tests := []struct {
attestation *pb.Attestation
stateSlot uint64
errorExists bool
verificationFailure bool
}{
{
attestation: &pb.Attestation{
AggregationBitfield: []byte{0x01},
Data: &pb.AttestationData{
Shard: 5,
Slot: 5,
},
},
stateSlot: 5,
},
{
attestation: &pb.Attestation{
AggregationBitfield: []byte{0x02},
Data: &pb.AttestationData{
Shard: 10,
Slot: 10,
},
},
stateSlot: 10,
},
{
attestation: &pb.Attestation{
AggregationBitfield: []byte{0x02},
Data: &pb.AttestationData{
Shard: 20,
Slot: 20,
},
},
stateSlot: 20,
},
{
attestation: &pb.Attestation{
AggregationBitfield: []byte{0xFF, 0xC0},
Data: &pb.AttestationData{
Shard: 5,
Slot: 5,
},
},
stateSlot: 5,
errorExists: true,
},
{
attestation: &pb.Attestation{
AggregationBitfield: []byte{0xFF},
Data: &pb.AttestationData{
Shard: 20,
Slot: 20,
},
},
stateSlot: 20,
verificationFailure: true,
},
}
for _, tt := range tests {
state.Slot = tt.stateSlot
verified, err := VerifyAttestationBitfield(state, tt.attestation)
if tt.errorExists {
if err == nil {
t.Error("error is nil, when verification is supposed to fail")
}
continue
}
if tt.verificationFailure {
if verified {
t.Error("verification succeeded when it was supposed to fail")
}
continue
}
if err != nil {
t.Errorf("Failed to verify bitfield: %v", err)
continue
}
if !verified {
t.Errorf("Bitfield isnt verified: %08b", tt.attestation.AggregationBitfield)
}
}
}

View File

@@ -21,7 +21,11 @@ import (
// int_to_bytes32(epoch)
// )
func GenerateSeed(state *pb.BeaconState, wantedEpoch uint64) [32]byte {
randaoMix := RandaoMix(state, wantedEpoch-params.BeaconConfig().MinSeedLookahead)
lookAheadEpoch := wantedEpoch - params.BeaconConfig().MinSeedLookahead
if params.BeaconConfig().MinSeedLookahead > wantedEpoch {
lookAheadEpoch = 0
}
randaoMix := RandaoMix(state, lookAheadEpoch)
indexRoot := ActiveIndexRoot(state, wantedEpoch)

View File

@@ -518,3 +518,15 @@ func TestProcessEpoch_CanProcess(t *testing.T) {
t.Errorf("Wanted slashed balance: %d, got: %d", wanted, newState.Balances[2])
}
}
func TestProcessEpoch_NotPanicOnEmptyActiveValidatorIndices(t *testing.T) {
newState := &pb.BeaconState{
LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength),
LatestSlashedBalances: make([]uint64, params.BeaconConfig().LatestSlashedExitLength),
LatestRandaoMixes: make([][]byte, params.BeaconConfig().SlotsPerEpoch),
}
config := state.DefaultConfig()
config.Logging = true
state.ProcessEpoch(context.Background(), newState)
}

View File

@@ -9,6 +9,7 @@ go_library(
"//beacon-chain/core/helpers:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/params:go_default_library",
"//shared/sliceutil:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
@@ -24,6 +25,7 @@ go_test(
"//beacon-chain/core/state/stateutils:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/bitutil:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/params:go_default_library",
],
)

View File

@@ -12,6 +12,7 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/sliceutil"
"github.com/sirupsen/logrus"
@@ -139,8 +140,14 @@ func ProcessDeposit(
withdrawalCredentials,
)
}
newBalance := state.Balances[existingValidatorIdx] + amount
state.Balances[existingValidatorIdx] = newBalance
state.ValidatorRegistry[existingValidatorIdx].EffectiveBalance += amount
state.Balances[existingValidatorIdx] += amount
if !featureconfig.FeatureConfig().EnableExcessDeposits && newBalance > params.BeaconConfig().MaxDepositAmount {
state.Balances[existingValidatorIdx] = params.BeaconConfig().MaxDepositAmount
state.ValidatorRegistry[existingValidatorIdx].EffectiveBalance = params.BeaconConfig().MaxDepositAmount
}
}
state.DepositIndex++
@@ -333,6 +340,14 @@ func InsertActivatedVal(epoch uint64, validators []uint64) {
VStore.activatedValidators[epoch] = validators
}
// InsertActivatedIndices locks the validator store, inserts the activated validator
// indices corresponding to their activation epochs.
func InsertActivatedIndices(epoch uint64, indices []uint64) {
VStore.Lock()
defer VStore.Unlock()
VStore.activatedValidators[epoch] = append(VStore.activatedValidators[epoch], indices...)
}
// InsertExitedVal locks the validator store, inserts the exited validator
// indices, then unlocks the store again. This method may be used by
// external services in testing to remove the validator store.

View File

@@ -10,6 +10,7 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core/state/stateutils"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/bitutil"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/params"
)
@@ -378,6 +379,90 @@ func TestProcessDeposit_PublicKeyDoesNotExistAndEmptyValidator(t *testing.T) {
}
}
func TestProcessDepositFlag_NotEnabled(t *testing.T) {
registry := []*pb.Validator{
{
Pubkey: []byte{1, 2, 3},
WithdrawalCredentials: []byte{2},
},
{
Pubkey: []byte{4, 5, 6},
WithdrawalCredentials: []byte{1},
},
}
balances := []uint64{0, 32e9}
beaconState := &pb.BeaconState{
Slot: params.BeaconConfig().SlotsPerEpoch,
Balances: balances,
ValidatorRegistry: registry,
}
pubkey := []byte{4, 5, 6}
deposit := uint64(32e9)
proofOfPossession := []byte{}
withdrawalCredentials := []byte{1}
newState, err := ProcessDeposit(
beaconState,
stateutils.ValidatorIndexMap(beaconState),
pubkey,
deposit,
proofOfPossession,
withdrawalCredentials,
)
if err != nil {
t.Fatalf("Process deposit failed: %v", err)
}
if newState.Balances[1] != 32e9 {
t.Errorf("Balances have been updated despite flag being not applied: %d", newState.Balances[1])
}
}
func TestProcessDepositFlag_Enabled(t *testing.T) {
featureconfig.InitFeatureConfig(&featureconfig.FeatureFlagConfig{
EnableExcessDeposits: true,
})
registry := []*pb.Validator{
{
Pubkey: []byte{1, 2, 3},
WithdrawalCredentials: []byte{2},
},
{
Pubkey: []byte{4, 5, 6},
WithdrawalCredentials: []byte{1},
},
}
balances := []uint64{0, 32e9}
beaconState := &pb.BeaconState{
Slot: params.BeaconConfig().SlotsPerEpoch,
Balances: balances,
ValidatorRegistry: registry,
}
pubkey := []byte{4, 5, 6}
deposit := uint64(32e9)
proofOfPossession := []byte{}
withdrawalCredentials := []byte{1}
newState, err := ProcessDeposit(
beaconState,
stateutils.ValidatorIndexMap(beaconState),
pubkey,
deposit,
proofOfPossession,
withdrawalCredentials,
)
if err != nil {
t.Fatalf("Process deposit failed: %v", err)
}
if newState.Balances[1] != 64e9 {
t.Errorf("Balances have been updated despite flag being not applied: %d", newState.Balances[1])
}
// Un-setting flag
featureconfig.InitFeatureConfig(&featureconfig.FeatureFlagConfig{
EnableExcessDeposits: false,
})
}
func TestActivateValidatorGenesis_OK(t *testing.T) {
state := &pb.BeaconState{
ValidatorRegistry: []*pb.Validator{
@@ -573,3 +658,14 @@ func TestInitializeValidatoreStore(t *testing.T) {
t.Errorf("Saved active indices are not the same as the one in the validator store, got %v but expected %v", retrievedIndices, indices)
}
}
func TestInsertActivatedIndices_Works(t *testing.T) {
InsertActivatedIndices(100, []uint64{1, 2, 3})
if !reflect.DeepEqual(VStore.activatedValidators[100], []uint64{1, 2, 3}) {
t.Error("Activated validators aren't the same")
}
InsertActivatedIndices(100, []uint64{100})
if !reflect.DeepEqual(VStore.activatedValidators[100], []uint64{1, 2, 3, 100}) {
t.Error("Activated validators aren't the same")
}
}

View File

@@ -20,6 +20,18 @@ var (
Name: "bad_blocks",
Help: "Number of bad, blacklisted blocks received",
})
blockCacheMiss = promauto.NewCounter(prometheus.CounterOpts{
Name: "beacon_block_cache_miss",
Help: "The number of block requests that aren't present in the cache.",
})
blockCacheHit = promauto.NewCounter(prometheus.CounterOpts{
Name: "beacon_block_cache_hit",
Help: "The number of block requests that are present in the cache.",
})
blockCacheSize = promauto.NewGauge(prometheus.GaugeOpts{
Name: "beacon_block_cache_size",
Help: "The number of beacon blocks in the block cache",
})
)
func createBlock(enc []byte) (*pb.BeaconBlock, error) {
@@ -34,6 +46,15 @@ func createBlock(enc []byte) (*pb.BeaconBlock, error) {
// Block accepts a block root and returns the corresponding block.
// Returns nil if the block does not exist.
func (db *BeaconDB) Block(root [32]byte) (*pb.BeaconBlock, error) {
db.blocksLock.RLock()
// Return block from cache if it exists
if blk, exists := db.blocks[root]; exists && blk != nil {
defer db.blocksLock.RUnlock()
blockCacheHit.Inc()
return db.blocks[root], nil
}
var block *pb.BeaconBlock
err := db.view(func(tx *bolt.Tx) error {
bucket := tx.Bucket(blockBucket)
@@ -48,11 +69,29 @@ func (db *BeaconDB) Block(root [32]byte) (*pb.BeaconBlock, error) {
return err
})
db.blocksLock.RUnlock()
db.blocksLock.Lock()
defer db.blocksLock.Unlock()
// Save block to the cache since it wasn't there before.
if block != nil {
db.blocks[root] = block
blockCacheMiss.Inc()
blockCacheSize.Set(float64(len(db.blocks)))
}
return block, err
}
// HasBlock accepts a block root and returns true if the block does not exist.
func (db *BeaconDB) HasBlock(root [32]byte) bool {
db.blocksLock.RLock()
defer db.blocksLock.RUnlock()
// Check the cache first to see if block exists.
if _, exists := db.blocks[root]; exists {
return true
}
hasBlock := false
// #nosec G104
_ = db.view(func(tx *bolt.Tx) error {
@@ -92,10 +131,22 @@ func (db *BeaconDB) MarkEvilBlockHash(root [32]byte) {
// SaveBlock accepts a block and writes it to disk.
func (db *BeaconDB) SaveBlock(block *pb.BeaconBlock) error {
db.blocksLock.Lock()
defer db.blocksLock.Unlock()
root, err := hashutil.HashBeaconBlock(block)
if err != nil {
return fmt.Errorf("failed to tree hash block: %v", err)
}
// Skip saving block to DB if it exists in the cache.
if blk, exists := db.blocks[root]; exists && blk != nil {
return nil
}
// Save it to the cache if it's not in the cache.
db.blocks[root] = block
blockCacheSize.Set(float64(len(db.blocks)))
enc, err := proto.Marshal(block)
if err != nil {
return fmt.Errorf("failed to encode block: %v", err)
@@ -117,10 +168,18 @@ func (db *BeaconDB) SaveBlock(block *pb.BeaconBlock) error {
// DeleteBlock deletes a block using the slot and its root as keys in their respective buckets.
func (db *BeaconDB) DeleteBlock(block *pb.BeaconBlock) error {
db.blocksLock.Lock()
defer db.blocksLock.Unlock()
root, err := hashutil.HashBeaconBlock(block)
if err != nil {
return fmt.Errorf("failed to tree hash block: %v", err)
}
// Delete the block from the cache.
delete(db.blocks, root)
blockCacheSize.Set(float64(len(db.blocks)))
slotRootBinary := encodeSlotNumberRoot(block.Slot, root)
return db.update(func(tx *bolt.Tx) error {
@@ -329,3 +388,11 @@ func (db *BeaconDB) BlocksBySlot(ctx context.Context, slot uint64) ([]*pb.Beacon
func (db *BeaconDB) HighestBlockSlot() uint64 {
return db.highestBlockSlot
}
// ClearBlockCache prunes the block cache. This is used on every new finalized epoch.
func (db *BeaconDB) ClearBlockCache() {
db.blocksLock.Lock()
defer db.blocksLock.Unlock()
db.blocks = make(map[[32]byte]*pb.BeaconBlock)
blockCacheSize.Set(float64(len(db.blocks)))
}

View File

@@ -82,6 +82,59 @@ func TestSaveBlock_OK(t *testing.T) {
}
}
func TestSaveBlock_NilBlkInCache(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
block := &pb.BeaconBlock{Slot: 999}
h1, _ := hashutil.HashBeaconBlock(block)
// Save a nil block to with block root.
db.blocks[h1] = nil
if err := db.SaveBlock(block); err != nil {
t.Fatalf("save block failed: %v", err)
}
savedBlock, err := db.Block(h1)
if err != nil {
t.Fatal(err)
}
if !proto.Equal(block, savedBlock) {
t.Error("Could not save block in DB")
}
// Verify we have the correct cached block
if !proto.Equal(db.blocks[h1], savedBlock) {
t.Error("Could not save block in cache")
}
}
func TestSaveBlockInCache_OK(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
block := &pb.BeaconBlock{Slot: 999}
h, _ := hashutil.HashBeaconBlock(block)
err := db.SaveBlock(block)
if err != nil {
t.Fatalf("save block failed: %v", err)
}
if !proto.Equal(block, db.blocks[h]) {
t.Error("Could not save block in cache")
}
savedBlock, err := db.Block(h)
if err != nil {
t.Fatal(err)
}
if !proto.Equal(block, savedBlock) {
t.Error("Could not save block in cache")
}
}
func TestDeleteBlock_OK(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
@@ -113,6 +166,27 @@ func TestDeleteBlock_OK(t *testing.T) {
}
}
func TestDeleteBlockInCache_OK(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
block := &pb.BeaconBlock{Slot: 0}
h, _ := hashutil.HashBeaconBlock(block)
err := db.SaveBlock(block)
if err != nil {
t.Fatalf("save block failed: %v", err)
}
if err := db.DeleteBlock(block); err != nil {
t.Fatal(err)
}
if _, exists := db.blocks[h]; exists {
t.Error("Expected block to have been deleted")
}
}
func TestBlocksBySlotEmptyChain_OK(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
@@ -427,5 +501,23 @@ func TestHighestBlockSlot_UpdatedOnSaveBlock(t *testing.T) {
if db.HighestBlockSlot() != block.Slot {
t.Errorf("Unexpected highest slot %d, wanted %d", db.HighestBlockSlot(), block.Slot)
}
}
func TestClearBlockCache_OK(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
block := &pb.BeaconBlock{Slot: 0}
err := db.SaveBlock(block)
if err != nil {
t.Fatalf("save block failed: %v", err)
}
if len(db.blocks) != 1 {
t.Error("incorrect block cache length")
}
db.ClearBlockCache()
if len(db.blocks) != 0 {
t.Error("incorrect block cache length")
}
}

View File

@@ -34,6 +34,8 @@ type BeaconDB struct {
// We keep a map of hashes of blocks which failed processing for blacklisting.
badBlockHashes map[[32]byte]bool
badBlocksLock sync.RWMutex
blocks map[[32]byte]*pb.BeaconBlock
blocksLock sync.RWMutex
// Beacon chain deposits in memory.
pendingDeposits []*depositContainer
@@ -83,6 +85,7 @@ func NewDB(dirPath string) (*BeaconDB, error) {
}
db := &BeaconDB{db: boltDB, DatabasePath: dirPath}
db.blocks = make(map[[32]byte]*pb.BeaconBlock)
if err := db.update(func(tx *bolt.Tx) error {
return createBuckets(tx, blockBucket, attestationBucket, attestationTargetBucket, mainChainBucket,

View File

@@ -9,6 +9,7 @@ import (
"strings"
"testing"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/testutil"
)
@@ -23,6 +24,8 @@ func setupDB(t testing.TB) *BeaconDB {
t.Fatalf("Failed to remove directory: %v", err)
}
db, err := NewDB(path)
db.blocks = make(map[[32]byte]*pb.BeaconBlock)
if err != nil {
t.Fatalf("Failed to instantiate DB: %v", err)
}

View File

@@ -1,6 +1,7 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1 (interfaces: BeaconServiceServer,BeaconService_WaitForChainStartServer,BeaconService_LatestAttestationServer)
// Source: github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1 (interfaces: BeaconServiceServer,BeaconService_LatestAttestationServer,BeaconService_WaitForChainStartServer)
// Package internal is a generated GoMock package.
package internal
import (
@@ -140,125 +141,6 @@ func (mr *MockBeaconServiceServerMockRecorder) WaitForChainStart(arg0, arg1 inte
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitForChainStart", reflect.TypeOf((*MockBeaconServiceServer)(nil).WaitForChainStart), arg0, arg1)
}
// MockBeaconService_WaitForChainStartServer is a mock of BeaconService_WaitForChainStartServer interface
type MockBeaconService_WaitForChainStartServer struct {
ctrl *gomock.Controller
recorder *MockBeaconService_WaitForChainStartServerMockRecorder
}
// MockBeaconService_WaitForChainStartServerMockRecorder is the mock recorder for MockBeaconService_WaitForChainStartServer
type MockBeaconService_WaitForChainStartServerMockRecorder struct {
mock *MockBeaconService_WaitForChainStartServer
}
// NewMockBeaconService_WaitForChainStartServer creates a new mock instance
func NewMockBeaconService_WaitForChainStartServer(ctrl *gomock.Controller) *MockBeaconService_WaitForChainStartServer {
mock := &MockBeaconService_WaitForChainStartServer{ctrl: ctrl}
mock.recorder = &MockBeaconService_WaitForChainStartServerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockBeaconService_WaitForChainStartServer) EXPECT() *MockBeaconService_WaitForChainStartServerMockRecorder {
return m.recorder
}
// Context mocks base method
func (m *MockBeaconService_WaitForChainStartServer) Context() context.Context {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Context")
ret0, _ := ret[0].(context.Context)
return ret0
}
// Context indicates an expected call of Context
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) Context() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).Context))
}
// RecvMsg mocks base method
func (m *MockBeaconService_WaitForChainStartServer) RecvMsg(arg0 interface{}) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RecvMsg", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// RecvMsg indicates an expected call of RecvMsg
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).RecvMsg), arg0)
}
// Send mocks base method
func (m *MockBeaconService_WaitForChainStartServer) Send(arg0 *v10.ChainStartResponse) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Send", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// Send indicates an expected call of Send
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) Send(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).Send), arg0)
}
// SendHeader mocks base method
func (m *MockBeaconService_WaitForChainStartServer) SendHeader(arg0 metadata.MD) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SendHeader", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SendHeader indicates an expected call of SendHeader
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).SendHeader), arg0)
}
// SendMsg mocks base method
func (m *MockBeaconService_WaitForChainStartServer) SendMsg(arg0 interface{}) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SendMsg", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SendMsg indicates an expected call of SendMsg
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) SendMsg(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).SendMsg), arg0)
}
// SetHeader mocks base method
func (m *MockBeaconService_WaitForChainStartServer) SetHeader(arg0 metadata.MD) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetHeader", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SetHeader indicates an expected call of SetHeader
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).SetHeader), arg0)
}
// SetTrailer mocks base method
func (m *MockBeaconService_WaitForChainStartServer) SetTrailer(arg0 metadata.MD) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "SetTrailer", arg0)
}
// SetTrailer indicates an expected call of SetTrailer
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).SetTrailer), arg0)
}
// MockBeaconService_LatestAttestationServer is a mock of BeaconService_LatestAttestationServer interface
type MockBeaconService_LatestAttestationServer struct {
ctrl *gomock.Controller
@@ -377,3 +259,122 @@ func (mr *MockBeaconService_LatestAttestationServerMockRecorder) SetTrailer(arg0
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockBeaconService_LatestAttestationServer)(nil).SetTrailer), arg0)
}
// MockBeaconService_WaitForChainStartServer is a mock of BeaconService_WaitForChainStartServer interface
type MockBeaconService_WaitForChainStartServer struct {
ctrl *gomock.Controller
recorder *MockBeaconService_WaitForChainStartServerMockRecorder
}
// MockBeaconService_WaitForChainStartServerMockRecorder is the mock recorder for MockBeaconService_WaitForChainStartServer
type MockBeaconService_WaitForChainStartServerMockRecorder struct {
mock *MockBeaconService_WaitForChainStartServer
}
// NewMockBeaconService_WaitForChainStartServer creates a new mock instance
func NewMockBeaconService_WaitForChainStartServer(ctrl *gomock.Controller) *MockBeaconService_WaitForChainStartServer {
mock := &MockBeaconService_WaitForChainStartServer{ctrl: ctrl}
mock.recorder = &MockBeaconService_WaitForChainStartServerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockBeaconService_WaitForChainStartServer) EXPECT() *MockBeaconService_WaitForChainStartServerMockRecorder {
return m.recorder
}
// Context mocks base method
func (m *MockBeaconService_WaitForChainStartServer) Context() context.Context {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Context")
ret0, _ := ret[0].(context.Context)
return ret0
}
// Context indicates an expected call of Context
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) Context() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).Context))
}
// RecvMsg mocks base method
func (m *MockBeaconService_WaitForChainStartServer) RecvMsg(arg0 interface{}) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RecvMsg", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// RecvMsg indicates an expected call of RecvMsg
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).RecvMsg), arg0)
}
// Send mocks base method
func (m *MockBeaconService_WaitForChainStartServer) Send(arg0 *v10.ChainStartResponse) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Send", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// Send indicates an expected call of Send
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) Send(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).Send), arg0)
}
// SendHeader mocks base method
func (m *MockBeaconService_WaitForChainStartServer) SendHeader(arg0 metadata.MD) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SendHeader", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SendHeader indicates an expected call of SendHeader
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).SendHeader), arg0)
}
// SendMsg mocks base method
func (m *MockBeaconService_WaitForChainStartServer) SendMsg(arg0 interface{}) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SendMsg", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SendMsg indicates an expected call of SendMsg
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) SendMsg(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).SendMsg), arg0)
}
// SetHeader mocks base method
func (m *MockBeaconService_WaitForChainStartServer) SetHeader(arg0 metadata.MD) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetHeader", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SetHeader indicates an expected call of SetHeader
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).SetHeader), arg0)
}
// SetTrailer mocks base method
func (m *MockBeaconService_WaitForChainStartServer) SetTrailer(arg0 metadata.MD) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "SetTrailer", arg0)
}
// SetTrailer indicates an expected call of SetTrailer
func (mr *MockBeaconService_WaitForChainStartServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockBeaconService_WaitForChainStartServer)(nil).SetTrailer), arg0)
}

View File

@@ -51,6 +51,21 @@ func (mr *MockValidatorServiceServerMockRecorder) CommitteeAssignment(arg0, arg1
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitteeAssignment", reflect.TypeOf((*MockValidatorServiceServer)(nil).CommitteeAssignment), arg0, arg1)
}
// ExitedValidators mocks base method
func (m *MockValidatorServiceServer) ExitedValidators(arg0 context.Context, arg1 *v1.ExitedValidatorsRequest) (*v1.ExitedValidatorsResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ExitedValidators", arg0, arg1)
ret0, _ := ret[0].(*v1.ExitedValidatorsResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ExitedValidators indicates an expected call of ExitedValidators
func (mr *MockValidatorServiceServerMockRecorder) ExitedValidators(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExitedValidators", reflect.TypeOf((*MockValidatorServiceServer)(nil).ExitedValidators), arg0, arg1)
}
// ValidatorIndex mocks base method
func (m *MockValidatorServiceServer) ValidatorIndex(arg0 context.Context, arg1 *v1.ValidatorIndexRequest) (*v1.ValidatorIndexResponse, error) {
m.ctrl.T.Helper()

View File

@@ -1,15 +1,18 @@
// Package beacon-chain defines all the utlities needed for a beacon chain node.
// Package beacon-chain defines all the utilities needed for a beacon chain node.
package main
import (
"fmt"
"os"
"runtime"
joonix "github.com/joonix/log"
"github.com/prysmaticlabs/prysm/beacon-chain/node"
"github.com/prysmaticlabs/prysm/beacon-chain/utils"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/debug"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/logutil"
"github.com/prysmaticlabs/prysm/shared/version"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
@@ -33,10 +36,6 @@ func startNode(ctx *cli.Context) error {
}
func main() {
customFormatter := new(prefixed.TextFormatter)
customFormatter.TimestampFormat = "2006-01-02 15:04:05"
customFormatter.FullTimestamp = true
logrus.SetFormatter(customFormatter)
log := logrus.WithField("prefix", "main")
app := cli.NewApp()
app.Name = "beacon-chain"
@@ -54,29 +53,64 @@ func main() {
utils.KeyFlag,
utils.EnableDBCleanup,
cmd.BootstrapNode,
cmd.NoDiscovery,
cmd.StaticPeers,
cmd.RelayNode,
cmd.P2PPort,
cmd.P2PHost,
cmd.P2PMaxPeers,
cmd.P2PWhitelist,
cmd.DataDirFlag,
cmd.VerbosityFlag,
cmd.EnableTracingFlag,
cmd.TracingProcessNameFlag,
cmd.TracingEndpointFlag,
cmd.TraceSampleFractionFlag,
cmd.MonitoringPortFlag,
cmd.DisableMonitoringFlag,
cmd.ClearDB,
cmd.LogFormat,
cmd.MaxGoroutines,
debug.PProfFlag,
debug.PProfAddrFlag,
debug.PProfPortFlag,
debug.MemProfileRateFlag,
debug.CPUProfileFlag,
debug.TraceFlag,
cmd.LogFileName,
}
app.Flags = append(app.Flags, featureconfig.BeaconChainFlags...)
app.Before = func(ctx *cli.Context) error {
format := ctx.GlobalString(cmd.LogFormat.Name)
switch format {
case "text":
formatter := new(prefixed.TextFormatter)
formatter.TimestampFormat = "2006-01-02 15:04:05"
formatter.FullTimestamp = true
// If persistent log files are written - we disable the log messages coloring because
// the colors are ANSI codes and seen as gibberish in the log files.
formatter.DisableColors = ctx.GlobalString(cmd.LogFileName.Name) != ""
logrus.SetFormatter(formatter)
break
case "fluentd":
logrus.SetFormatter(joonix.NewFormatter())
break
case "json":
logrus.SetFormatter(&logrus.JSONFormatter{})
break
default:
return fmt.Errorf("unknown log format %s", format)
}
logFileName := ctx.GlobalString(cmd.LogFileName.Name)
if logFileName != "" {
if err := logutil.ConfigurePersistentLogging(logFileName); err != nil {
log.WithError(err).Error("Failed to configuring logging to disk.")
}
}
runtime.GOMAXPROCS(runtime.NumCPU())
return debug.Setup(ctx)
}

View File

@@ -55,6 +55,7 @@ type BeaconNode struct {
func NewBeaconNode(ctx *cli.Context) (*BeaconNode, error) {
if err := tracing.Setup(
"beacon-chain", // service name
ctx.GlobalString(cmd.TracingProcessNameFlag.Name),
ctx.GlobalString(cmd.TracingEndpointFlag.Name),
ctx.GlobalFloat64(cmd.TraceSampleFractionFlag.Name),
ctx.GlobalBool(cmd.EnableTracingFlag.Name),
@@ -193,7 +194,7 @@ func (b *BeaconNode) registerP2P(ctx *cli.Context) error {
return b.services.RegisterService(beaconp2p)
}
func (b *BeaconNode) registerBlockchainService(_ *cli.Context) error {
func (b *BeaconNode) registerBlockchainService(ctx *cli.Context) error {
var web3Service *powchain.Web3Service
if err := b.services.FetchService(&web3Service); err != nil {
return err
@@ -210,6 +211,7 @@ func (b *BeaconNode) registerBlockchainService(_ *cli.Context) error {
if err := b.services.FetchService(&p2pService); err != nil {
return err
}
maxRoutines := ctx.GlobalInt64(cmd.MaxGoroutines.Name)
blockchainService, err := blockchain.NewChainService(context.Background(), &blockchain.Config{
BeaconDB: b.db,
@@ -217,6 +219,7 @@ func (b *BeaconNode) registerBlockchainService(_ *cli.Context) error {
OpsPoolService: opsService,
AttsService: attsService,
P2p: p2pService,
MaxRoutines: maxRoutines,
})
if err != nil {
return fmt.Errorf("could not register blockchain service: %v", err)

View File

@@ -1,6 +1,8 @@
package node
import (
"strings"
"github.com/gogo/protobuf/proto"
"github.com/prysmaticlabs/prysm/beacon-chain/utils"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
@@ -36,15 +38,22 @@ func configureP2P(ctx *cli.Context) (*p2p.Server, error) {
return nil, err
}
}
staticPeers := []string{}
for _, entry := range ctx.GlobalStringSlice(cmd.StaticPeers.Name) {
peers := strings.Split(entry, ",")
staticPeers = append(staticPeers, peers...)
}
s, err := p2p.NewServer(&p2p.ServerConfig{
NoDiscovery: ctx.GlobalBool(cmd.NoDiscovery.Name),
StaticPeers: staticPeers,
BootstrapNodeAddr: ctx.GlobalString(cmd.BootstrapNode.Name),
RelayNodeAddr: ctx.GlobalString(cmd.RelayNode.Name),
HostAddress: ctx.GlobalString(cmd.P2PHost.Name),
Port: ctx.GlobalInt(cmd.P2PPort.Name),
MaxPeers: ctx.GlobalInt(cmd.P2PMaxPeers.Name),
DepositContractAddress: contractAddress,
WhitelistCIDR: ctx.GlobalString(cmd.P2PWhitelist.Name),
})
if err != nil {
return nil, err

View File

@@ -343,8 +343,10 @@ func (w *Web3Service) run(done <-chan struct{}) {
case w.runError = <-headSub.Err():
log.Debugf("Unsubscribed to head events, exiting goroutine: %v", w.runError)
return
case header := <-w.headerChan:
w.processSubscribedHeaders(header)
case header, ok := <-w.headerChan:
if ok {
w.processSubscribedHeaders(header)
}
case <-ticker.C:
w.handleDelayTicker()
}

View File

@@ -44,6 +44,7 @@ go_library(
go_test(
name = "go_default_test",
size = "small",
srcs = [
"attester_server_test.go",
"beacon_server_test.go",

View File

@@ -2,6 +2,7 @@ package rpc
import (
"context"
"errors"
"fmt"
"github.com/prysmaticlabs/prysm/beacon-chain/cache"
@@ -76,6 +77,17 @@ func (as *AttesterServer) AttestationDataAtSlot(ctx context.Context, req *pb.Att
}
if err := as.cache.MarkInProgress(req); err != nil {
if err == cache.ErrAlreadyInProgress {
res, err := as.cache.Get(ctx, req)
if err != nil {
return nil, err
}
if res == nil {
return nil, errors.New("a request was in progress and resolved to nil")
}
return res, nil
}
return nil, err
}
defer func() {

View File

@@ -2,6 +2,7 @@ package rpc
import (
"context"
"sync"
"testing"
"github.com/gogo/protobuf/proto"
@@ -235,3 +236,51 @@ func TestAttestationDataAtSlot_handlesFarAwayJustifiedEpoch(t *testing.T) {
t.Errorf("Expected attestation info to match, received %v, wanted %v", res, expectedInfo)
}
}
func TestAttestationDataAtSlot_handlesInProgressRequest(t *testing.T) {
ctx := context.Background()
server := &AttesterServer{
cache: cache.NewAttestationCache(),
}
req := &pb.AttestationDataRequest{
Shard: 1,
Slot: 2,
}
res := &pb.AttestationDataResponse{
HeadSlot: 55,
}
if err := server.cache.MarkInProgress(req); err != nil {
t.Fatal(err)
}
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
response, err := server.AttestationDataAtSlot(ctx, req)
if err != nil {
t.Error(err)
}
if !proto.Equal(res, response) {
t.Error("Expected equal responses from cache")
}
}()
wg.Add(1)
go func() {
defer wg.Done()
if err := server.cache.Put(ctx, req, res); err != nil {
t.Error(err)
}
if err := server.cache.MarkNotInProgress(req); err != nil {
t.Error(err)
}
}()
wg.Wait()
}

View File

@@ -7,10 +7,9 @@ import (
"math/big"
"time"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
ptypes "github.com/gogo/protobuf/types"
"github.com/prysmaticlabs/prysm/beacon-chain/blockchain"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/db"
pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
pb "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1"
@@ -239,7 +238,7 @@ func (bs *BeaconServer) BlockTree(ctx context.Context, _ *ptypes.Empty) (*pb.Blo
if ctx.Err() != nil {
return nil, ctx.Err()
}
votes, err := blockchain.VoteCount(kid, justifiedState, attestationTargets, bs.beaconDB)
participatedVotes, err := blockchain.VoteCount(kid, justifiedState, attestationTargets, bs.beaconDB)
if err != nil {
return nil, err
}
@@ -248,9 +247,9 @@ func (bs *BeaconServer) BlockTree(ctx context.Context, _ *ptypes.Empty) (*pb.Blo
return nil, err
}
tree = append(tree, &pb.BlockTreeResponse_TreeNode{
BlockRoot: blockRoot[:],
Block: kid,
Votes: uint64(votes),
BlockRoot: blockRoot[:],
Block: kid,
ParticipatedVotes: uint64(participatedVotes),
})
}
return &pb.BlockTreeResponse{

View File

@@ -746,20 +746,24 @@ func TestEth1Data_NonEmptyVotesSelectsBestVote(t *testing.T) {
func TestBlockTree_OK(t *testing.T) {
db := internal.SetupDB(t)
defer internal.TeardownDB(t, db)
ctx := context.Background()
// We want to ensure that if our block tree looks as follows, the RPC response
// returns the correct information.
// /->[A, Slot 3, 3 Votes]->[B, Slot 4, 3 Votes]
// [Justified Block]->[C, Slot 3, 2 Votes]
// \->[D, Slot 3, 2 Votes]->[SKIP SLOT]->[E, Slot 5, 1 Vote]
var validators []*pbp2p.Validator
for i := 0; i < 11; i++ {
validators = append(validators, &pbp2p.Validator{EffectiveBalance: params.BeaconConfig().MaxEffectiveBalance})
for i := 0; i < 13; i++ {
validators = append(validators, &pbp2p.Validator{ExitEpoch: params.BeaconConfig().FarFutureEpoch})
}
justifiedState := &pbp2p.BeaconState{
Slot: 0,
Balances: make([]uint64, 11),
ValidatorRegistry: validators,
}
for i := 0; i < len(justifiedState.Balances); i++ {
justifiedState.Balances[i] = params.BeaconConfig().MaxDepositAmount
}
if err := db.SaveJustifiedState(justifiedState); err != nil {
t.Fatal(err)
}
@@ -770,43 +774,73 @@ func TestBlockTree_OK(t *testing.T) {
t.Fatal(err)
}
justifiedRoot, _ := hashutil.HashBeaconBlock(justifiedBlock)
balances := []uint64{params.BeaconConfig().MaxDepositAmount}
b1 := &pbp2p.BeaconBlock{
Slot: 3,
ParentRoot: justifiedRoot[:],
Body: &pbp2p.BeaconBlockBody{
RandaoReveal: []byte("D"),
},
StateRoot: []byte{0x1},
}
b1Root, _ := hashutil.HashBeaconBlock(b1)
if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{
Slot: 3,
ValidatorRegistry: validators,
Balances: balances,
}, b1Root); err != nil {
t.Fatal(err)
}
b2 := &pbp2p.BeaconBlock{
Slot: 3,
ParentRoot: justifiedRoot[:],
Body: &pbp2p.BeaconBlockBody{
RandaoReveal: []byte("C"),
}}
StateRoot: []byte{0x2},
}
b2Root, _ := hashutil.HashBeaconBlock(b2)
if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{
Slot: 3,
ValidatorRegistry: validators,
Balances: balances,
}, b2Root); err != nil {
t.Fatal(err)
}
b3 := &pbp2p.BeaconBlock{
Slot: 3,
ParentRoot: justifiedRoot[:],
Body: &pbp2p.BeaconBlockBody{
RandaoReveal: []byte("A"),
}}
b3Root, _ := hashutil.HashBeaconBlock(b1)
StateRoot: []byte{0x3},
}
b3Root, _ := hashutil.HashBeaconBlock(b3)
if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{
Slot: 3,
ValidatorRegistry: validators,
Balances: balances,
}, b3Root); err != nil {
t.Fatal(err)
}
b4 := &pbp2p.BeaconBlock{
Slot: 4,
ParentRoot: b1Root[:],
Body: &pbp2p.BeaconBlockBody{
RandaoReveal: []byte("B"),
}}
StateRoot: []byte{0x4},
}
b4Root, _ := hashutil.HashBeaconBlock(b4)
if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{
Slot: 4,
ValidatorRegistry: validators,
Balances: balances,
}, b4Root); err != nil {
t.Fatal(err)
}
b5 := &pbp2p.BeaconBlock{
Slot: 5,
ParentRoot: b3Root[:],
Body: &pbp2p.BeaconBlockBody{
RandaoReveal: []byte("E"),
}}
StateRoot: []byte{0x5},
}
b5Root, _ := hashutil.HashBeaconBlock(b5)
if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{
Slot: 5,
ValidatorRegistry: validators,
Balances: balances,
}, b5Root); err != nil {
t.Fatal(err)
}
attestationTargets := make(map[uint64]*pbp2p.AttestationTarget)
// We give block A 3 votes.
attestationTargets[0] = &pbp2p.AttestationTarget{
@@ -875,24 +909,29 @@ func TestBlockTree_OK(t *testing.T) {
tree := []*pb.BlockTreeResponse_TreeNode{
{
Block: b1,
Votes: 3 * params.BeaconConfig().MaxDepositAmount,
Block: b1,
ParticipatedVotes: 3 * params.BeaconConfig().MaxDepositAmount,
TotalVotes: params.BeaconConfig().MaxDepositAmount,
},
{
Block: b2,
Votes: 2 * params.BeaconConfig().MaxDepositAmount,
Block: b2,
ParticipatedVotes: 2 * params.BeaconConfig().MaxDepositAmount,
TotalVotes: params.BeaconConfig().MaxDepositAmount,
},
{
Block: b3,
Votes: 2 * params.BeaconConfig().MaxDepositAmount,
Block: b3,
ParticipatedVotes: 2 * params.BeaconConfig().MaxDepositAmount,
TotalVotes: params.BeaconConfig().MaxDepositAmount,
},
{
Block: b4,
Votes: 3 * params.BeaconConfig().MaxDepositAmount,
Block: b4,
ParticipatedVotes: 3 * params.BeaconConfig().MaxDepositAmount,
TotalVotes: params.BeaconConfig().MaxDepositAmount,
},
{
Block: b5,
Votes: 1 * params.BeaconConfig().MaxDepositAmount,
Block: b5,
ParticipatedVotes: 1 * params.BeaconConfig().MaxDepositAmount,
TotalVotes: params.BeaconConfig().MaxDepositAmount,
},
}
for _, node := range tree {
@@ -904,7 +943,6 @@ func TestBlockTree_OK(t *testing.T) {
headState := &pbp2p.BeaconState{
Slot: b4.Slot,
}
ctx := context.Background()
if err := db.UpdateChainHead(ctx, b4, headState); err != nil {
t.Fatal(err)
}
@@ -913,15 +951,16 @@ func TestBlockTree_OK(t *testing.T) {
beaconDB: db,
targetsFetcher: &mockChainService{targets: attestationTargets},
}
sort.Slice(tree, func(i, j int) bool {
return string(tree[i].Block.StateRoot) < string(tree[j].Block.StateRoot)
})
resp, err := bs.BlockTree(ctx, &ptypes.Empty{})
if err != nil {
t.Fatal(err)
}
sort.Slice(resp.Tree, func(i, j int) bool {
return string(resp.Tree[i].Block.Signature) < string(resp.Tree[j].Block.Signature)
})
sort.Slice(tree, func(i, j int) bool {
return string(tree[i].Block.Signature) < string(tree[j].Block.Signature)
return string(resp.Tree[i].Block.StateRoot) < string(resp.Tree[j].Block.StateRoot)
})
for i := range resp.Tree {
if !proto.Equal(resp.Tree[i].Block, tree[i].Block) {

View File

@@ -109,21 +109,19 @@ func (ps *ProposerServer) PendingAttestations(ctx context.Context, req *pb.Pendi
}
continue
}
if featureconfig.FeatureConfig().EnableCanonicalAttestationFilter {
canonical, err := ps.operationService.IsAttCanonical(ctx, att)
if err != nil {
// Delete attestation that failed to verify as canonical.
if err := ps.beaconDB.DeleteAttestation(att); err != nil {
return nil, fmt.Errorf("could not delete failed attestation: %v", err)
}
return nil, fmt.Errorf("could not verify canonical attestation: %v", err)
}
// Skip the attestation if it's not canonical.
if !canonical {
continue
canonical, err := ps.operationService.IsAttCanonical(ctx, att)
if err != nil {
// Delete attestation that failed to verify as canonical.
if err := ps.beaconDB.DeleteAttestation(att); err != nil {
return nil, fmt.Errorf("could not delete failed attestation: %v", err)
}
return nil, fmt.Errorf("could not verify canonical attestation: %v", err)
}
// Skip the attestation if it's not canonical.
if !canonical {
continue
}
validAtts = append(validAtts, att)
}

View File

@@ -22,15 +22,6 @@ func init() {
logrus.SetOutput(ioutil.Discard)
}
type TestLogger struct {
logrus.FieldLogger
testMap map[string]interface{}
}
func (t *TestLogger) Errorf(format string, args ...interface{}) {
t.testMap["error"] = true
}
type mockOperationService struct {
pendingAttestations []*pb.Attestation
}
@@ -57,21 +48,21 @@ func (ms *mockOperationService) PendingAttestations(_ context.Context) ([]*pb.At
}
return []*pb.Attestation{
{
AggregationBitfield: []byte("A"),
AggregationBitfield: []byte{0xC0},
Data: &pb.AttestationData{
Slot: params.BeaconConfig().SlotsPerEpoch,
CrosslinkDataRoot: params.BeaconConfig().ZeroHash[:],
},
},
{
AggregationBitfield: []byte("B"),
AggregationBitfield: []byte{0xC1},
Data: &pb.AttestationData{
Slot: params.BeaconConfig().SlotsPerEpoch,
CrosslinkDataRoot: params.BeaconConfig().ZeroHash[:],
},
},
{
AggregationBitfield: []byte("C"),
AggregationBitfield: []byte{0xC2},
Data: &pb.AttestationData{
Slot: params.BeaconConfig().SlotsPerEpoch,
CrosslinkDataRoot: params.BeaconConfig().ZeroHash[:],
@@ -157,31 +148,23 @@ func TestLifecycle_OK(t *testing.T) {
}
func TestRPC_BadEndpoint(t *testing.T) {
fl := logrus.WithField("prefix", "rpc")
log = &TestLogger{
FieldLogger: fl,
testMap: make(map[string]interface{}),
}
hook := logTest.NewLocal(fl.Logger)
hook := logTest.NewGlobal()
rpcService := NewRPCService(context.Background(), &Config{
Port: "ralph merkle!!!",
SyncService: &mockSyncService{},
})
if val, ok := log.(*TestLogger).testMap["error"]; ok {
t.Fatalf("Error in Start() occurred before expected: %v", val)
}
testutil.AssertLogsDoNotContain(t, hook, "Could not listen to port in Start()")
testutil.AssertLogsDoNotContain(t, hook, "Could not load TLS keys")
testutil.AssertLogsDoNotContain(t, hook, "Could not serve gRPC")
rpcService.Start()
if _, ok := log.(*TestLogger).testMap["error"]; !ok {
t.Fatal("No error occurred. Expected Start() to output an error")
}
testutil.AssertLogsContain(t, hook, "Starting service")
testutil.AssertLogsContain(t, hook, "Could not listen to port in Start()")
rpcService.Stop()
}

View File

@@ -207,7 +207,6 @@ func (vs *ValidatorServer) ValidatorStatus(
if err != nil {
return nil, err
}
chainStartKeys := vs.chainStartPubkeys()
validatorIndexMap := stateutils.ValidatorIndexMap(beaconState)
return vs.validatorStatus(ctx, req.PublicKey, chainStarted, chainStartKeys, validatorIndexMap, beaconState), nil
@@ -236,6 +235,9 @@ func (vs *ValidatorServer) MultipleValidatorStatus(
return false, nil, ctx.Err()
}
status := vs.validatorStatus(ctx, key, chainStarted, chainStartKeys, validatorIndexMap, beaconState)
if status == nil {
continue
}
resp := &pb.ValidatorActivationResponse_Status{
Status: status,
PublicKey: key,
@@ -249,6 +251,34 @@ func (vs *ValidatorServer) MultipleValidatorStatus(
return activeValidatorExists, statusResponses, nil
}
// ExitedValidators queries validator statuses for a give list of validators
// and returns a filtered list of validator keys that are exited.
func (vs *ValidatorServer) ExitedValidators(
ctx context.Context,
req *pb.ExitedValidatorsRequest) (*pb.ExitedValidatorsResponse, error) {
_, statuses, err := vs.MultipleValidatorStatus(ctx, req.PublicKeys)
if err != nil {
return nil, err
}
exitedKeys := make([][]byte, 0)
for _, status := range statuses {
s := status.Status.Status
if s == pb.ValidatorStatus_EXITED ||
s == pb.ValidatorStatus_EXITED_SLASHED ||
s == pb.ValidatorStatus_INITIATED_EXIT {
exitedKeys = append(exitedKeys, status.PublicKey)
}
}
resp := &pb.ExitedValidatorsResponse{
PublicKeys: exitedKeys,
}
return resp, nil
}
func (vs *ValidatorServer) validatorStatus(
ctx context.Context, pubKey []byte, chainStarted bool,
chainStartKeys map[[96]byte]bool, idxMap map[[32]byte]int,

View File

@@ -171,7 +171,8 @@ func TestCommitteeAssignment_OK(t *testing.T) {
if err := db.SaveBlock(genesis); err != nil {
t.Fatalf("Could not save genesis block: %v", err)
}
state, err := genesisState(params.BeaconConfig().DepositsForChainStart)
depChainStart := params.BeaconConfig().DepositsForChainStart / 16
state, err := genesisState(depChainStart)
if err != nil {
t.Fatalf("Could not setup genesis state: %v", err)
}
@@ -179,7 +180,7 @@ func TestCommitteeAssignment_OK(t *testing.T) {
t.Fatalf("Could not save genesis state: %v", err)
}
var wg sync.WaitGroup
numOfValidators := int(params.BeaconConfig().DepositsForChainStart)
numOfValidators := int(depChainStart)
errs := make(chan error, numOfValidators)
for i := 0; i < numOfValidators; i++ {
pubKeyBuf := make([]byte, params.BeaconConfig().BLSPubkeyLength)
@@ -224,7 +225,7 @@ func TestCommitteeAssignment_OK(t *testing.T) {
}
// Test the last validator in registry.
lastValidatorIndex := params.BeaconConfig().DepositsForChainStart - 1
lastValidatorIndex := depChainStart - 1
pubKeyBuf = make([]byte, params.BeaconConfig().BLSPubkeyLength)
copy(pubKeyBuf[:], []byte(strconv.FormatUint(lastValidatorIndex, 10)))
req = &pb.CommitteeAssignmentsRequest{
@@ -254,7 +255,8 @@ func TestCommitteeAssignment_multipleKeys_OK(t *testing.T) {
if err := db.SaveBlock(genesis); err != nil {
t.Fatalf("Could not save genesis block: %v", err)
}
state, err := genesisState(params.BeaconConfig().DepositsForChainStart)
depChainStart := params.BeaconConfig().DepositsForChainStart / 16
state, err := genesisState(depChainStart)
if err != nil {
t.Fatalf("Could not setup genesis state: %v", err)
}
@@ -262,7 +264,7 @@ func TestCommitteeAssignment_multipleKeys_OK(t *testing.T) {
t.Fatalf("Could not save genesis state: %v", err)
}
var wg sync.WaitGroup
numOfValidators := int(params.BeaconConfig().DepositsForChainStart)
numOfValidators := int(depChainStart)
errs := make(chan error, numOfValidators)
for i := 0; i < numOfValidators; i++ {
pubKeyBuf := make([]byte, params.BeaconConfig().BLSPubkeyLength)

View File

@@ -51,10 +51,12 @@ var appHelpFlagGroups = []flagGroup{
cmd.DataDirFlag,
cmd.VerbosityFlag,
cmd.EnableTracingFlag,
cmd.TracingProcessNameFlag,
cmd.TracingEndpointFlag,
cmd.TraceSampleFractionFlag,
cmd.MonitoringPortFlag,
cmd.DisableMonitoringFlag,
cmd.MaxGoroutines,
},
},
{

View File

@@ -11,11 +11,13 @@ spec:
matchLabels:
component: beacon-chain
universe: beacon-chain
app: beacon-chain
template:
metadata:
labels:
component: beacon-chain
universe: beacon-chain
app: beacon-chain
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '9090'
@@ -52,17 +54,19 @@ spec:
- --bootstrap-node=/dns4/bootnode/tcp/$(BOOTNODE_SERVICE_PORT)/p2p/QmQEe7o6hKJdGdSkJRh7WJzS6xrex5f4w2SPR6oWbJNriw
- --relay-node=/ip4/35.224.249.2/tcp/30000/p2p/QmfAgkmjiZNZhr2wFN9TwaRgHouMTBT6HELyzE5A3BT2wK
- --p2p-port=5000
- --enable-tracing
- --tracing-endpoint=http://jaeger-collector.istio-system.svc.cluster.local:14268
- --p2p-whitelist=10.0.0.0/8 # Allow only cluster internal connections. External peers reach these nodes from the relay.
#- --enable-tracing
- --tracing-process-name=$(POD_NAME)
- --tracing-endpoint=http://jaeger-collector.istio-system.svc.cluster.local:14268/api/traces
- --trace-sample-fraction=1.0
- --datadir=/data
# Disabling gossip sub until a larger beacon chain deployment.
- --disable-gossip-sub
- --p2p-max-peers=50
- --pprof
#- --log-format=fluentd
resources:
requests:
memory: "100Mi"
cpu: "50m"
memory: "500Mi"
cpu: "250m"
volumeMounts:
- mountPath: /data
name: beacondb
@@ -79,6 +83,10 @@ spec:
configMapKeyRef:
name: beacon-config
key: DEPOSIT_CONTRACT_ADDRESS
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
readinessProbe:
initialDelaySeconds: 60
httpGet:

View File

@@ -9,7 +9,7 @@ spec:
servers:
- port:
number: 30002
name: grpc-beacon-chain
name: grpc-beacon-chain
protocol: GRPC
hosts:
- beacon.prylabs.net
@@ -19,6 +19,8 @@ apiVersion: v1
metadata:
name: beacon-chain
namespace: beacon-chain
labels:
app: beacon-chain
spec:
selector:
component: beacon-chain
@@ -50,6 +52,25 @@ spec:
port:
number: 4000
host: beacon-chain.beacon-chain.svc.cluster.local
---
kind: VirtualService
apiVersion: networking.istio.io/v1alpha3
metadata:
name: beacon-chain
namespace: beacon-chain
spec:
hosts:
- beacon-chain.beacon-chain.svc.cluster.local
gateways:
- mesh
http:
- match:
- port: 4000
route:
- destination:
port:
number: 4000
host: beacon-chain.beacon-chain.svc.cluster.local
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
@@ -62,6 +83,18 @@ spec:
loadBalancer:
consistentHash:
useSourceIp: true
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: beacon-chain-grpc-web
namespace: beacon-chain
spec:
host: beacon-chain-grpc-web.beacon-chain.svc.cluster.local
trafficPolicy:
loadBalancer:
consistentHash:
useSourceIp: true
---
# Public grpc-web service
kind: Service
@@ -69,6 +102,8 @@ apiVersion: v1
metadata:
name: beacon-chain-grpc-web
namespace: beacon-chain
labels:
app: beacon-chain
spec:
selector:
component: beacon-chain

View File

@@ -61,6 +61,7 @@ spec:
- --deposit-amount=3200000000000000000
- --db-path=/data
- --verbose
- --beaconRPC=beacon-chain.beacon-chain.svc.cluster.local:4000
ports:
- containerPort: 8000
name: grpc-service

View File

@@ -4,7 +4,7 @@ metadata:
name: validator
namespace: beacon-chain
spec:
replicas: 8
replicas: 9
selector:
matchLabels:
component: validator
@@ -18,6 +18,9 @@ spec:
metadata:
labels:
component: validator
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '9090'
spec:
priorityClassName: production-priority
containers:
@@ -27,10 +30,14 @@ spec:
- --keystore-path=/keystore
- --password=nopass
- --datadir=/data
- --beacon-rpc-provider=beacon-chain:4000
- --beacon-rpc-provider=beacon-chain.beacon-chain.svc.cluster.local:4000
- --monitoring-port=9090
- --enable-tracing
- --tracing-endpoint=http://jaeger-collector.istio-system.svc.cluster.local:14268
- --tracing-process-name=$(POD_NAME)
- --tracing-endpoint=http://jaeger-collector.istio-system.svc.cluster.local:14268/api/traces
- --trace-sample-fraction=1.0
- --log-format=fluentd
- --disable-rewards-penalties-logging
volumeMounts:
- name: localdata
mountPath: /data
@@ -41,6 +48,11 @@ spec:
requests:
cpu: "50m"
memory: "100Mi"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
initContainers:
- name: init-pk
image: gcr.io/prysmaticlabs/prysm/cluster-pk-manager/client:latest
@@ -49,6 +61,7 @@ spec:
- --keystore-password=nopass
- --pod-name=$(POD_NAME)
- --server=cluster-pk-manager:8000
- --keys=64
volumeMounts:
- name: keystore
mountPath: /keystore

56
k8s/geth/eth1monitor.yaml Normal file
View File

@@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: eth1monitor
namespace: pow
spec:
selector:
matchLabels:
app: eth1monitor
replicas: 1
template:
metadata:
labels:
app: eth1monitor
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '9090'
spec:
priorityClassName: monitoring-priority
containers:
- name: monitor
image: gcr.io/prysmaticlabs/eth1monitor:latest
args:
- --port=9090
- --addresses=/etc/config/addresses.txt
- --web3-provider=http://public-rpc-nodes.pow.svc.cluster.local:8545
volumeMounts:
- name: addresses
mountPath: /etc/config
readOnly: true
- name: configmap-reload
image: jimmidyson/configmap-reload:v0.2.2
args:
- --volume-dir=/etc/config
- --webhook-url=http://localhost:9090/reload
volumeMounts:
- name: addresses
mountPath: /etc/config
readOnly: true
volumes:
- name: addresses
configMap:
name: eth1-addresses
---
apiVersion: v1
kind: ConfigMap
metadata:
name: eth1-addresses
namespace: pow
data:
addresses.txt: |
faucet:0xae1f3f522cfb1b0ed128819e8e72fda207c47e5e
pk-manager:0x1bcd2c7dd8d5ffd8b789d90c71ac9aab55e51d5d
prylabs:0xd9a5179f091d85051d3c982785efd1455cec8699

View File

@@ -0,0 +1,177 @@
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: null
name: alertmanager-templates
namespace: istio-system
data:
default.tmpl: |
{{ define "__alertmanager" }}AlertManager{{ end }}
{{ define "__alertmanagerURL" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}{{ end }}
{{ define "__subject" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join " " }} {{ if gt (len .CommonLabels) (len .GroupLabels) }}({{ with .CommonLabels.Remove .GroupLabels.Names }}{{ .Values | join " " }}{{ end }}){{ end }}{{ end }}
{{ define "__description" }}{{ end }}
{{ define "__text_alert_list" }}{{ range . }}Labels:
{{ range .Labels.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}Annotations:
{{ range .Annotations.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}Source: {{ .GeneratorURL }}
{{ end }}{{ end }}
{{ define "slack.default.title" }}{{ template "__subject" . }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
{{ define "slack.default.fallback" }}{{ template "slack.default.title" . }} | {{ template "slack.default.titlelink" . }}{{ end }}
{{ define "slack.default.pretext" }}{{ end }}
{{ define "slack.default.titlelink" }}{{ template "__alertmanagerURL" . }}{{ end }}
{{ define "slack.default.iconemoji" }}{{ end }}
{{ define "slack.default.iconurl" }}{{ end }}
{{ define "slack.default.text" }}{{ end }}
{{ define "hipchat.default.from" }}{{ template "__alertmanager" . }}{{ end }}
{{ define "hipchat.default.message" }}{{ template "__subject" . }}{{ end }}
{{ define "pagerduty.default.description" }}{{ template "__subject" . }}{{ end }}
{{ define "pagerduty.default.client" }}{{ template "__alertmanager" . }}{{ end }}
{{ define "pagerduty.default.clientURL" }}{{ template "__alertmanagerURL" . }}{{ end }}
{{ define "pagerduty.default.instances" }}{{ template "__text_alert_list" . }}{{ end }}
{{ define "opsgenie.default.message" }}{{ template "__subject" . }}{{ end }}
{{ define "opsgenie.default.description" }}{{ .CommonAnnotations.SortedPairs.Values | join " " }}
{{ if gt (len .Alerts.Firing) 0 -}}
Alerts Firing:
{{ template "__text_alert_list" .Alerts.Firing }}
{{- end }}
{{ if gt (len .Alerts.Resolved) 0 -}}
Alerts Resolved:
{{ template "__text_alert_list" .Alerts.Resolved }}
{{- end }}
{{- end }}
{{ define "opsgenie.default.source" }}{{ template "__alertmanagerURL" . }}{{ end }}
{{ define "victorops.default.message" }}{{ template "__subject" . }} | {{ template "__alertmanagerURL" . }}{{ end }}
{{ define "victorops.default.from" }}{{ template "__alertmanager" . }}{{ end }}
{{ define "email.default.subject" }}{{ template "__subject" . }}{{ end }}
{{ define "email.default.html" }}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Style and HTML derived from https://github.com/mailgun/transactional-email-templates
The MIT License (MIT)
Copyright (c) 2014 Mailgun
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<head style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<meta name="viewport" content="width=device-width" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />
<title style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{ template "__subject" . }}</title>
</head>
<body itemscope="" itemtype="http://schema.org/EmailMessage" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; height: 100%; line-height: 1.6em; width: 100% !important; background-color: #f6f6f6; margin: 0; padding: 0;" bgcolor="#f6f6f6">
<table style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; background-color: #f6f6f6; margin: 0;" bgcolor="#f6f6f6">
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top"></td>
<td width="600" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; display: block !important; max-width: 600px !important; clear: both !important; width: 100% !important; margin: 0 auto; padding: 0;" valign="top">
<div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; max-width: 600px; display: block; margin: 0 auto; padding: 0;">
<table width="100%" cellpadding="0" cellspacing="0" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; border-radius: 3px; background-color: #fff; margin: 0; border: 1px solid #e9e9e9;" bgcolor="#fff">
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; vertical-align: top; color: #fff; font-weight: 500; text-align: center; border-radius: 3px 3px 0 0; background-color: #E6522C; margin: 0; padding: 20px;" align="center" bgcolor="#E6522C" valign="top">
{{ .Alerts | len }} alert{{ if gt (len .Alerts) 1 }}s{{ end }} for {{ range .GroupLabels.SortedPairs }}
{{ .Name }}={{ .Value }}
{{ end }}
</td>
</tr>
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 10px;" valign="top">
<table width="100%" cellpadding="0" cellspacing="0" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
<a href="{{ template "__alertmanagerURL" . }}" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; color: #FFF; text-decoration: none; line-height: 2em; font-weight: bold; text-align: center; cursor: pointer; display: inline-block; border-radius: 5px; text-transform: capitalize; background-color: #348eda; margin: 0; border-color: #348eda; border-style: solid; border-width: 10px 20px;">View in {{ template "__alertmanager" . }}</a>
</td>
</tr>
{{ if gt (len .Alerts.Firing) 0 }}
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
<strong style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">[{{ .Alerts.Firing | len }}] Firing</strong>
</td>
</tr>
{{ end }}
{{ range .Alerts.Firing }}
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
<strong style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">Labels</strong><br style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />
{{ range .Labels.SortedPairs }}{{ .Name }} = {{ .Value }}<br style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />{{ end }}
{{ if gt (len .Annotations) 0 }}<strong style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">Annotations</strong><br style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />{{ end }}
{{ range .Annotations.SortedPairs }}{{ .Name }} = {{ .Value }}<br style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />{{ end }}
<a href="{{ .GeneratorURL }}" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; color: #348eda; text-decoration: underline; margin: 0;">Source</a><br style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />
</td>
</tr>
{{ end }}
{{ if gt (len .Alerts.Resolved) 0 }}
{{ if gt (len .Alerts.Firing) 0 }}
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
<br style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />
<hr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />
<br style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />
</td>
</tr>
{{ end }}
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
<strong style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">[{{ .Alerts.Resolved | len }}] Resolved</strong>
</td>
</tr>
{{ end }}
{{ range .Alerts.Resolved }}
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
<strong style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">Labels</strong><br style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />
{{ range .Labels.SortedPairs }}{{ .Name }} = {{ .Value }}<br style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />{{ end }}
{{ if gt (len .Annotations) 0 }}<strong style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">Annotations</strong><br style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />{{ end }}
{{ range .Annotations.SortedPairs }}{{ .Name }} = {{ .Value }}<br style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />{{ end }}
<a href="{{ .GeneratorURL }}" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; color: #348eda; text-decoration: underline; margin: 0;">Source</a><br style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />
</td>
</tr>
{{ end }}
</table>
</td>
</tr>
</table>
<div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
<table width="100%" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; text-align: center; color: #999; margin: 0; padding: 0 0 20px;" align="center" valign="top"><a href="{{ .ExternalURL }}" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;">Sent by {{ template "__alertmanager" . }}</a></td>
</tr>
</table>
</div></div>
</td>
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top"></td>
</tr>
</table>
</body>
</html>
{{ end }}
{{ define "pushover.default.title" }}{{ template "__subject" . }}{{ end }}
{{ define "pushover.default.message" }}{{ .CommonAnnotations.SortedPairs.Values | join " " }}
{{ if gt (len .Alerts.Firing) 0 }}
Alerts Firing:
{{ template "__text_alert_list" .Alerts.Firing }}
{{ end }}
{{ if gt (len .Alerts.Resolved) 0 }}
Alerts Resolved:
{{ template "__text_alert_list" .Alerts.Resolved }}
{{ end }}
{{ end }}
{{ define "pushover.default.url" }}{{ template "__alertmanagerURL" . }}{{ end }}
slack.tmpl: |
{{ define "slack.devops.text" }}
{{range .Alerts}}{{.Annotations.DESCRIPTION}}
{{end}}
{{ end }}

View File

@@ -0,0 +1,19 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: alertmanager-config
namespace: istio-system
data:
config.yml: |-
global:
templates:
- '/etc/alertmanager/*.tmpl'
route:
receiver: discord
group_by: ['alertname', 'priority']
group_wait: 10s
repeat_interval: 30m
receivers:
- name: discord
webhook_configs:
- url: http://alertmanager-discord:9094

View File

@@ -0,0 +1,73 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: alertmanager
namespace: istio-system
spec:
replicas: 1
selector:
matchLabels:
app: alertmanager
template:
metadata:
name: alertmanager
labels:
app: alertmanager
spec:
priorityClassName: monitoring-priority
containers:
- name: alertmanager
image: prom/alertmanager:latest
args:
- "--config.file=/etc/alertmanager/config.yml"
- "--storage.path=/alertmanager"
- "--log.level=debug"
ports:
- name: alertmanager
containerPort: 9093
volumeMounts:
- name: config-volume
mountPath: /etc/alertmanager
- name: templates-volume
mountPath: /etc/alertmanager-templates
- name: alertmanager
mountPath: /alertmanager
volumes:
- name: config-volume
configMap:
name: alertmanager-config
- name: templates-volume
configMap:
name: alertmanager-templates
- name: alertmanager
emptyDir: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: alertmanager-discord
namespace: istio-system
spec:
replicas: 1
selector:
matchLabels:
app: alertmanager-discord
template:
metadata:
name: alertmanager-discord
labels:
app: alertmanager-discord
spec:
priorityClassName: monitoring-priority
containers:
- name: alertmanager-discord
image: gcr.io/prysmaticlabs/alertmanager-discord:latest
ports:
- name: webhook
containerPort: 9094
env:
- name: DISCORD_WEBHOOK
valueFrom:
secretKeyRef:
name: discord-webhook
key: url

View File

@@ -0,0 +1,29 @@
apiVersion: v1
kind: Service
metadata:
name: alertmanager
namespace: istio-system
annotations:
prometheus.io/scrape: 'true'
prometheus.io/path: /
prometheus.io/port: '8080'
spec:
selector:
app: alertmanager
type: ClusterIP
ports:
- port: 9093
targetPort: 9093
---
apiVersion: v1
kind: Service
metadata:
name: alertmanager-discord
namespace: istio-system
spec:
selector:
app: alertmanager-discord
type: ClusterIP
ports:
- port: 9094
targetPort: 9094

View File

@@ -0,0 +1,64 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-alerts
namespace: istio-system
data:
prometheus.rules.yml: |-
groups:
- name: prysm
rules:
- alert: stalled_chain
expr: delta(avg(state_last_slot > scalar(max(state_last_slot) - 100))[10m:30s]) < 50
for: 1m
annotations:
summary: No block slots advanced in 2 minutes
- alert: too_long_since_finality_10
expr: max(state_last_slot / 8) - floor(max(state_last_finalized_epoch)) > 10
for: 1m
annotations:
summary: No finality in 10 epochs
- alert: too_long_since_finality_25
expr: max(state_last_slot / 8) - floor(max(state_last_finalized_epoch)) > 25
for: 1m
annotations:
summary: No finality in 25 epochs
- alert: too_long_since_finality_100
expr: max(state_last_slot / 8) - floor(max(state_last_finalized_epoch)) > 100
for: 1m
annotations:
summary: No finality in 100 epochs
- alert: high_reorg_rate
expr: max(delta(reorg_counter[10m])) > 5
for: 1m
annotations:
summary: Some nodes are seeing more than 5 reorgs in 10 minutes
- alert: high_goroutines
expr: max_over_time(go_goroutines{component="beacon-chain"}[1m]) > 2000
for: 1m
annotations:
summary: Pod {{ $labels.pod_name}} experencing more than 2000 goroutines
description: "{{ $labels.pod_name }} has {{ $value }} goroutines"
- alert: low_disk_space_1gb
expr: kubelet_volume_stats_available_bytes < 1e9
for: 1m
annotations:
summary: Pod has less than 1GB free disk space in their persistent disk.
- alert: balance_too_low
expr: eth_balance < 200
for: 15m
annotations:
summary: ETH1 wallet has less than 200 ETH
description: "{{ $labels.name }} ({{ $labels.address }}) has {{ $value }} ETH"
- alert: high_grpc_beacon_chain_error_rate
expr: sum(rate(istio_requests_total{reporter="destination",destination_service=~"beacon-chain.beacon-chain.svc.cluster.local",response_code!~"5.*"}[5m])) / sum(rate(istio_requests_total{reporter="destination",destination_service=~"beacon-chain.beacon-chain.svc.cluster.local"}[5m])) < 0.99
for: 1m
annotations:
summary: Beacon node global success rate is less than 99%.
description: Success rate = {{ $value }}
- alert: high_grpc_beacon_chain_method_error_rate
expr: sum(rate(grpc_server_handled_total{component="beacon-chain",grpc_code="OK"}[5m])) by (grpc_method) / sum(rate(grpc_server_handled_total{component="beacon-chain"}[5m])) by (grpc_method) < 0.95
for: 1m
annotations:
summary: Beacon chain gRPC method success rate is less than 95%.
description: "{{ $labels.grpc_method }} {{ $value }}"

View File

@@ -0,0 +1,11 @@
apiVersion: v1
data:
url: 3Bh4HrgcSs/QdGDVnvg31lEggQELhDEycmTNAoa5WP7gb7UPd0XC20uPZXftWF37eVX2CF4wWkXn7ge4/E+Ut6Fo3K/nLYQOc5BBGiZQZcgVGnYn5adZ+8SLCXQTTwBaCBhLUmxwB8IQYA9icnJg/ZCgXKjq2pgRnkIEn58Y5kw2lIxlbQ1drFKGha1YCBHCbpJZ+dWHsryGoh7S2d0vDQVBu0AW3L8/cM1O5rIv7OcWkV1QfEY5P4xiAgCtz+uS.yYUhj5ra/rofJcNd.j2DDF/zrMlD0efGqYKhfkg==
kind: Secret
metadata:
name: discord-webhook
namespace: istio-system
type: Opaque
# kubesec:v:3
# kubesec:gcp:projects/prysmaticlabs/locations/global/keyRings/prysmatic-k8s-secrets/cryptoKeys/testkey:CiQAaKPz55imKn09+ay5Fipt8Ejsa0fl9RAiDUwIB8QjWJniNfESSQD23sIsO81pJ6gDAzc7733PGECLQ+ftcvluf41iLs5GUBBHrk6ziqmtDmfiTzc9E2YDuXYwAU4EejVjXoIHMESywm9EvetOEt4=
# kubesec:mac:JaD9nI5ZuJQNiB9L.5gAZrH4oEyQNTUmUHmSjRQ==

View File

@@ -0,0 +1,18 @@
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: jaeger-collector-virtual-service
namespace: istio-system
spec:
hosts:
- jaeger-collector.istio-system.svc.cluster.local
gateways:
- mesh
http:
- match:
- port: 14268
route:
- destination:
host: jaeger-collector.istio-system.svc.cluster.local
port:
number: 14268

39
k8s/x_headers_rule.yaml Normal file
View File

@@ -0,0 +1,39 @@
apiVersion: config.istio.io/v1alpha2
kind: rule
metadata:
name: x-headers
namespace: istio-system
spec:
match: destination.name != "unknown"
responseHeaderOperations:
- name: x-backend
values: [ destination.name ]
operation: APPEND
- name: x-source
values: [ source.workload.name ]
operation: APPEND
---
apiVersion: config.istio.io/v1alpha2
kind: rule
metadata:
name: x-headers-public
namespace: istio-system
spec:
match: source.workload.name == "istio-ingressgateway"
responseHeaderOperations:
- name: x-backend
operation: REMOVE
- name: x-source
operation: REMOVE
- name: x-envoy-upstream-service-time
operation: REMOVE
- name: server
operation: REMOVE
- name: grpc-metadata-x-backend
operation: REMOVE
- name: grpc-metadata-x-source
operation: REMOVE
- name: grpc-metadata-x-envoy-upstream-service-time
operation: REMOVE
- name: grpc-metadata-server
operation: REMOVE

View File

@@ -5,9 +5,11 @@ package ethereum_beacon_p2p_v1
import (
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
proto "github.com/gogo/protobuf/proto"
types "github.com/gogo/protobuf/types"
)
// Reference imports to suppress errors if they are not otherwise used.
@@ -86,11 +88,12 @@ func (Topic) EnumDescriptor() ([]byte, []int) {
}
type Envelope struct {
SpanContext []byte `protobuf:"bytes,1,opt,name=span_context,json=spanContext,proto3" json:"span_context,omitempty"`
Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
SpanContext []byte `protobuf:"bytes,1,opt,name=span_context,json=spanContext,proto3" json:"span_context,omitempty"`
Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
Timestamp *types.Timestamp `protobuf:"bytes,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Envelope) Reset() { *m = Envelope{} }
@@ -140,6 +143,13 @@ func (m *Envelope) GetPayload() []byte {
return nil
}
func (m *Envelope) GetTimestamp() *types.Timestamp {
if m != nil {
return m.Timestamp
}
return nil
}
type BeaconBlockAnnounce struct {
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
SlotNumber uint64 `protobuf:"varint,2,opt,name=slot_number,json=slotNumber,proto3" json:"slot_number,omitempty"`
@@ -872,6 +882,69 @@ func (m *AttestationResponse) GetAttestation() *Attestation {
return nil
}
type FinalizedStateAnnounce struct {
BlockRoot []byte `protobuf:"bytes,1,opt,name=block_root,json=blockRoot,proto3" json:"block_root,omitempty"`
StateRoot []byte `protobuf:"bytes,2,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"`
Slot uint64 `protobuf:"varint,3,opt,name=slot,proto3" json:"slot,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *FinalizedStateAnnounce) Reset() { *m = FinalizedStateAnnounce{} }
func (m *FinalizedStateAnnounce) String() string { return proto.CompactTextString(m) }
func (*FinalizedStateAnnounce) ProtoMessage() {}
func (*FinalizedStateAnnounce) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{15}
}
func (m *FinalizedStateAnnounce) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *FinalizedStateAnnounce) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_FinalizedStateAnnounce.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *FinalizedStateAnnounce) XXX_Merge(src proto.Message) {
xxx_messageInfo_FinalizedStateAnnounce.Merge(m, src)
}
func (m *FinalizedStateAnnounce) XXX_Size() int {
return m.Size()
}
func (m *FinalizedStateAnnounce) XXX_DiscardUnknown() {
xxx_messageInfo_FinalizedStateAnnounce.DiscardUnknown(m)
}
var xxx_messageInfo_FinalizedStateAnnounce proto.InternalMessageInfo
func (m *FinalizedStateAnnounce) GetBlockRoot() []byte {
if m != nil {
return m.BlockRoot
}
return nil
}
func (m *FinalizedStateAnnounce) GetStateRoot() []byte {
if m != nil {
return m.StateRoot
}
return nil
}
func (m *FinalizedStateAnnounce) GetSlot() uint64 {
if m != nil {
return m.Slot
}
return 0
}
type ProposerSlashingAnnounce struct {
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -883,7 +956,7 @@ func (m *ProposerSlashingAnnounce) Reset() { *m = ProposerSlashingAnnoun
func (m *ProposerSlashingAnnounce) String() string { return proto.CompactTextString(m) }
func (*ProposerSlashingAnnounce) ProtoMessage() {}
func (*ProposerSlashingAnnounce) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{15}
return fileDescriptor_a1d590cda035b632, []int{16}
}
func (m *ProposerSlashingAnnounce) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -930,7 +1003,7 @@ func (m *ProposerSlashingRequest) Reset() { *m = ProposerSlashingRequest
func (m *ProposerSlashingRequest) String() string { return proto.CompactTextString(m) }
func (*ProposerSlashingRequest) ProtoMessage() {}
func (*ProposerSlashingRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{16}
return fileDescriptor_a1d590cda035b632, []int{17}
}
func (m *ProposerSlashingRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -978,7 +1051,7 @@ func (m *ProposerSlashingResponse) Reset() { *m = ProposerSlashingRespon
func (m *ProposerSlashingResponse) String() string { return proto.CompactTextString(m) }
func (*ProposerSlashingResponse) ProtoMessage() {}
func (*ProposerSlashingResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{17}
return fileDescriptor_a1d590cda035b632, []int{18}
}
func (m *ProposerSlashingResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1032,7 +1105,7 @@ func (m *AttesterSlashingAnnounce) Reset() { *m = AttesterSlashingAnnoun
func (m *AttesterSlashingAnnounce) String() string { return proto.CompactTextString(m) }
func (*AttesterSlashingAnnounce) ProtoMessage() {}
func (*AttesterSlashingAnnounce) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{18}
return fileDescriptor_a1d590cda035b632, []int{19}
}
func (m *AttesterSlashingAnnounce) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1079,7 +1152,7 @@ func (m *AttesterSlashingRequest) Reset() { *m = AttesterSlashingRequest
func (m *AttesterSlashingRequest) String() string { return proto.CompactTextString(m) }
func (*AttesterSlashingRequest) ProtoMessage() {}
func (*AttesterSlashingRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{19}
return fileDescriptor_a1d590cda035b632, []int{20}
}
func (m *AttesterSlashingRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1127,7 +1200,7 @@ func (m *AttesterSlashingResponse) Reset() { *m = AttesterSlashingRespon
func (m *AttesterSlashingResponse) String() string { return proto.CompactTextString(m) }
func (*AttesterSlashingResponse) ProtoMessage() {}
func (*AttesterSlashingResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{20}
return fileDescriptor_a1d590cda035b632, []int{21}
}
func (m *AttesterSlashingResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1181,7 +1254,7 @@ func (m *DepositAnnounce) Reset() { *m = DepositAnnounce{} }
func (m *DepositAnnounce) String() string { return proto.CompactTextString(m) }
func (*DepositAnnounce) ProtoMessage() {}
func (*DepositAnnounce) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{21}
return fileDescriptor_a1d590cda035b632, []int{22}
}
func (m *DepositAnnounce) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1228,7 +1301,7 @@ func (m *DepositRequest) Reset() { *m = DepositRequest{} }
func (m *DepositRequest) String() string { return proto.CompactTextString(m) }
func (*DepositRequest) ProtoMessage() {}
func (*DepositRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{22}
return fileDescriptor_a1d590cda035b632, []int{23}
}
func (m *DepositRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1276,7 +1349,7 @@ func (m *DepositResponse) Reset() { *m = DepositResponse{} }
func (m *DepositResponse) String() string { return proto.CompactTextString(m) }
func (*DepositResponse) ProtoMessage() {}
func (*DepositResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{23}
return fileDescriptor_a1d590cda035b632, []int{24}
}
func (m *DepositResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1330,7 +1403,7 @@ func (m *ExitAnnounce) Reset() { *m = ExitAnnounce{} }
func (m *ExitAnnounce) String() string { return proto.CompactTextString(m) }
func (*ExitAnnounce) ProtoMessage() {}
func (*ExitAnnounce) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{24}
return fileDescriptor_a1d590cda035b632, []int{25}
}
func (m *ExitAnnounce) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1377,7 +1450,7 @@ func (m *ExitRequest) Reset() { *m = ExitRequest{} }
func (m *ExitRequest) String() string { return proto.CompactTextString(m) }
func (*ExitRequest) ProtoMessage() {}
func (*ExitRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{25}
return fileDescriptor_a1d590cda035b632, []int{26}
}
func (m *ExitRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1425,7 +1498,7 @@ func (m *ExitResponse) Reset() { *m = ExitResponse{} }
func (m *ExitResponse) String() string { return proto.CompactTextString(m) }
func (*ExitResponse) ProtoMessage() {}
func (*ExitResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{26}
return fileDescriptor_a1d590cda035b632, []int{27}
}
func (m *ExitResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1479,7 +1552,7 @@ func (m *Handshake) Reset() { *m = Handshake{} }
func (m *Handshake) String() string { return proto.CompactTextString(m) }
func (*Handshake) ProtoMessage() {}
func (*Handshake) Descriptor() ([]byte, []int) {
return fileDescriptor_a1d590cda035b632, []int{27}
return fileDescriptor_a1d590cda035b632, []int{28}
}
func (m *Handshake) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1532,6 +1605,7 @@ func init() {
proto.RegisterType((*AttestationAnnounce)(nil), "ethereum.beacon.p2p.v1.AttestationAnnounce")
proto.RegisterType((*AttestationRequest)(nil), "ethereum.beacon.p2p.v1.AttestationRequest")
proto.RegisterType((*AttestationResponse)(nil), "ethereum.beacon.p2p.v1.AttestationResponse")
proto.RegisterType((*FinalizedStateAnnounce)(nil), "ethereum.beacon.p2p.v1.FinalizedStateAnnounce")
proto.RegisterType((*ProposerSlashingAnnounce)(nil), "ethereum.beacon.p2p.v1.ProposerSlashingAnnounce")
proto.RegisterType((*ProposerSlashingRequest)(nil), "ethereum.beacon.p2p.v1.ProposerSlashingRequest")
proto.RegisterType((*ProposerSlashingResponse)(nil), "ethereum.beacon.p2p.v1.ProposerSlashingResponse")
@@ -1550,69 +1624,74 @@ func init() {
func init() { proto.RegisterFile("proto/beacon/p2p/v1/messages.proto", fileDescriptor_a1d590cda035b632) }
var fileDescriptor_a1d590cda035b632 = []byte{
// 980 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x73, 0xdb, 0x54,
0x14, 0x45, 0xf9, 0x68, 0x92, 0x6b, 0xc7, 0x75, 0x5f, 0x42, 0xa2, 0x84, 0xd6, 0x49, 0x54, 0x32,
0x04, 0x66, 0xea, 0xb4, 0xe9, 0x86, 0x2e, 0x18, 0x46, 0x72, 0x34, 0xb8, 0x6d, 0x90, 0x8b, 0x6c,
0xc3, 0xb0, 0x12, 0xcf, 0xd2, 0xa3, 0xf6, 0xd4, 0xd1, 0x13, 0x7a, 0xcf, 0x9e, 0x84, 0x3d, 0xbf,
0x81, 0x1d, 0x3b, 0x56, 0xfc, 0x11, 0x96, 0xfc, 0x04, 0x26, 0xbf, 0x84, 0xd1, 0x7b, 0x4f, 0xb2,
0xfc, 0x11, 0x25, 0x0b, 0x76, 0xd1, 0xbd, 0xe7, 0x9c, 0x7b, 0xcf, 0x89, 0xae, 0xc6, 0x60, 0x44,
0x31, 0xe5, 0xf4, 0xb4, 0x47, 0xb0, 0x4f, 0xc3, 0xd3, 0xe8, 0x2c, 0x3a, 0x1d, 0xbf, 0x38, 0xbd,
0x24, 0x8c, 0xe1, 0xf7, 0x84, 0xd5, 0x45, 0x13, 0xed, 0x10, 0xde, 0x27, 0x31, 0x19, 0x5d, 0xd6,
0x25, 0xac, 0x1e, 0x9d, 0x45, 0xf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, 0x47, 0xf0, 0xe4, 0x16, 0x84, 0x12, 0x79, 0x80, 0x76, 0x00, 0x35, 0x9a, 0xe6,
0x6b, 0xc7, 0x6b, 0xda, 0xe6, 0x79, 0x46, 0x5d, 0x43, 0xbb, 0xb0, 0x35, 0x55, 0x57, 0x84, 0x75,
0x54, 0x83, 0x7d, 0xa5, 0xd5, 0xee, 0x98, 0x1d, 0xdb, 0x6b, 0x9a, 0xed, 0xe6, 0xc4, 0xf3, 0x46,
0xce, 0xb3, 0xec, 0xa7, 0x92, 0x90, 0xb3, 0x92, 0x76, 0x94, 0x68, 0x29, 0x21, 0x99, 0x9d, 0x8e,
0x9d, 0xd4, 0x5f, 0xb7, 0x9c, 0x89, 0x5c, 0x39, 0xd9, 0x23, 0xdf, 0x49, 0xd5, 0x36, 0x67, 0x29,
0x99, 0x58, 0xc5, 0x2a, 0xff, 0x7d, 0x53, 0xd3, 0xfe, 0xb9, 0xa9, 0x69, 0xff, 0xde, 0xd4, 0xb4,
0xde, 0x03, 0xf1, 0xa3, 0xf6, 0xe5, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x87, 0x39, 0xf5,
0x33, 0x0b, 0x00, 0x00,
// 1068 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x72, 0xe3, 0x44,
0x10, 0x46, 0xf9, 0xd9, 0xc4, 0x6d, 0xc7, 0xeb, 0x9d, 0x84, 0xc4, 0x09, 0x9b, 0x3f, 0x2d, 0x29,
0x02, 0x55, 0x6b, 0xef, 0x66, 0x2f, 0xbb, 0x07, 0x8a, 0x92, 0x1c, 0x51, 0xde, 0xdd, 0x20, 0x2f,
0xb2, 0x0d, 0xc5, 0x49, 0x8c, 0xa5, 0xd9, 0xd8, 0xac, 0xa3, 0x11, 0x9a, 0x71, 0x2a, 0xe1, 0xc6,
0x81, 0x67, 0xe0, 0xc6, 0x8d,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e,
0xe5, 0x36, 0x8d, 0x76, 0x73, 0xac, 0xb9, 0x90, 0xd1, 0x2c, 0xf3, 0x09, 0x25, 0x64, 0xa4, 0x24,
0x19, 0x45, 0x5a, 0x8c, 0x8b, 0x8c, 0x4e, 0xc7, 0x8a, 0xe3, 0xaf, 0x5b, 0xf6, 0x98, 0xae, 0x14,
0xcf, 0x91, 0xcd, 0x24, 0x6c, 0x6b, 0xd3, 0x25, 0x29, 0x59, 0xd9, 0x2c, 0xfd, 0x7d, 0xb3, 0xa7,
0xfd, 0x73, 0xb3, 0xa7, 0xfd, 0x7b, 0xb3, 0xa7, 0xf5, 0x1e, 0x88, 0xff, 0xc3, 0x2f, 0xfe, 0x0b,
0x00, 0x00, 0xff, 0xff, 0x3b, 0x46, 0x10, 0x57, 0xfb, 0x0b, 0x00, 0x00,
}
func (m *Envelope) Marshal() (dAtA []byte, err error) {
@@ -1642,6 +1721,16 @@ func (m *Envelope) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintMessages(dAtA, i, uint64(len(m.Payload)))
i += copy(dAtA[i:], m.Payload)
}
if m.Timestamp != nil {
dAtA[i] = 0x1a
i++
i = encodeVarintMessages(dAtA, i, uint64(m.Timestamp.Size()))
n1, err := m.Timestamp.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
@@ -1752,21 +1841,21 @@ func (m *BeaconBlockResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
i = encodeVarintMessages(dAtA, i, uint64(m.Block.Size()))
n1, err := m.Block.MarshalTo(dAtA[i:])
n2, err := m.Block.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
i += n2
}
if m.Attestation != nil {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.Attestation.Size()))
n2, err := m.Attestation.MarshalTo(dAtA[i:])
n3, err := m.Attestation.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
i += n3
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -1994,11 +2083,11 @@ func (m *BeaconStateResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
i = encodeVarintMessages(dAtA, i, uint64(m.FinalizedState.Size()))
n3, err := m.FinalizedState.MarshalTo(dAtA[i:])
n4, err := m.FinalizedState.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n3
i += n4
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -2085,11 +2174,49 @@ func (m *AttestationResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.Attestation.Size()))
n4, err := m.Attestation.MarshalTo(dAtA[i:])
n5, err := m.Attestation.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n4
i += n5
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
}
func (m *FinalizedStateAnnounce) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *FinalizedStateAnnounce) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.BlockRoot) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintMessages(dAtA, i, uint64(len(m.BlockRoot)))
i += copy(dAtA[i:], m.BlockRoot)
}
if len(m.StateRoot) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(len(m.StateRoot)))
i += copy(dAtA[i:], m.StateRoot)
}
if m.Slot != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintMessages(dAtA, i, uint64(m.Slot))
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -2176,11 +2303,11 @@ func (m *ProposerSlashingResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.ProposerSlashing.Size()))
n5, err := m.ProposerSlashing.MarshalTo(dAtA[i:])
n6, err := m.ProposerSlashing.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n5
i += n6
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -2267,11 +2394,11 @@ func (m *AttesterSlashingResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.AttesterSlashing.Size()))
n6, err := m.AttesterSlashing.MarshalTo(dAtA[i:])
n7, err := m.AttesterSlashing.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n6
i += n7
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -2358,11 +2485,11 @@ func (m *DepositResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.Deposit.Size()))
n7, err := m.Deposit.MarshalTo(dAtA[i:])
n8, err := m.Deposit.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n7
i += n8
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -2449,11 +2576,11 @@ func (m *ExitResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.VoluntaryExit.Size()))
n8, err := m.VoluntaryExit.MarshalTo(dAtA[i:])
n9, err := m.VoluntaryExit.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n8
i += n9
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -2511,6 +2638,10 @@ func (m *Envelope) Size() (n int) {
if l > 0 {
n += 1 + l + sovMessages(uint64(l))
}
if m.Timestamp != nil {
l = m.Timestamp.Size()
n += 1 + l + sovMessages(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
@@ -2774,6 +2905,29 @@ func (m *AttestationResponse) Size() (n int) {
return n
}
func (m *FinalizedStateAnnounce) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.BlockRoot)
if l > 0 {
n += 1 + l + sovMessages(uint64(l))
}
l = len(m.StateRoot)
if l > 0 {
n += 1 + l + sovMessages(uint64(l))
}
if m.Slot != 0 {
n += 1 + sovMessages(uint64(m.Slot))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *ProposerSlashingAnnounce) Size() (n int) {
if m == nil {
return 0
@@ -3108,6 +3262,42 @@ func (m *Envelope) Unmarshal(dAtA []byte) error {
m.Payload = []byte{}
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthMessages
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthMessages
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Timestamp == nil {
m.Timestamp = &types.Timestamp{}
}
if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipMessages(dAtA[iNdEx:])
@@ -4604,6 +4794,147 @@ func (m *AttestationResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *FinalizedStateAnnounce) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: FinalizedStateAnnounce: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: FinalizedStateAnnounce: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockRoot", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthMessages
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthMessages
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockRoot = append(m.BlockRoot[:0], dAtA[iNdEx:postIndex]...)
if m.BlockRoot == nil {
m.BlockRoot = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field StateRoot", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthMessages
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthMessages
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.StateRoot = append(m.StateRoot[:0], dAtA[iNdEx:postIndex]...)
if m.StateRoot == nil {
m.StateRoot = []byte{}
}
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Slot", wireType)
}
m.Slot = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Slot |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipMessages(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthMessages
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthMessages
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *ProposerSlashingAnnounce) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0

View File

@@ -3,6 +3,7 @@ syntax = "proto3";
package ethereum.beacon.p2p.v1;
import "proto/beacon/p2p/v1/types.proto";
import "google/protobuf/timestamp.proto";
enum Topic {
UNKNOWN = 0;
@@ -25,6 +26,7 @@ enum Topic {
message Envelope {
bytes span_context = 1;
bytes payload = 2;
google.protobuf.Timestamp timestamp = 3;
}
message BeaconBlockAnnounce {
@@ -91,6 +93,12 @@ message AttestationResponse {
Attestation attestation = 2;
}
message FinalizedStateAnnounce {
bytes block_root = 1;
bytes state_root = 2;
uint64 slot = 3;
}
message ProposerSlashingAnnounce {
bytes hash = 1;
}

View File

@@ -5,10 +5,11 @@ package ethereum_beacon_p2p_v1
import (
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
_ "github.com/prysmaticlabs/prysm/proto/common"
io "io"
math "math"
proto "github.com/gogo/protobuf/proto"
_ "github.com/prysmaticlabs/prysm/proto/common"
)
// Reference imports to suppress errors if they are not otherwise used.

View File

@@ -7,12 +7,13 @@ import (
context "context"
encoding_binary "encoding/binary"
fmt "fmt"
io "io"
math "math"
proto "github.com/gogo/protobuf/proto"
types "github.com/gogo/protobuf/types"
v1 "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
grpc "google.golang.org/grpc"
io "io"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
@@ -378,6 +379,100 @@ func (m *ValidatorActivationResponse_Status) GetStatus() *ValidatorStatusRespons
return nil
}
type ExitedValidatorsRequest struct {
PublicKeys [][]byte `protobuf:"bytes,1,rep,name=public_keys,json=publicKeys,proto3" json:"public_keys,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ExitedValidatorsRequest) Reset() { *m = ExitedValidatorsRequest{} }
func (m *ExitedValidatorsRequest) String() string { return proto.CompactTextString(m) }
func (*ExitedValidatorsRequest) ProtoMessage() {}
func (*ExitedValidatorsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{4}
}
func (m *ExitedValidatorsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ExitedValidatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ExitedValidatorsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *ExitedValidatorsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ExitedValidatorsRequest.Merge(m, src)
}
func (m *ExitedValidatorsRequest) XXX_Size() int {
return m.Size()
}
func (m *ExitedValidatorsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ExitedValidatorsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ExitedValidatorsRequest proto.InternalMessageInfo
func (m *ExitedValidatorsRequest) GetPublicKeys() [][]byte {
if m != nil {
return m.PublicKeys
}
return nil
}
type ExitedValidatorsResponse struct {
PublicKeys [][]byte `protobuf:"bytes,1,rep,name=public_keys,json=publicKeys,proto3" json:"public_keys,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ExitedValidatorsResponse) Reset() { *m = ExitedValidatorsResponse{} }
func (m *ExitedValidatorsResponse) String() string { return proto.CompactTextString(m) }
func (*ExitedValidatorsResponse) ProtoMessage() {}
func (*ExitedValidatorsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{5}
}
func (m *ExitedValidatorsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ExitedValidatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ExitedValidatorsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *ExitedValidatorsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ExitedValidatorsResponse.Merge(m, src)
}
func (m *ExitedValidatorsResponse) XXX_Size() int {
return m.Size()
}
func (m *ExitedValidatorsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ExitedValidatorsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ExitedValidatorsResponse proto.InternalMessageInfo
func (m *ExitedValidatorsResponse) GetPublicKeys() [][]byte {
if m != nil {
return m.PublicKeys
}
return nil
}
type AttestationDataRequest struct {
Shard uint64 `protobuf:"varint,1,opt,name=shard,proto3" json:"shard,omitempty"`
Slot uint64 `protobuf:"varint,2,opt,name=slot,proto3" json:"slot,omitempty"`
@@ -390,7 +485,7 @@ func (m *AttestationDataRequest) Reset() { *m = AttestationDataRequest{}
func (m *AttestationDataRequest) String() string { return proto.CompactTextString(m) }
func (*AttestationDataRequest) ProtoMessage() {}
func (*AttestationDataRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{4}
return fileDescriptor_9eb4e94b85965285, []int{6}
}
func (m *AttestationDataRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -449,7 +544,7 @@ func (m *AttestationDataResponse) Reset() { *m = AttestationDataResponse
func (m *AttestationDataResponse) String() string { return proto.CompactTextString(m) }
func (*AttestationDataResponse) ProtoMessage() {}
func (*AttestationDataResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{5}
return fileDescriptor_9eb4e94b85965285, []int{7}
}
func (m *AttestationDataResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -532,7 +627,7 @@ func (m *PendingAttestationsRequest) Reset() { *m = PendingAttestationsR
func (m *PendingAttestationsRequest) String() string { return proto.CompactTextString(m) }
func (*PendingAttestationsRequest) ProtoMessage() {}
func (*PendingAttestationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{6}
return fileDescriptor_9eb4e94b85965285, []int{8}
}
func (m *PendingAttestationsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -586,7 +681,7 @@ func (m *PendingAttestationsResponse) Reset() { *m = PendingAttestations
func (m *PendingAttestationsResponse) String() string { return proto.CompactTextString(m) }
func (*PendingAttestationsResponse) ProtoMessage() {}
func (*PendingAttestationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{7}
return fileDescriptor_9eb4e94b85965285, []int{9}
}
func (m *PendingAttestationsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -634,7 +729,7 @@ func (m *ChainStartResponse) Reset() { *m = ChainStartResponse{} }
func (m *ChainStartResponse) String() string { return proto.CompactTextString(m) }
func (*ChainStartResponse) ProtoMessage() {}
func (*ChainStartResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{8}
return fileDescriptor_9eb4e94b85965285, []int{10}
}
func (m *ChainStartResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -693,7 +788,7 @@ func (m *ProposeRequest) Reset() { *m = ProposeRequest{} }
func (m *ProposeRequest) String() string { return proto.CompactTextString(m) }
func (*ProposeRequest) ProtoMessage() {}
func (*ProposeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{9}
return fileDescriptor_9eb4e94b85965285, []int{11}
}
func (m *ProposeRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -775,7 +870,7 @@ func (m *ProposeResponse) Reset() { *m = ProposeResponse{} }
func (m *ProposeResponse) String() string { return proto.CompactTextString(m) }
func (*ProposeResponse) ProtoMessage() {}
func (*ProposeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{10}
return fileDescriptor_9eb4e94b85965285, []int{12}
}
func (m *ProposeResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -822,7 +917,7 @@ func (m *ProposerIndexRequest) Reset() { *m = ProposerIndexRequest{} }
func (m *ProposerIndexRequest) String() string { return proto.CompactTextString(m) }
func (*ProposerIndexRequest) ProtoMessage() {}
func (*ProposerIndexRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{11}
return fileDescriptor_9eb4e94b85965285, []int{13}
}
func (m *ProposerIndexRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -869,7 +964,7 @@ func (m *ProposerIndexResponse) Reset() { *m = ProposerIndexResponse{} }
func (m *ProposerIndexResponse) String() string { return proto.CompactTextString(m) }
func (*ProposerIndexResponse) ProtoMessage() {}
func (*ProposerIndexResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{12}
return fileDescriptor_9eb4e94b85965285, []int{14}
}
func (m *ProposerIndexResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -916,7 +1011,7 @@ func (m *StateRootResponse) Reset() { *m = StateRootResponse{} }
func (m *StateRootResponse) String() string { return proto.CompactTextString(m) }
func (*StateRootResponse) ProtoMessage() {}
func (*StateRootResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{13}
return fileDescriptor_9eb4e94b85965285, []int{15}
}
func (m *StateRootResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -963,7 +1058,7 @@ func (m *AttestResponse) Reset() { *m = AttestResponse{} }
func (m *AttestResponse) String() string { return proto.CompactTextString(m) }
func (*AttestResponse) ProtoMessage() {}
func (*AttestResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{14}
return fileDescriptor_9eb4e94b85965285, []int{16}
}
func (m *AttestResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1010,7 +1105,7 @@ func (m *ValidatorIndexRequest) Reset() { *m = ValidatorIndexRequest{} }
func (m *ValidatorIndexRequest) String() string { return proto.CompactTextString(m) }
func (*ValidatorIndexRequest) ProtoMessage() {}
func (*ValidatorIndexRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{15}
return fileDescriptor_9eb4e94b85965285, []int{17}
}
func (m *ValidatorIndexRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1057,7 +1152,7 @@ func (m *ValidatorIndexResponse) Reset() { *m = ValidatorIndexResponse{}
func (m *ValidatorIndexResponse) String() string { return proto.CompactTextString(m) }
func (*ValidatorIndexResponse) ProtoMessage() {}
func (*ValidatorIndexResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{16}
return fileDescriptor_9eb4e94b85965285, []int{18}
}
func (m *ValidatorIndexResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1105,7 +1200,7 @@ func (m *CommitteeAssignmentsRequest) Reset() { *m = CommitteeAssignment
func (m *CommitteeAssignmentsRequest) String() string { return proto.CompactTextString(m) }
func (*CommitteeAssignmentsRequest) ProtoMessage() {}
func (*CommitteeAssignmentsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{17}
return fileDescriptor_9eb4e94b85965285, []int{19}
}
func (m *CommitteeAssignmentsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1159,7 +1254,7 @@ func (m *PendingDepositsResponse) Reset() { *m = PendingDepositsResponse
func (m *PendingDepositsResponse) String() string { return proto.CompactTextString(m) }
func (*PendingDepositsResponse) ProtoMessage() {}
func (*PendingDepositsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{18}
return fileDescriptor_9eb4e94b85965285, []int{20}
}
func (m *PendingDepositsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1206,7 +1301,7 @@ func (m *CommitteeAssignmentResponse) Reset() { *m = CommitteeAssignment
func (m *CommitteeAssignmentResponse) String() string { return proto.CompactTextString(m) }
func (*CommitteeAssignmentResponse) ProtoMessage() {}
func (*CommitteeAssignmentResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{19}
return fileDescriptor_9eb4e94b85965285, []int{21}
}
func (m *CommitteeAssignmentResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1262,7 +1357,7 @@ func (m *CommitteeAssignmentResponse_CommitteeAssignment) String() string {
}
func (*CommitteeAssignmentResponse_CommitteeAssignment) ProtoMessage() {}
func (*CommitteeAssignmentResponse_CommitteeAssignment) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{19, 0}
return fileDescriptor_9eb4e94b85965285, []int{21, 0}
}
func (m *CommitteeAssignmentResponse_CommitteeAssignment) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1348,7 +1443,7 @@ func (m *ValidatorStatusResponse) Reset() { *m = ValidatorStatusResponse
func (m *ValidatorStatusResponse) String() string { return proto.CompactTextString(m) }
func (*ValidatorStatusResponse) ProtoMessage() {}
func (*ValidatorStatusResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{20}
return fileDescriptor_9eb4e94b85965285, []int{22}
}
func (m *ValidatorStatusResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1423,7 +1518,7 @@ func (m *Eth1DataResponse) Reset() { *m = Eth1DataResponse{} }
func (m *Eth1DataResponse) String() string { return proto.CompactTextString(m) }
func (*Eth1DataResponse) ProtoMessage() {}
func (*Eth1DataResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{21}
return fileDescriptor_9eb4e94b85965285, []int{23}
}
func (m *Eth1DataResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1470,7 +1565,7 @@ func (m *DomainRequest) Reset() { *m = DomainRequest{} }
func (m *DomainRequest) String() string { return proto.CompactTextString(m) }
func (*DomainRequest) ProtoMessage() {}
func (*DomainRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{22}
return fileDescriptor_9eb4e94b85965285, []int{24}
}
func (m *DomainRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1517,7 +1612,7 @@ func (m *DomainResponse) Reset() { *m = DomainResponse{} }
func (m *DomainResponse) String() string { return proto.CompactTextString(m) }
func (*DomainResponse) ProtoMessage() {}
func (*DomainResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{23}
return fileDescriptor_9eb4e94b85965285, []int{25}
}
func (m *DomainResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1564,7 +1659,7 @@ func (m *BlockTreeResponse) Reset() { *m = BlockTreeResponse{} }
func (m *BlockTreeResponse) String() string { return proto.CompactTextString(m) }
func (*BlockTreeResponse) ProtoMessage() {}
func (*BlockTreeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{24}
return fileDescriptor_9eb4e94b85965285, []int{26}
}
func (m *BlockTreeResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1603,7 +1698,8 @@ func (m *BlockTreeResponse) GetTree() []*BlockTreeResponse_TreeNode {
type BlockTreeResponse_TreeNode struct {
Block *v1.BeaconBlock `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"`
BlockRoot []byte `protobuf:"bytes,2,opt,name=block_root,json=blockRoot,proto3" json:"block_root,omitempty"`
Votes uint64 `protobuf:"varint,3,opt,name=votes,proto3" json:"votes,omitempty"`
ParticipatedVotes uint64 `protobuf:"varint,3,opt,name=participated_votes,json=participatedVotes,proto3" json:"participated_votes,omitempty"`
TotalVotes uint64 `protobuf:"varint,4,opt,name=total_votes,json=totalVotes,proto3" json:"total_votes,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -1613,7 +1709,7 @@ func (m *BlockTreeResponse_TreeNode) Reset() { *m = BlockTreeResponse_Tr
func (m *BlockTreeResponse_TreeNode) String() string { return proto.CompactTextString(m) }
func (*BlockTreeResponse_TreeNode) ProtoMessage() {}
func (*BlockTreeResponse_TreeNode) Descriptor() ([]byte, []int) {
return fileDescriptor_9eb4e94b85965285, []int{24, 0}
return fileDescriptor_9eb4e94b85965285, []int{26, 0}
}
func (m *BlockTreeResponse_TreeNode) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1656,9 +1752,16 @@ func (m *BlockTreeResponse_TreeNode) GetBlockRoot() []byte {
return nil
}
func (m *BlockTreeResponse_TreeNode) GetVotes() uint64 {
func (m *BlockTreeResponse_TreeNode) GetParticipatedVotes() uint64 {
if m != nil {
return m.Votes
return m.ParticipatedVotes
}
return 0
}
func (m *BlockTreeResponse_TreeNode) GetTotalVotes() uint64 {
if m != nil {
return m.TotalVotes
}
return 0
}
@@ -1671,6 +1774,8 @@ func init() {
proto.RegisterType((*ValidatorActivationRequest)(nil), "ethereum.beacon.rpc.v1.ValidatorActivationRequest")
proto.RegisterType((*ValidatorActivationResponse)(nil), "ethereum.beacon.rpc.v1.ValidatorActivationResponse")
proto.RegisterType((*ValidatorActivationResponse_Status)(nil), "ethereum.beacon.rpc.v1.ValidatorActivationResponse.Status")
proto.RegisterType((*ExitedValidatorsRequest)(nil), "ethereum.beacon.rpc.v1.ExitedValidatorsRequest")
proto.RegisterType((*ExitedValidatorsResponse)(nil), "ethereum.beacon.rpc.v1.ExitedValidatorsResponse")
proto.RegisterType((*AttestationDataRequest)(nil), "ethereum.beacon.rpc.v1.AttestationDataRequest")
proto.RegisterType((*AttestationDataResponse)(nil), "ethereum.beacon.rpc.v1.AttestationDataResponse")
proto.RegisterType((*PendingAttestationsRequest)(nil), "ethereum.beacon.rpc.v1.PendingAttestationsRequest")
@@ -1699,125 +1804,130 @@ func init() {
func init() { proto.RegisterFile("proto/beacon/rpc/v1/services.proto", fileDescriptor_9eb4e94b85965285) }
var fileDescriptor_9eb4e94b85965285 = []byte{
// 1883 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x4b, 0x6f, 0xdb, 0xc8,
0x1d, 0x5f, 0xca, 0xb2, 0xd7, 0xfe, 0x4b, 0xb6, 0xe8, 0xf1, 0x4b, 0x91, 0xf3, 0xf0, 0x72, 0xb1,
0x8d, 0x13, 0x34, 0x72, 0xc2, 0x2c, 0xb2, 0x8f, 0x20, 0x58, 0x48, 0xb6, 0x92, 0xa8, 0x6b, 0x28,
0x0e, 0xa5, 0x4d, 0xfa, 0x02, 0x88, 0x91, 0x34, 0x96, 0xd9, 0x48, 0x1c, 0x86, 0x33, 0x32, 0xd6,
0x3d, 0x6c, 0xd1, 0x63, 0xd1, 0xef, 0xd0, 0x7e, 0x8c, 0x9e, 0x7b, 0xeb, 0xb1, 0xb7, 0xde, 0x8a,
0x22, 0x2d, 0xda, 0x0f, 0xd1, 0x4b, 0x31, 0x0f, 0x52, 0xd4, 0x83, 0xb6, 0xdc, 0x1b, 0xe7, 0xff,
0x9a, 0x99, 0xdf, 0xff, 0x39, 0x04, 0x2b, 0x08, 0x29, 0xa7, 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,
0x7f, 0xfd, 0x78, 0x5b, 0xfb, 0xdb, 0xc7, 0xdb, 0xda, 0x3f, 0x3e, 0xde, 0xd6, 0x3a, 0x0b, 0xa2,
0xd4, 0x3f, 0xfe, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x23, 0x1a, 0x20, 0xe1, 0x6c, 0x17, 0x00,
0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -2414,6 +2524,7 @@ type ValidatorServiceClient interface {
CommitteeAssignment(ctx context.Context, in *CommitteeAssignmentsRequest, opts ...grpc.CallOption) (*CommitteeAssignmentResponse, error)
ValidatorStatus(ctx context.Context, in *ValidatorIndexRequest, opts ...grpc.CallOption) (*ValidatorStatusResponse, error)
ValidatorPerformance(ctx context.Context, in *ValidatorPerformanceRequest, opts ...grpc.CallOption) (*ValidatorPerformanceResponse, error)
ExitedValidators(ctx context.Context, in *ExitedValidatorsRequest, opts ...grpc.CallOption) (*ExitedValidatorsResponse, error)
}
type validatorServiceClient struct {
@@ -2492,6 +2603,15 @@ func (c *validatorServiceClient) ValidatorPerformance(ctx context.Context, in *V
return out, nil
}
func (c *validatorServiceClient) ExitedValidators(ctx context.Context, in *ExitedValidatorsRequest, opts ...grpc.CallOption) (*ExitedValidatorsResponse, error) {
out := new(ExitedValidatorsResponse)
err := c.cc.Invoke(ctx, "/ethereum.beacon.rpc.v1.ValidatorService/ExitedValidators", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ValidatorServiceServer is the server API for ValidatorService service.
type ValidatorServiceServer interface {
WaitForActivation(*ValidatorActivationRequest, ValidatorService_WaitForActivationServer) error
@@ -2499,6 +2619,7 @@ type ValidatorServiceServer interface {
CommitteeAssignment(context.Context, *CommitteeAssignmentsRequest) (*CommitteeAssignmentResponse, error)
ValidatorStatus(context.Context, *ValidatorIndexRequest) (*ValidatorStatusResponse, error)
ValidatorPerformance(context.Context, *ValidatorPerformanceRequest) (*ValidatorPerformanceResponse, error)
ExitedValidators(context.Context, *ExitedValidatorsRequest) (*ExitedValidatorsResponse, error)
}
func RegisterValidatorServiceServer(s *grpc.Server, srv ValidatorServiceServer) {
@@ -2598,6 +2719,24 @@ func _ValidatorService_ValidatorPerformance_Handler(srv interface{}, ctx context
return interceptor(ctx, in, info, handler)
}
func _ValidatorService_ExitedValidators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ExitedValidatorsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ValidatorServiceServer).ExitedValidators(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ethereum.beacon.rpc.v1.ValidatorService/ExitedValidators",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ValidatorServiceServer).ExitedValidators(ctx, req.(*ExitedValidatorsRequest))
}
return interceptor(ctx, in, info, handler)
}
var _ValidatorService_serviceDesc = grpc.ServiceDesc{
ServiceName: "ethereum.beacon.rpc.v1.ValidatorService",
HandlerType: (*ValidatorServiceServer)(nil),
@@ -2618,6 +2757,10 @@ var _ValidatorService_serviceDesc = grpc.ServiceDesc{
MethodName: "ValidatorPerformance",
Handler: _ValidatorService_ValidatorPerformance_Handler,
},
{
MethodName: "ExitedValidators",
Handler: _ValidatorService_ExitedValidators_Handler,
},
},
Streams: []grpc.StreamDesc{
{
@@ -2810,6 +2953,64 @@ func (m *ValidatorActivationResponse_Status) MarshalTo(dAtA []byte) (int, error)
return i, nil
}
func (m *ExitedValidatorsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ExitedValidatorsRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.PublicKeys) > 0 {
for _, b := range m.PublicKeys {
dAtA[i] = 0xa
i++
i = encodeVarintServices(dAtA, i, uint64(len(b)))
i += copy(dAtA[i:], b)
}
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
}
func (m *ExitedValidatorsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ExitedValidatorsResponse) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.PublicKeys) > 0 {
for _, b := range m.PublicKeys {
dAtA[i] = 0xa
i++
i = encodeVarintServices(dAtA, i, uint64(len(b)))
i += copy(dAtA[i:], b)
}
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
}
func (m *AttestationDataRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -3624,10 +3825,15 @@ func (m *BlockTreeResponse_TreeNode) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintServices(dAtA, i, uint64(len(m.BlockRoot)))
i += copy(dAtA[i:], m.BlockRoot)
}
if m.Votes != 0 {
if m.ParticipatedVotes != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintServices(dAtA, i, uint64(m.Votes))
i = encodeVarintServices(dAtA, i, uint64(m.ParticipatedVotes))
}
if m.TotalVotes != 0 {
dAtA[i] = 0x20
i++
i = encodeVarintServices(dAtA, i, uint64(m.TotalVotes))
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -3749,6 +3955,42 @@ func (m *ValidatorActivationResponse_Status) Size() (n int) {
return n
}
func (m *ExitedValidatorsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.PublicKeys) > 0 {
for _, b := range m.PublicKeys {
l = len(b)
n += 1 + l + sovServices(uint64(l))
}
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *ExitedValidatorsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.PublicKeys) > 0 {
for _, b := range m.PublicKeys {
l = len(b)
n += 1 + l + sovServices(uint64(l))
}
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *AttestationDataRequest) Size() (n int) {
if m == nil {
return 0
@@ -4199,8 +4441,11 @@ func (m *BlockTreeResponse_TreeNode) Size() (n int) {
if l > 0 {
n += 1 + l + sovServices(uint64(l))
}
if m.Votes != 0 {
n += 1 + sovServices(uint64(m.Votes))
if m.ParticipatedVotes != 0 {
n += 1 + sovServices(uint64(m.ParticipatedVotes))
}
if m.TotalVotes != 0 {
n += 1 + sovServices(uint64(m.TotalVotes))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
@@ -4780,6 +5025,178 @@ func (m *ValidatorActivationResponse_Status) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *ExitedValidatorsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowServices
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ExitedValidatorsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ExitedValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PublicKeys", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowServices
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthServices
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthServices
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.PublicKeys = append(m.PublicKeys, make([]byte, postIndex-iNdEx))
copy(m.PublicKeys[len(m.PublicKeys)-1], dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipServices(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthServices
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthServices
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *ExitedValidatorsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowServices
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ExitedValidatorsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ExitedValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PublicKeys", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowServices
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthServices
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthServices
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.PublicKeys = append(m.PublicKeys, make([]byte, postIndex-iNdEx))
copy(m.PublicKeys[len(m.PublicKeys)-1], dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipServices(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthServices
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthServices
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *AttestationDataRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -7330,9 +7747,9 @@ func (m *BlockTreeResponse_TreeNode) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field ParticipatedVotes", wireType)
}
m.Votes = 0
m.ParticipatedVotes = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowServices
@@ -7342,7 +7759,26 @@ func (m *BlockTreeResponse_TreeNode) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Votes |= uint64(b&0x7F) << shift
m.ParticipatedVotes |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field TotalVotes", wireType)
}
m.TotalVotes = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowServices
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.TotalVotes |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}

View File

@@ -36,6 +36,7 @@ service ValidatorService {
rpc CommitteeAssignment(CommitteeAssignmentsRequest) returns (CommitteeAssignmentResponse);
rpc ValidatorStatus(ValidatorIndexRequest) returns (ValidatorStatusResponse);
rpc ValidatorPerformance(ValidatorPerformanceRequest) returns (ValidatorPerformanceResponse);
rpc ExitedValidators(ExitedValidatorsRequest) returns (ExitedValidatorsResponse);
}
message ValidatorPerformanceRequest {
@@ -64,6 +65,14 @@ message ValidatorActivationResponse {
repeated Status statuses = 2;
}
message ExitedValidatorsRequest {
repeated bytes public_keys = 1;
}
message ExitedValidatorsResponse {
repeated bytes public_keys = 1;
}
message AttestationDataRequest {
uint64 shard = 1;
uint64 slot = 2;
@@ -181,7 +190,8 @@ message BlockTreeResponse {
message TreeNode {
ethereum.beacon.p2p.v1.BeaconBlock block = 1;
bytes block_root = 2;
uint64 votes = 3;
uint64 participated_votes = 3;
uint64 total_votes = 4;
}
}

View File

@@ -5,9 +5,10 @@ package ethereum_sharding_p2p_v1
import (
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.

View File

@@ -8,7 +8,11 @@ import (
)
// SetBitfield takes an index and returns bitfield with the index flipped.
func SetBitfield(index int, committeeLength int) []byte {
func SetBitfield(index int, committeeLength int) ([]byte, error) {
if index >= committeeLength {
return nil, fmt.Errorf("invalid index, as index %d is more than"+
" or equal to committee length %d", index, committeeLength)
}
chunkLocation := index / 8
indexLocation := mathutil.PowerOf2(uint64(7 - (index % 8)))
var bitfield []byte
@@ -18,11 +22,11 @@ func SetBitfield(index int, committeeLength int) []byte {
}
bitfield = append(bitfield, byte(indexLocation))
for len(bitfield) < committeeLength {
for len(bitfield) < mathutil.CeilDiv8(committeeLength) {
bitfield = append(bitfield, byte(0))
}
return bitfield
return bitfield, nil
}
// CheckBit checks if a bit in a bit field (small endian) is one.

View File

@@ -114,8 +114,12 @@ func TestBitSet(t *testing.T) {
{a: 100, b: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}},
}
for _, tt := range tests {
if !bytes.Equal(SetBitfield(tt.a, mathutil.CeilDiv8(len(tt.b))), tt.b) {
t.Errorf("SetBitfield(%v) = %d, want = %v", tt.a, SetBitfield(tt.a, mathutil.CeilDiv8(len(tt.b))), tt.b)
bField, err := SetBitfield(tt.a, len(tt.b)*8)
if err != nil {
t.Error(err)
}
if !bytes.Equal(bField, tt.b) {
t.Errorf("SetBitfield(%v) = %d, want = %v", tt.a, bField, tt.b)
}
}
}
@@ -126,16 +130,20 @@ func TestSetBitfield_LargerCommitteesThanIndex(t *testing.T) {
b []byte
c int
}{
{a: 300, b: []byte{128}, c: 40}, //10000000
{a: 10000, b: []byte{64}, c: 2000}, //01000000
{a: 800, b: []byte{4}, c: 120}, //00000100
{a: 809, b: []byte{0, 32}, c: 130}, //00000000 00100000
{a: 100, b: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, c: 14},
{a: 0, b: []byte{128}, c: 2}, //10000000
{a: 100, b: []byte{64}, c: 2000}, //01000000
{a: 119, b: []byte{4}, c: 120}, //00000100
{a: 129, b: []byte{0, 32}, c: 130}, //00000000 00100000
{a: 12, b: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, c: 14},
}
for _, tt := range tests {
bfield := SetBitfield(tt.a, tt.c)
bfield, err := SetBitfield(tt.a, tt.c)
if err != nil {
t.Error(err)
continue
}
if len(bfield) != tt.c {
if len(bfield) != mathutil.CeilDiv8(tt.c) {
t.Errorf("Length of bitfield doesnt match the inputted committee size, got: %d but expected: %d", len(bfield), tt.c)
}

View File

@@ -23,6 +23,11 @@ var (
Name: "enable-tracing",
Usage: "Enable request tracing.",
}
// TracingProcessNameFlag defines a flag to specify a process name.
TracingProcessNameFlag = cli.StringFlag{
Name: "tracing-process-name",
Usage: "The name to apply to tracing tag \"process_name\"",
}
// TracingEndpointFlag flag defines the http endpoint for serving traces to Jaeger.
TracingEndpointFlag = cli.StringFlag{
Name: "tracing-endpoint",
@@ -53,6 +58,11 @@ var (
Name: "no-discovery",
Usage: "Enable only local network p2p and do not connect to cloud bootstrap nodes.",
}
// StaticPeers specifies a set of peers to connect to explicitly.
StaticPeers = cli.StringSliceFlag{
Name: "peer",
Usage: "Connect with this peer. This flag may be used multiple times.",
}
// BootstrapNode tells the beacon node which bootstrap node to connect to
BootstrapNode = cli.StringFlag{
Name: "bootstrap-node",
@@ -84,9 +94,33 @@ var (
Usage: "The max number of p2p peers to maintain.",
Value: 30,
}
// P2PWhitelist defines a CIDR subnet to exclusively allow connections.
P2PWhitelist = cli.StringFlag{
Name: "p2p-whitelist",
Usage: "The CIDR subnet for whitelisting peer connections. Example: 192.168.0.0/16 " +
"would whitelist connections to peers on your local network only. The default " +
"is to accept all connections.",
}
// ClearDB tells the beacon node to remove any previously stored data at the data directory.
ClearDB = cli.BoolFlag{
Name: "clear-db",
Usage: "Clears any previously stored data at the data directory",
}
// LogFormat specifies the log output format.
LogFormat = cli.StringFlag{
Name: "log-format",
Usage: "Specify log formatting. Supports: text, json, fluentd.",
Value: "text",
}
// MaxGoroutines specifies the maximum amount of goroutines tolerated, before a status check fails.
MaxGoroutines = cli.Int64Flag{
Name: "max-goroutines",
Usage: "Specifies the upper limit of goroutines running before a status check fails",
Value: 5000,
}
// LogFileName specifies the log output file name.
LogFileName = cli.StringFlag{
Name: "log-file",
Usage: "Specify log file name, relative or absolute",
}
)

View File

@@ -25,15 +25,15 @@ var log = logrus.WithField("prefix", "flags")
// FeatureFlagConfig is a struct to represent what features the client will perform on runtime.
type FeatureFlagConfig struct {
VerifyAttestationSigs bool // VerifyAttestationSigs declares if the client will verify attestations.
EnableComputeStateRoot bool // EnableComputeStateRoot implementation on server side.
EnableCrosslinks bool // EnableCrosslinks in epoch processing.
EnableCheckBlockStateRoot bool // EnableCheckBlockStateRoot in block processing.
EnableCanonicalAttestationFilter bool // EnableCanonicalAttestationFilter for RPC server.
DisableHistoricalStatePruning bool // DisableHistoricalStatePruning when updating finalized states.
DisableGossipSub bool // DisableGossipSub in p2p messaging.
EnableCommitteesCache bool // EnableCommitteesCache for state transition.
CacheTreeHash bool // CacheTreeHash determent whether tree hashes will be cached.
VerifyAttestationSigs bool // VerifyAttestationSigs declares if the client will verify attestations.
EnableComputeStateRoot bool // EnableComputeStateRoot implementation on server side.
EnableCrosslinks bool // EnableCrosslinks in epoch processing.
EnableCheckBlockStateRoot bool // EnableCheckBlockStateRoot in block processing.
DisableHistoricalStatePruning bool // DisableHistoricalStatePruning when updating finalized states.
DisableGossipSub bool // DisableGossipSub in p2p messaging.
EnableCommitteesCache bool // EnableCommitteesCache for state transition.
CacheTreeHash bool // CacheTreeHash determent whether tree hashes will be cached.
EnableExcessDeposits bool // EnableExcessDeposits in validator balances.
}
var featureConfig *FeatureFlagConfig
@@ -83,9 +83,9 @@ func ConfigureBeaconFeatures(ctx *cli.Context) {
log.Info("Disabled gossipsub, using floodsub")
cfg.DisableGossipSub = true
}
if ctx.GlobalBool(EnableCanonicalAttestationFilter.Name) {
log.Info("Enabled canonical attestation filter")
cfg.EnableCanonicalAttestationFilter = true
if ctx.GlobalBool(EnableExcessDepositsFlag.Name) {
log.Info("Enabled excess deposits")
cfg.EnableExcessDeposits = true
}
InitFeatureConfig(cfg)
}

View File

@@ -50,6 +50,12 @@ var (
Name: "disable-gossip-sub",
Usage: "Disable gossip sub messaging and use floodsub messaging",
}
// EnableExcessDepositsFlag enables a validator to have total amount deposited as more than the
// max deposit amount.
EnableExcessDepositsFlag = cli.BoolFlag{
Name: "enables-excess-deposit",
Usage: "Enables balances more than max deposit amount for a validator",
}
)
// ValidatorFlags contains a list of all the feature flags that apply to the validator client.
@@ -66,4 +72,5 @@ var BeaconChainFlags = []cli.Flag{
DisableHistoricalStatePruningFlag,
DisableGossipSubFlag,
CacheTreeHashFlag,
EnableExcessDepositsFlag,
}

View File

@@ -0,0 +1,9 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["logutil.go"],
importpath = "github.com/prysmaticlabs/prysm/shared/logutil",
visibility = ["//visibility:public"],
deps = ["@com_github_sirupsen_logrus//:go_default_library"],
)

25
shared/logutil/logutil.go Normal file
View File

@@ -0,0 +1,25 @@
// Package logutil creates a Multi writer instance that
// write all logs that are written to stdout.
package logutil
import (
"io"
"os"
"github.com/sirupsen/logrus"
)
// ConfigurePersistentLogging adds a log-to-file writer. File content is identical to stdout.
func ConfigurePersistentLogging(logFileName string) error {
logrus.WithField("logFileName", logFileName).Info("Logs will be made persistent")
f, err := os.OpenFile(logFileName, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
return err
}
mw := io.MultiWriter(os.Stdout, f)
logrus.SetOutput(mw)
logrus.Info("File logging initialized")
return nil
}

View File

@@ -26,6 +26,7 @@ go_library(
"//shared/iputils:go_default_library",
"@com_github_gogo_protobuf//io:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
"@com_github_ipfs_go_datastore//:go_default_library",
"@com_github_ipfs_go_datastore//sync:go_default_library",
"@com_github_ipfs_go_ipfs_addr//:go_default_library",
@@ -42,8 +43,10 @@ go_library(
"@com_github_libp2p_go_libp2p_peerstore//:go_default_library",
"@com_github_libp2p_go_libp2p_protocol//:go_default_library",
"@com_github_libp2p_go_libp2p_pubsub//:go_default_library",
"@com_github_libp2p_go_maddr_filter//:go_default_library",
"@com_github_multiformats_go_multiaddr//:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@io_opencensus_go//trace:go_default_library",
"@io_opencensus_go//trace/propagation:go_default_library",
@@ -54,6 +57,7 @@ go_test(
name = "go_default_test",
srcs = [
"addr_factory_test.go",
"connection_manager_test.go",
"dial_relay_node_test.go",
"feed_example_test.go",
"feed_test.go",
@@ -76,13 +80,16 @@ go_test(
"@com_github_gogo_protobuf//io:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",
"@com_github_libp2p_go_libp2p//:go_default_library",
"@com_github_libp2p_go_libp2p_blankhost//:go_default_library",
"@com_github_libp2p_go_libp2p_host//:go_default_library",
"@com_github_libp2p_go_libp2p_net//:go_default_library",
"@com_github_libp2p_go_libp2p_peer//:go_default_library",
"@com_github_libp2p_go_libp2p_peerstore//:go_default_library",
"@com_github_libp2p_go_libp2p_protocol//:go_default_library",
"@com_github_libp2p_go_libp2p_pubsub//:go_default_library",
"@com_github_libp2p_go_libp2p_swarm//testing:go_default_library",
"@com_github_libp2p_go_testutil//:go_default_library",
"@com_github_multiformats_go_multiaddr//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_sirupsen_logrus//hooks/test:go_default_library",

View File

@@ -34,6 +34,10 @@ func optionConnectionManager(maxPeers int) libp2p.Option {
// Reputation adds (or subtracts) a given reward/penalty against a peer.
// Eventually, the lowest scoring peers will be pruned from the connections.
func (s *Server) Reputation(peer peer.ID, val int) {
ti := s.host.ConnManager().GetTagInfo(peer)
if ti != nil {
val += ti.Value
}
s.host.ConnManager().TagPeer(peer, TagReputation, val)
}

View File

@@ -0,0 +1,73 @@
package p2p
import (
"context"
"testing"
libp2p "github.com/libp2p/go-libp2p"
host "github.com/libp2p/go-libp2p-host"
inet "github.com/libp2p/go-libp2p-net"
peer "github.com/libp2p/go-libp2p-peer"
tu "github.com/libp2p/go-testutil"
ma "github.com/multiformats/go-multiaddr"
)
func hostWithConnMgr(t *testing.T) host.Host {
h, err := libp2p.New(context.Background(), optionConnectionManager(5))
if err != nil {
t.Fatal(err)
}
return h
}
// Test libp2p connection for connection manager
type tconn struct {
inet.Conn
pid peer.ID
}
func (t *tconn) RemotePeer() peer.ID {
return t.pid
}
func (*tconn) RemoteMultiaddr() ma.Multiaddr {
addr, err := ma.NewMultiaddr("/ip4/127.0.0.1/udp/1234")
if err != nil {
panic("cannot create multiaddr")
}
return addr
}
func TestReputation(t *testing.T) {
h := hostWithConnMgr(t)
s := &Server{
host: h,
}
pid := tu.RandPeerIDFatal(t)
h.ConnManager().Notifee().Connected(h.Network(), &tconn{pid: pid})
s.Reputation(pid, 5)
if h.ConnManager().GetTagInfo(pid).Value != 5 {
t.Fatal("Expected value 5")
}
s.Reputation(pid, -10)
if h.ConnManager().GetTagInfo(pid).Value != -5 {
t.Fatal("Expected value -5")
}
s.Reputation(pid, -10)
if h.ConnManager().GetTagInfo(pid).Value != -15 {
t.Fatal("Expected value -15")
}
s.Reputation(pid, 100)
if h.ConnManager().GetTagInfo(pid).Value != 85 {
t.Fatal("Expected value 85")
}
}

View File

@@ -6,19 +6,21 @@ import (
host "github.com/libp2p/go-libp2p-host"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
peerCountMetric = prometheus.NewGauge(prometheus.GaugeOpts{
peerCountMetric = promauto.NewGauge(prometheus.GaugeOpts{
Name: "p2p_peer_count",
Help: "The number of currently connected peers",
})
propagationTimeMetric = promauto.NewHistogram(prometheus.HistogramOpts{
Name: "p2p_propagation_time_sec",
Help: "The time between message sent/received from peer",
Buckets: append(prometheus.DefBuckets, []float64{20, 30, 60, 90}...),
})
)
func init() {
prometheus.MustRegister(peerCountMetric)
}
// starPeerWatcher updates the peer count metric and calls to reconnect any VIP
// peers such as the bootnode peer or relay node peer.
func startPeerWatcher(ctx context.Context, h host.Host, reconnectPeers ...string) {

View File

@@ -2,8 +2,10 @@ package p2p
import (
"fmt"
"net"
"github.com/libp2p/go-libp2p"
filter "github.com/libp2p/go-maddr-filter"
ma "github.com/multiformats/go-multiaddr"
"github.com/prysmaticlabs/prysm/shared/iputils"
@@ -13,13 +15,13 @@ import (
// TODO(287): Expand on these options and provide the option configuration via flags.
// Currently, this is a random port and a (seemingly) consistent private key
// identity.
func buildOptions(port, maxPeers int) []libp2p.Option {
func buildOptions(cfg *ServerConfig) []libp2p.Option {
ip, err := iputils.ExternalIPv4()
if err != nil {
log.Errorf("Could not get IPv4 address: %v", err)
}
listen, err := ma.NewMultiaddr(fmt.Sprintf("/ip4/%s/tcp/%d", ip, port))
listen, err := ma.NewMultiaddr(fmt.Sprintf("/ip4/%s/tcp/%d", ip, cfg.Port))
if err != nil {
log.Errorf("Failed to p2p listen: %v", err)
}
@@ -27,6 +29,32 @@ func buildOptions(port, maxPeers int) []libp2p.Option {
return []libp2p.Option{
libp2p.ListenAddrs(listen),
libp2p.EnableRelay(), // Allows dialing to peers via relay.
optionConnectionManager(maxPeers),
optionConnectionManager(cfg.MaxPeers),
whitelistSubnet(cfg.WhitelistCIDR),
}
}
// whitelistSubnet adds a whitelist multiaddress filter for a given CIDR subnet.
// Example: 192.168.0.0/16 may be used to accept only connections on your local
// network.
func whitelistSubnet(cidr string) libp2p.Option {
if cidr == "" {
return func(_ *libp2p.Config) error {
return nil
}
}
return func(cfg *libp2p.Config) error {
_, ipnet, err := net.ParseCIDR(cidr)
if err != nil {
return err
}
if cfg.Filters == nil {
cfg.Filters = filter.NewFilters()
}
cfg.Filters.AddFilter(*ipnet, filter.ActionAccept)
return nil
}
}

View File

@@ -5,7 +5,7 @@ import (
)
func TestBuildOptions(t *testing.T) {
opts := buildOptions(1, 10)
opts := buildOptions(&ServerConfig{})
_ = opts
}

View File

@@ -12,6 +12,7 @@ import (
ggio "github.com/gogo/protobuf/io"
"github.com/gogo/protobuf/proto"
"github.com/gogo/protobuf/types"
ds "github.com/ipfs/go-datastore"
dsync "github.com/ipfs/go-datastore/sync"
"github.com/libp2p/go-libp2p"
@@ -58,23 +59,26 @@ type Server struct {
bootstrapNode string
relayNodeAddr string
noDiscovery bool
staticPeers []string
}
// ServerConfig for peer to peer networking.
type ServerConfig struct {
NoDiscovery bool
StaticPeers []string
BootstrapNodeAddr string
RelayNodeAddr string
HostAddress string
Port int
MaxPeers int
DepositContractAddress string
WhitelistCIDR string
}
// NewServer creates a new p2p server instance.
func NewServer(cfg *ServerConfig) (*Server, error) {
ctx, cancel := context.WithCancel(context.Background())
opts := buildOptions(cfg.Port, cfg.MaxPeers)
opts := buildOptions(cfg)
if cfg.RelayNodeAddr != "" {
opts = append(opts, libp2p.AddrsFactory(withRelayAddrs(cfg.RelayNodeAddr)))
} else if cfg.HostAddress != "" {
@@ -138,6 +142,7 @@ func NewServer(cfg *ServerConfig) (*Server, error) {
}
info, err := peerInfoFromAddr(addr)
if err != nil {
cancel()
return nil, err
}
exclusions = append(exclusions, info.ID)
@@ -158,6 +163,7 @@ func NewServer(cfg *ServerConfig) (*Server, error) {
bootstrapNode: cfg.BootstrapNodeAddr,
relayNodeAddr: cfg.RelayNodeAddr,
noDiscovery: cfg.NoDiscovery,
staticPeers: cfg.StaticPeers,
}, nil
}
@@ -185,30 +191,40 @@ func (s *Server) Start() {
defer span.End()
log.Info("Starting service")
if !s.noDiscovery && s.bootstrapNode != "" {
if err := startDHTDiscovery(ctx, s.host, s.bootstrapNode); err != nil {
log.Errorf("Could not start peer discovery via DHT: %v", err)
}
bcfg := kaddht.DefaultBootstrapConfig
bcfg.Period = time.Duration(30 * time.Second)
if err := s.dht.BootstrapWithConfig(ctx, bcfg); err != nil {
log.Errorf("Failed to bootstrap DHT: %v", err)
}
}
if !s.noDiscovery && s.relayNodeAddr != "" {
if err := dialRelayNode(ctx, s.host, s.relayNodeAddr); err != nil {
log.Errorf("Could not dial relay node: %v", err)
}
}
if err := startmDNSDiscovery(ctx, s.host); err != nil {
log.Errorf("Could not start peer discovery via mDNS: %v", err)
return
}
if !s.noDiscovery {
if s.bootstrapNode != "" {
if err := startDHTDiscovery(ctx, s.host, s.bootstrapNode); err != nil {
log.Errorf("Could not start peer discovery via DHT: %v", err)
}
bcfg := kaddht.DefaultBootstrapConfig
bcfg.Period = time.Duration(30 * time.Second)
if err := s.dht.BootstrapWithConfig(ctx, bcfg); err != nil {
log.Errorf("Failed to bootstrap DHT: %v", err)
}
}
if s.relayNodeAddr != "" {
if err := dialRelayNode(ctx, s.host, s.relayNodeAddr); err != nil {
log.Errorf("Could not dial relay node: %v", err)
}
}
if err := startmDNSDiscovery(ctx, s.host); err != nil {
log.Errorf("Could not start peer discovery via mDNS: %v", err)
}
startPeerWatcher(ctx, s.host, s.bootstrapNode, s.relayNodeAddr)
}
maxTime := time.Duration(1 << 62)
for _, peer := range s.staticPeers {
peerInfo, err := peerInfoFromAddr(peer)
if err != nil {
log.Errorf("Invalid peer address: %v", err)
} else {
s.host.Peerstore().AddAddrs(peerInfo.ID, peerInfo.Addrs, maxTime)
}
}
}
// Stop the main p2p loop.
@@ -274,6 +290,18 @@ func (s *Server) RegisterTopic(topic string, message proto.Message, adapters ...
trace.StringAttribute("peerID", peerID.String()),
)
if msg.Timestamp != nil && msg.Timestamp.Seconds > 0 {
t, err := types.TimestampFromProto(msg.Timestamp)
if err == nil {
propagationTimeMetric.Observe(time.Now().Sub(t).Seconds())
span.AddAttributes(
trace.StringAttribute("timestamp", t.String()),
)
} else {
log.WithError(err).Debug("Message received without timestamp")
}
}
data := proto.Clone(message)
if err := proto.Unmarshal(msg.Payload, data); err != nil {
log.Error("Could not unmarshal payload")
@@ -423,6 +451,7 @@ func (s *Server) Send(ctx context.Context, msg proto.Message, peerID peer.ID) er
envelope := &pb.Envelope{
SpanContext: propagation.Binary(span.SpanContext()),
Payload: b,
Timestamp: types.TimestampNow(),
}
return w.WriteMsg(envelope)
@@ -485,6 +514,7 @@ func (s *Server) Broadcast(ctx context.Context, msg proto.Message) {
envelope := &pb.Envelope{
SpanContext: propagation.Binary(span.SpanContext()),
Payload: b,
Timestamp: types.TimestampNow(),
}
data, err := proto.Marshal(envelope)

View File

@@ -6,6 +6,7 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/shared/tracing",
visibility = ["//visibility:public"],
deps = [
"//shared/version:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@io_opencensus_go//trace:go_default_library",
"@io_opencensus_go_contrib_exporter_jaeger//:go_default_library",

View File

@@ -4,6 +4,7 @@ import (
"errors"
"contrib.go.opencensus.io/exporter/jaeger"
"github.com/prysmaticlabs/prysm/shared/version"
"github.com/sirupsen/logrus"
"go.opencensus.io/trace"
)
@@ -11,23 +12,34 @@ import (
var log = logrus.WithField("prefix", "tracing")
// Setup creates and initializes a new tracing configuration..
func Setup(name, endpoint string, sampleFraction float64, enable bool) error {
func Setup(serviceName, processName, endpoint string, sampleFraction float64, enable bool) error {
if !enable {
trace.ApplyConfig(trace.Config{DefaultSampler: trace.NeverSample()})
return nil
}
if name == "" {
if serviceName == "" {
return errors.New("tracing service name cannot be empty")
}
trace.ApplyConfig(trace.Config{DefaultSampler: trace.ProbabilitySampler(sampleFraction)})
trace.ApplyConfig(trace.Config{
DefaultSampler: trace.ProbabilitySampler(sampleFraction),
MaxMessageEventsPerSpan: 500,
})
log.Infof("Starting Jaeger exporter endpoint at address = %s", endpoint)
exporter, err := jaeger.NewExporter(jaeger.Options{
Endpoint: endpoint,
CollectorEndpoint: endpoint,
Process: jaeger.Process{
ServiceName: name,
ServiceName: serviceName,
Tags: []jaeger.Tag{
jaeger.StringTag("process_name", processName),
jaeger.StringTag("version", version.GetVersion()),
},
},
BufferMaxCount: 256 * 1e6, // 256Mb
OnError: func(err error) {
log.WithError(err).Error("Failed to process span")
},
})
if err != nil {

View File

@@ -7,6 +7,7 @@ go_library(
srcs = [
"allocations.go",
"db.go",
"keyChecker.go",
"logger.go",
"main.go",
"server.go",
@@ -16,8 +17,10 @@ go_library(
visibility = ["//visibility:private"],
deps = [
"//contracts/deposit-contract:go_default_library",
"//proto/beacon/rpc/v1:go_default_library",
"//proto/cluster:go_default_library",
"//shared/bls:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/keystore:go_default_library",
"//shared/prometheus:go_default_library",
"@com_github_boltdb_bolt//:go_default_library",
@@ -34,6 +37,7 @@ go_library(
"@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library",
"@io_k8s_client_go//kubernetes:go_default_library",
"@io_k8s_client_go//rest:go_default_library",
"@io_opencensus_go//plugin/ocgrpc:go_default_library",
"@org_golang_google_grpc//:go_default_library",
],
)
@@ -56,27 +60,36 @@ go_image(
srcs = [
"allocations.go",
"db.go",
"keyChecker.go",
"logger.go",
"main.go",
"server.go",
"watchtower.go",
],
goarch = "amd64",
goos = "linux",
importpath = "github.com/prysmaticlabs/prysm/tools/cluster-pk-manager/server",
pure = "off", # depends on cgo for go-ethereum crypto
race = "off",
static = "off",
tags = ["manual"],
visibility = ["//visibility:private"],
deps = [
"//contracts/deposit-contract:go_default_library",
"//proto/beacon/rpc/v1:go_default_library",
"//proto/cluster:go_default_library",
"//shared/bls:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/keystore:go_default_library",
"//shared/prometheus:go_default_library",
"//shared/ssz:go_default_library",
"@com_github_boltdb_bolt//:go_default_library",
"@com_github_ethereum_go_ethereum//accounts/abi/bind:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_ethereum_go_ethereum//crypto:go_default_library",
"@com_github_ethereum_go_ethereum//ethclient:go_default_library",
"@com_github_ethereum_go_ethereum//rpc:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
@@ -84,14 +97,9 @@ go_image(
"@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library",
"@io_k8s_client_go//kubernetes:go_default_library",
"@io_k8s_client_go//rest:go_default_library",
"@io_opencensus_go//plugin/ocgrpc:go_default_library",
"@org_golang_google_grpc//:go_default_library",
],
pure = "off", # depends on cgo for go-ethereum crypto
static = "off",
tags = ["manual"],
goarch = "amd64",
goos = "linux",
race = "off",
)
container_push(

View File

@@ -3,6 +3,7 @@ package main
import (
"bytes"
"context"
"errors"
"path"
"time"
@@ -12,11 +13,12 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto"
pb "github.com/prysmaticlabs/prysm/proto/cluster"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/keystore"
)
var (
allocatedPkCount = promauto.NewCounter(prometheus.CounterOpts{
allocatedPkCount = promauto.NewGauge(prometheus.GaugeOpts{
Name: "allocated_pk_count",
Help: "The number of allocated private keys",
})
@@ -24,15 +26,26 @@ var (
Name: "assigned_pk_count",
Help: "The number of private keys currently assigned to alive pods",
})
blacklistedPKCount = promauto.NewGauge(prometheus.GaugeOpts{
Name: "blacklisted_pk_count",
Help: "The number of private keys which have been removed that are of exited validators",
})
)
var (
dbFileName = "pk.db"
assignedPkBucket = []byte("assigned_pks")
unassignedPkBucket = []byte("unassigned_pks")
deletedKeysBucket = []byte("deleted_pks")
dummyVal = []byte{1}
)
type keyMap struct {
podName string
privateKey []byte
index int
}
type db struct {
db *bolt.DB
}
@@ -46,7 +59,7 @@ func newDB(dbPath string) *db {
// Initialize buckets
if err := boltdb.Update(func(tx *bolt.Tx) error {
for _, bkt := range [][]byte{assignedPkBucket, unassignedPkBucket} {
for _, bkt := range [][]byte{assignedPkBucket, unassignedPkBucket, deletedKeysBucket} {
if _, err := tx.CreateBucketIfNotExists(bkt); err != nil {
return err
}
@@ -56,7 +69,11 @@ func newDB(dbPath string) *db {
panic(err)
}
// Populate metrics on start.
if err := boltdb.View(func(tx *bolt.Tx) error {
// Populate blacklisted key count.
blacklistedPKCount.Set(float64(tx.Bucket(deletedKeysBucket).Stats().KeyN))
keys := 0
// Iterate over all of the pod assigned keys (one to many).
@@ -64,7 +81,8 @@ func newDB(dbPath string) *db {
for k, v := c.First(); k != nil; k, v = c.Next() {
pks := &pb.PrivateKeys{}
if err := proto.Unmarshal(v, pks); err != nil {
return err
log.WithError(err).Error("Unable to unmarshal private key")
continue
}
keys += len(pks.PrivateKeys)
}
@@ -138,10 +156,13 @@ func (d *db) RemovePKAssignment(_ context.Context, podName string) error {
log.WithField("podName", podName).Warn("Nil private key returned from db")
return nil
}
pks := &pb.PrivateKeys{}
if err := proto.Unmarshal(data, pks); err != nil {
return err
log.WithError(err).Error("Failed to unmarshal pks, deleting from db")
return tx.Bucket(assignedPkBucket).Delete([]byte(podName))
}
if err := tx.Bucket(assignedPkBucket).Delete([]byte(podName)); err != nil {
return err
}
@@ -226,3 +247,78 @@ func (d *db) Allocations() (map[string][][]byte, error) {
return m, nil
}
func (d *db) KeyMap() ([][]byte, map[[48]byte]keyMap, error) {
m := make(map[[48]byte]keyMap)
pubkeys := make([][]byte, 0)
if err := d.db.View(func(tx *bolt.Tx) error {
return tx.Bucket(assignedPkBucket).ForEach(func(k, v []byte) error {
pks := &pb.PrivateKeys{}
if err := proto.Unmarshal(v, pks); err != nil {
return err
}
for i, pk := range pks.PrivateKeys {
seckey, err := bls.SecretKeyFromBytes(pk)
if err != nil {
return err
}
keytoSet := bytesutil.ToBytes48(seckey.PublicKey().Marshal())
m[keytoSet] = keyMap{
podName: string(k),
privateKey: pk,
index: i,
}
pubkeys = append(pubkeys, seckey.PublicKey().Marshal())
}
return nil
})
}); err != nil {
// do something
return nil, nil, err
}
return pubkeys, m, nil
}
// RemovePKFromPod and throw it away.
func (d *db) RemovePKFromPod(podName string, key []byte) error {
return d.db.Update(func(tx *bolt.Tx) error {
data := tx.Bucket(assignedPkBucket).Get([]byte(podName))
if data == nil {
log.WithField("podName", podName).Warn("Nil private key returned from db")
return nil
}
pks := &pb.PrivateKeys{}
if err := proto.Unmarshal(data, pks); err != nil {
log.WithError(err).Error("Unable to unmarshal private keys, deleting assignment from db")
return tx.Bucket(assignedPkBucket).Delete([]byte(podName))
}
found := false
for i, k := range pks.PrivateKeys {
if bytes.Equal(k, key) {
found = true
pks.PrivateKeys = append(pks.PrivateKeys[:i], pks.PrivateKeys[i+1:]...)
break
}
}
if !found {
return errors.New("private key not assigned to pod")
}
marshaled, err := proto.Marshal(pks)
if err != nil {
return err
}
blacklistedPKCount.Inc()
allocatedPkCount.Dec()
assignedPkCount.Dec()
nowBytes, err := time.Now().MarshalBinary()
if err != nil {
return err
}
if err := tx.Bucket(deletedKeysBucket).Put(key, nowBytes); err != nil {
return err
}
return tx.Bucket(assignedPkBucket).Put([]byte(podName), marshaled)
})
}

View File

@@ -0,0 +1,78 @@
package main
import (
"context"
"fmt"
"time"
pbBeacon "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"go.opencensus.io/plugin/ocgrpc"
"google.golang.org/grpc"
)
var keyInterval = 3 * time.Minute
type keyChecker struct {
db *db
client pbBeacon.ValidatorServiceClient
}
func newkeyChecker(db *db, beaconRPCAddr string) *keyChecker {
// connect to the beacon node
dialOpt := grpc.WithInsecure()
conn, err := grpc.DialContext(context.Background(), beaconRPCAddr, dialOpt, grpc.WithStatsHandler(&ocgrpc.ClientHandler{}))
if err != nil {
log.Errorf("Could not dial endpoint: %s, %v", beaconRPCAddr, err)
}
valClient := pbBeacon.NewValidatorServiceClient(conn)
return &keyChecker{
db: db,
client: valClient,
}
}
func (k *keyChecker) checkKeys() error {
pubkeys, keyMap, err := k.db.KeyMap()
if err != nil {
return err
}
log.Debug("Requesting EXITED keys")
req := &pbBeacon.ExitedValidatorsRequest{
PublicKeys: pubkeys,
}
ctx, cancel := context.WithTimeout(context.Background(), keyInterval)
defer cancel()
resp, err := k.client.ExitedValidators(ctx, req)
if err != nil {
return err
}
log.WithField(
"resp_keys", len(resp.PublicKeys),
).WithField(
"req_keys", len(req.PublicKeys),
).Debug("Received EXITED key list")
for _, key := range resp.PublicKeys {
log.WithField("key", fmt.Sprintf("%#x", key)).Debug("Removing EXITED key")
kMap := keyMap[bytesutil.ToBytes48(key)]
if err := k.db.RemovePKFromPod(kMap.podName, kMap.privateKey); err != nil {
return err
}
}
return nil
}
func (k *keyChecker) run() {
for {
if err := k.checkKeys(); err != nil {
log.WithError(err).Error("Failed to check keys")
}
time.Sleep(keyInterval)
}
}

View File

@@ -16,6 +16,7 @@ var (
metricsPort = flag.Int("metrics-port", 9090, "The port to serve /metrics")
privateKey = flag.String("private-key", "", "The private key of funder")
rpcPath = flag.String("rpc", "https://goerli.prylabs.net", "RPC address of a running ETH1 node")
beaconRPCPath = flag.String("beaconRPC", "localhost:4000", "RPC address of Beacon Node")
depositContractAddr = flag.String("deposit-contract", "", "Address of the deposit contract")
depositAmount = flag.Int64("deposit-amount", 0, "The amount of wei to deposit into the contract")
dbPath = flag.String("db-path", "", "The file path for database storage")
@@ -36,6 +37,9 @@ func main() {
go wt.WatchPods()
}
kc := newkeyChecker(db, *beaconRPCPath)
go kc.run()
s := grpc.NewServer()
pb.RegisterPrivateKeyServiceServer(s, srv)

View File

@@ -0,0 +1,49 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@io_bazel_rules_docker//go:image.bzl", "go_image")
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/prysmaticlabs/prysm/tools/eth1exporter",
visibility = ["//visibility:private"],
deps = [
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_ethereum_go_ethereum//ethclient:go_default_library",
"@com_github_ethereum_go_ethereum//params:go_default_library",
],
)
go_binary(
name = "eth1exporter",
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)
go_image(
name = "image",
srcs = ["main.go"],
goarch = "amd64",
goos = "linux",
importpath = "github.com/prysmaticlabs/prysm/tools/eth1exporter",
race = "off",
static = "off",
tags = ["manual"],
visibility = ["//visibility:private"],
deps = [
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_ethereum_go_ethereum//ethclient:go_default_library",
"@com_github_ethereum_go_ethereum//params:go_default_library",
],
)
container_push(
name = "push_image",
format = "Docker",
image = ":image",
registry = "gcr.io",
repository = "prysmaticlabs/eth1monitor",
tag = "latest",
tags = ["manual"],
visibility = ["//visibility:private"],
)

173
tools/eth1exporter/main.go Normal file
View File

@@ -0,0 +1,173 @@
// Prometheus exporter for Ethereum address balances.
// Forked from https://github.com/hunterlong/ethexporter
package main
import (
"bufio"
"context"
"flag"
"fmt"
"log"
"math/big"
"net/http"
"os"
"strings"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/params"
)
var (
allWatching []*Watching
loadSeconds float64
totalLoaded int64
eth *ethclient.Client
)
var (
port = flag.Int("port", 9090, "Port to serve /metrics")
web3URL = flag.String("web3-provider", "https://goerli.prylabs.net", "Web3 URL to access information about ETH1")
prefix = flag.String("prefix", "", "Metrics prefix.")
addressFilePath = flag.String("addresses", "", "File path to addresses text file.")
)
func main() {
flag.Parse()
if *addressFilePath == "" {
log.Println("--addresses is required")
return
}
err := OpenAddresses(*addressFilePath)
if err != nil {
panic(err)
}
err = ConnectionToGeth(*web3URL)
if err != nil {
panic(err)
}
// check address balances
go func() {
for {
totalLoaded = 0
t1 := time.Now()
fmt.Printf("Checking %v wallets...\n", len(allWatching))
for _, v := range allWatching {
v.Balance = GetEthBalance(v.Address).String()
totalLoaded++
}
t2 := time.Now()
loadSeconds = t2.Sub(t1).Seconds()
fmt.Printf("Finished checking %v wallets in %0.0f seconds, sleeping for %v seconds.\n", len(allWatching), loadSeconds, 15)
time.Sleep(15 * time.Second)
}
}()
block := CurrentBlock()
fmt.Printf("ETHexporter has started on port %v using web3 server: %v at block #%v\n", *port, *web3URL, block)
http.HandleFunc("/metrics", MetricsHTTP)
http.HandleFunc("/reload", ReloadHTTP)
panic(http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", *port), nil))
}
// Watching address wrapper
type Watching struct {
Name string
Address string
Balance string
}
// ConnectionToGeth - Connect to remote server.
func ConnectionToGeth(url string) error {
var err error
eth, err = ethclient.Dial(url)
return err
}
// GetEthBalance from remote server.
func GetEthBalance(address string) *big.Float {
balance, err := eth.BalanceAt(context.TODO(), common.HexToAddress(address), nil)
if err != nil {
fmt.Printf("Error fetching ETH Balance for address: %v\n", address)
}
return ToEther(balance)
}
// CurrentBlock in ETH1.
func CurrentBlock() uint64 {
block, err := eth.BlockByNumber(context.TODO(), nil)
if err != nil {
fmt.Printf("Error fetching current block height: %v\n", err)
return 0
}
return block.NumberU64()
}
// ToEther from Wei.
func ToEther(o *big.Int) *big.Float {
wei := big.NewFloat(0)
wei.SetInt(o)
return new(big.Float).Quo(wei, big.NewFloat(params.Ether))
}
// MetricsHTTP - HTTP response handler for /metrics.
func MetricsHTTP(w http.ResponseWriter, r *http.Request) {
var allOut []string
total := big.NewFloat(0)
for _, v := range allWatching {
if v.Balance == "" {
v.Balance = "0"
}
bal := big.NewFloat(0)
bal.SetString(v.Balance)
total.Add(total, bal)
allOut = append(allOut, fmt.Sprintf("%veth_balance{name=\"%v\",address=\"%v\"} %v", *prefix, v.Name, v.Address, v.Balance))
}
allOut = append(allOut, fmt.Sprintf("%veth_balance_total %0.18f", *prefix, total))
allOut = append(allOut, fmt.Sprintf("%veth_load_seconds %0.2f", *prefix, loadSeconds))
allOut = append(allOut, fmt.Sprintf("%veth_loaded_addresses %v", *prefix, totalLoaded))
allOut = append(allOut, fmt.Sprintf("%veth_total_addresses %v", *prefix, len(allWatching)))
fmt.Fprintln(w, strings.Join(allOut, "\n"))
}
// ReloadHTTP reloads the addresses from disk.
func ReloadHTTP(w http.ResponseWriter, _ *http.Request) {
if err := OpenAddresses(*addressFilePath); err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusOK)
log.Println("Reloaded addresses")
}
// OpenAddresses from text file (name:address)
func OpenAddresses(filename string) error {
file, err := os.Open(filename)
if err != nil {
return err
}
defer file.Close()
scanner := bufio.NewScanner(file)
allWatching = []*Watching{}
for scanner.Scan() {
object := strings.Split(scanner.Text(), ":")
if common.IsHexAddress(object[1]) {
w := &Watching{
Name: object[0],
Address: object[1],
}
allWatching = append(allWatching, w)
}
}
if err := scanner.Err(); err != nil {
return err
}
return err
}

View File

@@ -43,7 +43,7 @@ go_image(
importpath = IMPORT_PATH,
deps = DEPS,
pure = "off", # depends on cgo for go-ethereum crypto
static = "on",
static = "off", # go-ethereum is bad about static
tags = ["manual"],
goarch = "amd64",
goos = "linux",

View File

@@ -14,10 +14,12 @@ go_library(
"//shared/cmd:go_default_library",
"//shared/debug:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/logutil:go_default_library",
"//shared/version:go_default_library",
"//validator/accounts:go_default_library",
"//validator/node:go_default_library",
"//validator/types:go_default_library",
"@com_github_joonix_log//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_urfave_cli//:go_default_library",
"@com_github_x_cray_logrus_prefixed_formatter//:go_default_library",
@@ -44,9 +46,11 @@ go_image(
"//shared/debug:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/version:go_default_library",
"//shared/logutil:go_default_library",
"//validator/accounts:go_default_library",
"//validator/node:go_default_library",
"//validator/types:go_default_library",
"@com_github_joonix_log//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_urfave_cli//:go_default_library",
"@com_github_x_cray_logrus_prefixed_formatter//:go_default_library",

View File

@@ -53,7 +53,6 @@ go_test(
"//shared/bitutil:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/keystore:go_default_library",
"//shared/mathutil:go_default_library",
"//shared/params:go_default_library",
"//shared/testutil:go_default_library",
"//validator/accounts:go_default_library",

View File

@@ -51,6 +51,7 @@ func (v *validator) AttestToBlockHead(ctx context.Context, slot uint64, idx stri
for _, amnt := range v.assignments.Assignment {
if bytes.Equal(pubKey, amnt.PublicKey) {
assignment = amnt
break
}
}
idxReq := &pb.ValidatorIndexRequest{
@@ -121,7 +122,10 @@ func (v *validator) AttestToBlockHead(ctx context.Context, slot uint64, idx stri
}
}
aggregationBitfield := bitutil.SetBitfield(indexInCommittee, committeeLength)
aggregationBitfield, err := bitutil.SetBitfield(indexInCommittee, len(assignment.Committee))
if err != nil {
log.Errorf("Could not set bitfield: %v", err)
}
attestation.AggregationBitfield = aggregationBitfield
// TODO(#1366): Use BLS to generate an aggregate signature.
@@ -133,6 +137,14 @@ func (v *validator) AttestToBlockHead(ctx context.Context, slot uint64, idx stri
"validator": truncatedPk,
}).Info("Attesting to beacon chain head...")
span.AddAttributes(
trace.Int64Attribute("slot", int64(slot)),
trace.Int64Attribute("shard", int64(attData.Shard)),
trace.StringAttribute("blockRoot", fmt.Sprintf("%#x", attestation.Data.BeaconBlockRootHash32)),
trace.Int64Attribute("justifiedEpoch", int64(attData.JustifiedEpoch)),
trace.StringAttribute("bitfield", fmt.Sprintf("%#x", aggregationBitfield)),
)
attResp, err := v.attesterClient.AttestHead(ctx, attestation)
if err != nil {
log.Errorf("Could not submit attestation to beacon node: %v", err)

View File

@@ -13,7 +13,6 @@ import (
pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
pb "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1"
"github.com/prysmaticlabs/prysm/shared/bitutil"
"github.com/prysmaticlabs/prysm/shared/mathutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/testutil"
logTest "github.com/sirupsen/logrus/hooks/test"
@@ -149,7 +148,10 @@ func TestAttestToBlockHead_AttestsCorrectly(t *testing.T) {
CustodyBitfield: make([]byte, (len(committee)+7)/8),
Signature: []byte("signed"),
}
aggregationBitfield := bitutil.SetBitfield(4, mathutil.CeilDiv8(len(committee)))
aggregationBitfield, err := bitutil.SetBitfield(4, len(committee))
if err != nil {
t.Fatal(err)
}
expectedAttestation.AggregationBitfield = aggregationBitfield
if !proto.Equal(generatedAttestation, expectedAttestation) {
t.Errorf("Incorrectly attested head, wanted %v, received %v", expectedAttestation, generatedAttestation)

View File

@@ -1,6 +1,7 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1 (interfaces: BeaconServiceClient,BeaconService_WaitForChainStartClient)
// Source: github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1 (interfaces: BeaconServiceClient,BeaconService_LatestAttestationClient,BeaconService_WaitForChainStartClient)
// Package internal is a generated GoMock package.
package internal
import (
@@ -178,6 +179,129 @@ func (mr *MockBeaconServiceClientMockRecorder) WaitForChainStart(arg0, arg1 inte
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitForChainStart", reflect.TypeOf((*MockBeaconServiceClient)(nil).WaitForChainStart), varargs...)
}
// MockBeaconService_LatestAttestationClient is a mock of BeaconService_LatestAttestationClient interface
type MockBeaconService_LatestAttestationClient struct {
ctrl *gomock.Controller
recorder *MockBeaconService_LatestAttestationClientMockRecorder
}
// MockBeaconService_LatestAttestationClientMockRecorder is the mock recorder for MockBeaconService_LatestAttestationClient
type MockBeaconService_LatestAttestationClientMockRecorder struct {
mock *MockBeaconService_LatestAttestationClient
}
// NewMockBeaconService_LatestAttestationClient creates a new mock instance
func NewMockBeaconService_LatestAttestationClient(ctrl *gomock.Controller) *MockBeaconService_LatestAttestationClient {
mock := &MockBeaconService_LatestAttestationClient{ctrl: ctrl}
mock.recorder = &MockBeaconService_LatestAttestationClientMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockBeaconService_LatestAttestationClient) EXPECT() *MockBeaconService_LatestAttestationClientMockRecorder {
return m.recorder
}
// CloseSend mocks base method
func (m *MockBeaconService_LatestAttestationClient) CloseSend() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CloseSend")
ret0, _ := ret[0].(error)
return ret0
}
// CloseSend indicates an expected call of CloseSend
func (mr *MockBeaconService_LatestAttestationClientMockRecorder) CloseSend() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockBeaconService_LatestAttestationClient)(nil).CloseSend))
}
// Context mocks base method
func (m *MockBeaconService_LatestAttestationClient) Context() context.Context {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Context")
ret0, _ := ret[0].(context.Context)
return ret0
}
// Context indicates an expected call of Context
func (mr *MockBeaconService_LatestAttestationClientMockRecorder) Context() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockBeaconService_LatestAttestationClient)(nil).Context))
}
// Header mocks base method
func (m *MockBeaconService_LatestAttestationClient) Header() (metadata.MD, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Header")
ret0, _ := ret[0].(metadata.MD)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Header indicates an expected call of Header
func (mr *MockBeaconService_LatestAttestationClientMockRecorder) Header() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockBeaconService_LatestAttestationClient)(nil).Header))
}
// Recv mocks base method
func (m *MockBeaconService_LatestAttestationClient) Recv() (*v1.Attestation, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Recv")
ret0, _ := ret[0].(*v1.Attestation)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Recv indicates an expected call of Recv
func (mr *MockBeaconService_LatestAttestationClientMockRecorder) Recv() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockBeaconService_LatestAttestationClient)(nil).Recv))
}
// RecvMsg mocks base method
func (m *MockBeaconService_LatestAttestationClient) RecvMsg(arg0 interface{}) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RecvMsg", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// RecvMsg indicates an expected call of RecvMsg
func (mr *MockBeaconService_LatestAttestationClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockBeaconService_LatestAttestationClient)(nil).RecvMsg), arg0)
}
// SendMsg mocks base method
func (m *MockBeaconService_LatestAttestationClient) SendMsg(arg0 interface{}) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SendMsg", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SendMsg indicates an expected call of SendMsg
func (mr *MockBeaconService_LatestAttestationClientMockRecorder) SendMsg(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockBeaconService_LatestAttestationClient)(nil).SendMsg), arg0)
}
// Trailer mocks base method
func (m *MockBeaconService_LatestAttestationClient) Trailer() metadata.MD {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Trailer")
ret0, _ := ret[0].(metadata.MD)
return ret0
}
// Trailer indicates an expected call of Trailer
func (mr *MockBeaconService_LatestAttestationClientMockRecorder) Trailer() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockBeaconService_LatestAttestationClient)(nil).Trailer))
}
// MockBeaconService_WaitForChainStartClient is a mock of BeaconService_WaitForChainStartClient interface
type MockBeaconService_WaitForChainStartClient struct {
ctrl *gomock.Controller

View File

@@ -57,6 +57,26 @@ func (mr *MockValidatorServiceClientMockRecorder) CommitteeAssignment(arg0, arg1
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitteeAssignment", reflect.TypeOf((*MockValidatorServiceClient)(nil).CommitteeAssignment), varargs...)
}
// ExitedValidators mocks base method
func (m *MockValidatorServiceClient) ExitedValidators(arg0 context.Context, arg1 *v1.ExitedValidatorsRequest, arg2 ...grpc.CallOption) (*v1.ExitedValidatorsResponse, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "ExitedValidators", varargs...)
ret0, _ := ret[0].(*v1.ExitedValidatorsResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ExitedValidators indicates an expected call of ExitedValidators
func (mr *MockValidatorServiceClientMockRecorder) ExitedValidators(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExitedValidators", reflect.TypeOf((*MockValidatorServiceClient)(nil).ExitedValidators), varargs...)
}
// ValidatorIndex mocks base method
func (m *MockValidatorServiceClient) ValidatorIndex(arg0 context.Context, arg1 *v1.ValidatorIndexRequest, arg2 ...grpc.CallOption) (*v1.ValidatorIndexResponse, error) {
m.ctrl.T.Helper()

View File

@@ -8,9 +8,11 @@ import (
"strings"
"syscall"
joonix "github.com/joonix/log"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/debug"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/logutil"
"github.com/prysmaticlabs/prysm/shared/version"
"github.com/prysmaticlabs/prysm/validator/accounts"
"github.com/prysmaticlabs/prysm/validator/node"
@@ -98,10 +100,6 @@ func createValidatorAccount(ctx *cli.Context) (string, string, error) {
}
func main() {
customFormatter := new(prefixed.TextFormatter)
customFormatter.TimestampFormat = "2006-01-02 15:04:05"
customFormatter.FullTimestamp = true
logrus.SetFormatter(customFormatter)
log := logrus.WithField("prefix", "main")
app := cli.NewApp()
app.Name = "validator"
@@ -142,21 +140,52 @@ contract in order to activate the validator client`,
cmd.VerbosityFlag,
cmd.DataDirFlag,
cmd.EnableTracingFlag,
cmd.TracingProcessNameFlag,
cmd.TracingEndpointFlag,
cmd.TraceSampleFractionFlag,
cmd.BootstrapNode,
cmd.MonitoringPortFlag,
cmd.LogFormat,
debug.PProfFlag,
debug.PProfAddrFlag,
debug.PProfPortFlag,
debug.MemProfileRateFlag,
debug.CPUProfileFlag,
debug.TraceFlag,
cmd.LogFileName,
}
app.Flags = append(app.Flags, featureconfig.ValidatorFlags...)
app.Before = func(ctx *cli.Context) error {
format := ctx.GlobalString(cmd.LogFormat.Name)
switch format {
case "text":
formatter := new(prefixed.TextFormatter)
formatter.TimestampFormat = "2006-01-02 15:04:05"
formatter.FullTimestamp = true
// If persistent log files are written - we disable the log messages coloring because
// the colors are ANSI codes and seen as Gibberish in the log files.
formatter.DisableColors = ctx.GlobalString(cmd.LogFileName.Name) != ""
logrus.SetFormatter(formatter)
break
case "fluentd":
logrus.SetFormatter(joonix.NewFormatter())
break
case "json":
logrus.SetFormatter(&logrus.JSONFormatter{})
break
default:
return fmt.Errorf("unknown log format %s", format)
}
logFileName := ctx.GlobalString(cmd.LogFileName.Name)
if logFileName != "" {
if err := logutil.ConfigurePersistentLogging(logFileName); err != nil {
log.WithError(err).Error("Failed to configuring logging to disk.")
}
}
runtime.GOMAXPROCS(runtime.NumCPU())
return debug.Setup(ctx)
}

View File

@@ -40,6 +40,7 @@ type ValidatorClient struct {
func NewValidatorClient(ctx *cli.Context, password string) (*ValidatorClient, error) {
if err := tracing.Setup(
"validator", // service name
ctx.GlobalString(cmd.TracingProcessNameFlag.Name),
ctx.GlobalString(cmd.TracingEndpointFlag.Name),
ctx.GlobalFloat64(cmd.TraceSampleFractionFlag.Name),
ctx.GlobalBool(cmd.EnableTracingFlag.Name),

View File

@@ -47,6 +47,7 @@ var appHelpFlagGroups = []flagGroup{
cmd.VerbosityFlag,
cmd.DataDirFlag,
cmd.EnableTracingFlag,
cmd.TracingProcessNameFlag,
cmd.TracingEndpointFlag,
cmd.TraceSampleFractionFlag,
cmd.BootstrapNode,