Commit Graph

298 Commits

Author SHA1 Message Date
Radosław Kapka
353c1f6387
Multiple discovery addresses (#8203)
* multiple discovery addresses

* ipv6 fix

* make len test more robust

* create enr node for testing

* use local node for test

* use mockListener

* remove unused type alias
2021-01-07 13:35:42 +00:00
Victor Farazdagi
9d737d60f4
Declare err in loop to limit its scope (#8200)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-01-05 13:55:23 +00:00
Victor Farazdagi
e5c69bd387
Add space at the start of comments (#8202)
* add space at the start of comments

* undo case change
2021-01-05 13:09:41 +00:00
Nishant Das
ea88799585
Revert Inbound Peer Limit (#8155)
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-12-18 18:33:31 +00:00
Nishant Das
44c3adb367
Add Public Method To Retrieve Discovery Address (#8143)
* add method

* fix

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-12-17 18:03:18 +00:00
terence tsao
70c0bb106b
Beacon node code health improvements (#8109)
* Apply code health fixes after code inspect

* Remove attestationRoot

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2020-12-14 23:41:24 +00:00
Victor Farazdagi
0f18867f08
Remove duplicate package imports (#8104)
* remove duplicate imports

* remove unused lookupLimit

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-12-14 22:22:55 +00:00
Steven Allen
2428880058
Update go-libp2p to 0.12.0 (#8015)
* Update go-libp2p to 0.12.0

go-libp2p 0.12.0 made some significant changes to the stream interfaces around
stream closing:

* Close now closes in both directions and frees the stream. However, unlike
FullClose did, it doesn't _wait_ for the remote peer to respond with an EOF.
* To close for writing, call CloseWrite (like one would on a TCP connection, etc.).

This patch:

* Replaces calls to FullClose with Close where appropriate.
* Replaces calls to Close with CloseWrite where appropriate.
* Removes redundant Close calls.
* Calls Reset to where appropriate to indicate that the request/response was
  aborted. Unlike Close, this will not flush and will not cause the remote peer
  to read an EOF. Instead, the remote peer will read an ErrReset error.
* Ensures we always either close or reset streams. Send wasn't closing the
  stream on some error paths.
* Now that stream closing is async, we explicitly wait for a response when
  "hanging up" on a peer (so we don't hang up before they receive our
  response/goodbye message).

* update bazel

* Gazelle

* revert unintentional bazel workspace change

* appease an overzealous linter

* update to latest

* Refactor encoder

* gazelle

* Gazelle

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
Co-authored-by: Nishant Das <nishdas93@gmail.com>
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2020-12-14 17:22:25 +00:00
Nishant Das
11bbf06d03
Add Inbound Peer Limit (#7942)
* add changes

* fix up

* fix

* add test

* fix test

* fix again

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
2020-12-12 03:46:55 +00:00
Nishant Das
29804fa572
Refactor Subnet Search (#8048)
* checkpoint progress

* checkpoint

* clean up

* do better

* fix test

* fix

* fix

* preston's review

* fix

* fix

* fix

* add iterator

* go doc

* make it a config parameter

* Apply suggestions from code review

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
2020-12-11 18:40:56 -08:00
Victor Farazdagi
be078d6a16
Update TestMain(): do not call os.Exit() explicitly (#8046)
* update workspace

* update testmain
2020-12-04 16:10:07 +00:00
Nishant Das
20514cd97f
Fix Interop Mode (#7978)
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
2020-12-02 20:29:36 +00:00
Victor Farazdagi
32f6bfd0a5
update deprecated multiaddr package (#8022) 2020-12-02 11:21:43 -08:00
Nishant Das
387f7b28c1
Add Buffer For Inbound Peers (#8018)
* allow inbound peers

* comment

* gaz

* gaz

* Update deps.bzl

Co-authored-by: Shay Zluf <thezluf@gmail.com>

* add test

* re-arrange imports

* fix up

* fix tests

* gaz

* Update beacon-chain/p2p/service_test.go

* fmt

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
Co-authored-by: Shay Zluf <thezluf@gmail.com>
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2020-12-02 10:45:28 -06:00
Nishant Das
a13de7da11
Remove Exclusion List (#7992)
* remove

* gaz

Co-authored-by: terence tsao <terence@prysmaticlabs.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-12-01 02:17:29 +00:00
Preston Van Loon
57fe012bc2
P2P: Increase outbound message queue size to 256 (#7916) 2020-11-22 23:54:58 +00:00
Preston Van Loon
9a10462c64
p2p: return error when attempting to connect to a bad peer (#7885)
* return error when attempting to connect to a bad peer

* temporarily skip test
2020-11-21 20:09:07 +00:00
Nishant Das
60cdd69b05
Update Gossipsub Parameters (#7869)
* add param and flag

* change back
2020-11-20 15:36:02 +00:00
Nishant Das
c4a1fe4d0d
Add Basic Support for IP Tracker (#7844)
* add basic support for ip tracker

* clean up

* check for it

* fix

* Update beacon-chain/p2p/peers/status.go

* fix
2020-11-19 12:54:19 +00:00
Victor Farazdagi
095c4d5dd5
Peer status peer scorer (#7480)
* define and enforce minimum scorer interface

* better decoupling of multiple scorers in service

* removes redundant weight

* adds peer_status scorer

* minir re-arrangement

* rely on scorer in peer status service

* gazelle

* updates rpc_status

* fix build

* better interface verifying

* remove unnecessary locks

* mark todo

* simplify service

* remove redundant references

* avoid passing contexts

* remove unused context

* refactor errors to p2p package

* refactor goodbye codes into p2p

* simplify status api

* remove isbad method from peers

* update scoring service

* introduce validation error

* gazelle

* add score

* restore isbad method

* resolve dep cycle

* gazelle

* peer status scorer: test score calculation

* bad responses scorer: bad peer score

* remove redundant type checks

* pass nil config

* add rounding

* test IsBadPeer

* test bad peers list

* more tests

* check validation error on non-existent peer

* max peer slot -> highest peer slot

* remove redundant comment

* combine

* combine

* introduce var

* fix tests

* remove redundant update

* minor fix

* Nishant's suggestion

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-11-18 15:51:42 +00:00
Victor Farazdagi
7735a083b2
Extract common types from sync (#7843)
* extract common types from sync

* fix tests

* simplify

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-11-18 04:17:42 +00:00
Victor Farazdagi
2034c662af
Refactor scoring service (#7841)
* refactor scoring service

* fix anti-pattern issue

* add block providers bad peers detection tests

* check status when peer scoring is disabled

* more tests
2020-11-17 23:28:13 +08:00
Victor Farazdagi
f361450e8d
Update TestMain() to use os.Exit() (#7814)
* update TestMain

* fix sync/initial-sync test

* restore code in rate limiter

* fix rate_limiter tests
2020-11-13 18:28:14 -08:00
Nishant Das
d281ef9c56
Clean Up GoodByes (#7790)
* clean up

* cleanup

* fix

* fix tests

* change

* deepsource

* fix test
2020-11-13 12:58:13 +00:00
terence tsao
52d850f355
Change connect/disconnect logs to debug (#7794)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-11-12 18:46:51 +00:00
Nishant Das
56fd535dd5
Add Gossip Scoring For Peers (#7184)
* add gossip scoring

* fix

* clean up

* remove

* add new topics

* clean up gossip scoring

* clean up

* fix

* gaz

* remove true

* comment better

* remove from dev
2020-11-12 08:08:07 +00:00
Victor Farazdagi
2f11e55869
Use t.TempDir() in tests (#7769)
* use t.TempDir()

* remove redundant delete

* simplify setupDB()

* simplify db/testing/setup_db

* fix tests
2020-11-10 22:45:17 +00:00
Victor Farazdagi
09e3f0360e
Remove redundant calls to os.exit() in TestMain (#7761)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-11-10 14:56:47 +00:00
Nishant Das
742808c6cf
Fix Seen Cache Interval (#7751)
* fix

* var

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-11-10 05:39:17 +00:00
Preston Van Loon
93c11e0e53
Update rules_go (#7202)
* Update rules_go

* go 1.15

* try with v0.24.2

* Update Mac OS X SDK

* gaz

* update SDK in toolchain config

* -I flag

* another -I flag

* Update rules_go, gazelle, bazel version

* regen, update rules_docker

* Revert "another -I flag"

This reverts commit 9255133d99bee1e94560a64316a4a7539a363935.

* Revert "-I flag"

This reverts commit 2954a41d76adc81ccb6281af243f4be1f79152e9.

* giving up

* Use OS X 10.12

* Use OS X 10.12

* Revert "Use OS X 10.12"

This reverts commit 4f60d5cb807b2ccccd484a85a6a7477a5fd13e28.

* Revert "Use OS X 10.12"

This reverts commit a79177fab7182ad792d1cee7fb61214ef8bd73ab.

* osx toolchain tweaks necessary to work with 10.15 mac sdk

* Update docker image, regen

* gaz

* test using custom image

* Revert "test using custom image"

This reverts commit 95b8666810a254f16061c99e2ea0ae4d020b2f2d.

* explicit go version

* Clean up docker image rules with new definitions. gazelle

* please the linter

* Update protobuf compiler to 3.13.0, run gazelle

* Update gazelle to fix empty build files. https://github.com/bazelbuild/bazel-gazelle/pull/926

* update skylib

* fix herumi fuzz build

* remove comment from tools/cross-toolchain/regenerate.sh

Co-authored-by: rkapka <rkapka@wp.pl>
Co-authored-by: SuburbanDad <gts.mobile@gmail.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-11-10 03:01:56 +00:00
Raul Jordan
d4c954648c
Prevent Usage of Stdlib File/Dir Writing With Static Analysis (#7685)
* write file and mkdirall analyzers

* include analyzer in build bazel

* comments to the single entrypoint and fix validator references

* enforce 600 for files, 700 for dirs

* pass validator tests

* add to nogo

* remove references

* beaconfuzz

* docker img

* fix up kv issue

* mkdir if not exists

* radek comments

* final comments

* Try to fix file problem

Co-authored-by: Ivan Martinez <ivanthegreatdev@gmail.com>
2020-11-09 14:27:03 -06:00
Nishant Das
bafc7479b0
Add Backoff For Peer Dials (#7726)
* add tests

* Update beacon-chain/p2p/peers/status_test.go

* fix conditional

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
2020-11-05 05:52:49 +00:00
Victor Farazdagi
3584bcba8e
Fix param naming in BestNonFinalized (#7693) 2020-11-01 00:03:44 +00:00
Nishant Das
92efe64b8a
Fix Gossip Message ID (#7624)
* fix snappy errors

* gaz

* Update beacon-chain/p2p/pubsub.go

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
2020-10-24 03:38:05 +00:00
Preston Van Loon
9ea69a070e
Fix attestation broadcast recovery metric (#7629) 2020-10-23 18:41:17 +00:00
Victor Farazdagi
e5e51e66e1
Handle voting ties in BestFinalized() (#7622) 2020-10-23 04:43:35 +00:00
Victor Farazdagi
6a2bb65fe2
Fix BestFinalized method (#7619)
* turn tests to use testing vector

* add regression test case

* complete tests
2020-10-23 02:49:42 +00:00
Preston Van Loon
ecc25d2b8c
Release and remove feature flag --enable-att-broadcast-discovery-attempts (#7610)
* Release and remove feature flag --enable-att-broadcast-discovery-attempts

* fix test

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-23 01:53:50 +00:00
Nishant Das
05678b6724
Update to Discovery V5.1 (#7302)
* discoveryV5.1

* add seed node

* fix up

* checkpoint

* Add workaround for discv5.1 signature curve. Add discv5.1 catdog ENR

* remove dead code

* Add another catdog

* Fix bootnode

* fix docker img

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
2020-10-20 04:05:48 +00:00
Preston Van Loon
07e7e030d9
Update PubSub and include topic filter (#7496)
* Update pubsub and fix topicIDs

* WIP filter

* Add suggested code from @bidlocode

* add tests and fix bugs

* more tests

* Wait until state initialized to accept pubsub filtering

* rename for clarity and clarify comment

* fix test builds

* Autofix issues in 2 files

Resolved issues in the following files via DeepSource Autofix:
1. beacon-chain/p2p/pubsub_filter.go
2. beacon-chain/p2p/pubsub_filter_test.go

* @nisdas pr feedback

* pr feedback and fuzz fix

* Update beacon-chain/p2p/pubsub_filter.go

* Must have protocol suffix

* Must have protocol suffix

* gofmt

* rm test, fix panic

* Fix tests

* Add isInitialized check

* Add a few more tests for better coverage

* cache fork digest, make pubsub filter part of the p2p service

* rename service

* gofmt

* Add comment

* fix

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: Nishant Das <nishdas93@gmail.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-16 07:05:40 +00:00
terence tsao
7076a1ec4a
More feature flag deletions (#7533)
* Delete disable state lock and init sync verbose flags

* Delete disable slashing broadcast

* Remove disable wait for sync, noise, eth1 cache, static subnet

* Remove enable broadcast recovery attemp and make it as default

* Remove disable head update on per attestation

* Revert disable att braodcast discovery attempt

* gazelle

* Fixed an anti pattern

* Add enableAttBroadcastDiscoveryAttempts back

* Add back WaitForSync

* Remove extra lines

* Use DisableDynamicCommitteeSubnets path per @prestonvanloon feedback

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-14 23:28:49 +00:00
Victor Farazdagi
a005c77b3f
Update error usage patterns to go1.13+ (#7529)
* rely on errors.Is

* wrap errors
2020-10-14 17:39:52 +00:00
Nishant Das
022b6667e5
Use Custom SSZ for P2P Types (#7436)
* checkpoint progress

* add roundtrip tests

* change all

* remove error response

* clean up

* Update beacon-chain/sync/error_test.go

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>

* gaz

* fix tests

* fmt

* gaz

* change back

* fix again

* clean up

* deep source

* fix all tests

* add gaz

* fix tests

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
2020-10-14 07:55:28 +00:00
Victor Farazdagi
ac1a4a078c
Fix reported anti patterns (#7501)
* merge var decl

* single append

* replace bytes.Compare -> bytes.Equal

* remove redundant spritnf

* remove redundant spritnf

* trimprefix

* remove redundant nil check

* remove redundant return

* plain channel or unblock on context closing

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-12 16:12:00 +00:00
Victor Farazdagi
a019a0db4c
Combines func params of the same type (#7500)
* combines func params

* update leftovers

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-12 15:43:19 +00:00
Preston Van Loon
7cc32c4dda
Various code inspection resolutions (#7438)
* remove unused code

* remove defer use in loop

* Remove unused methods and constants

* gofmt and gaz

* nilness check

* remove unused args

* Add TODO for refactoring subscribeWithBase to remove unused arg. It seems too involved to include in this sweeping PR. https://github.com/prysmaticlabs/prysm/issues/7437

* replace empty slice declaration

* Remove unnecessary type conversions

* remove redundant type declaration

* rename receivers to be consistent

* Remove bootnode query tool. It is now obsolete by discv5

* Remove relay node. It is no longer used or supported

* Revert "Remove relay node. It is no longer used or supported"

This reverts commit 4bd7717334dad85ef4766ed9bc4da711fb5fa810.

* Delete unused test directory

* Delete unsupported gcp startup script

* Delete old k8s script

* build fixes

* fix build

* go mod tidy

* revert slasher/db/kv/block_header.go

* fix build

* remove redundant nil check

* combine func args

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
2020-10-12 08:11:05 +00:00
Victor Farazdagi
d98a6dda8f
Verify interface compliance using typed nil instead of dereferencing and conversion (#7489)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-10 00:36:48 +00:00
Nishant Das
f629c72107
Tighten Up Snappy Framing (#7479)
* fix framing

* fix up conditions

* fix

* clean up

* change back

* simpler

* no need to cast

* Use math.MaxInt64

* gaz, gofmt

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-09 16:50:18 +00:00
Nishant Das
a66f434236
Listen to all Network Interfaces for discovery (#7434)
* listen to all ifaces for discovery

* fix test

* fix tests

* fix all tests

* Revert "fix all tests"

This reverts commit a5d6fffd45b09ec0361b2432c6e617648983676e.

* Revert "fix tests"

This reverts commit b7a0cf560984ff7dc5889fd5385dfcea32c14748.

* Revert "fix test"

This reverts commit 57e6218c680d4707b22ff251a122d8455fb1ccaf.

* fix and use loopback

* do properly

* fix

* listen to all ifaces

* fix bootnode

* make it trace

* make it loopback

* swap out

* change back

* fix e2e

* fix

* Update beacon-chain/p2p/discovery.go

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-08 15:16:18 +00:00
Victor Farazdagi
9ce64e2428
Refactor peer scorer into peerdata + scorers (#7452)
* updates comment

* manager -> service

* rename receiver

* refacgtor bad_responses

* refactor store

* update status service

* extends data service

* status service test

* refactor block provider scorer

* misc updates

* fix tests

* data -> peerdata

* gazelle

* peerdata/store test

* limit the visibility scope

* Nishant's suggestion

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-07 13:08:51 +00:00