Commit Graph

792 Commits

Author SHA1 Message Date
Nishant Das
edf7ed614e
Reduce Hashing When Filling In Forkchoice Blocks (#7716)
* reduce hashing

* add in test

* Update beacon-chain/blockchain/process_block_test.go

Co-authored-by: terence tsao <terence@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-05 01:33:45 +00:00
Raul Jordan
0b0d77dd0c
Include Multilock for GetAttPreState With Tests (#7669)
* multilock addition with tests and special clean logic on unlock

* bazel changes

* multilock key string concat

* Update beacon-chain/blockchain/process_attestation_helpers.go

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

* presto feedback

* revert in prog cache

* defer unlock

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
2020-11-03 21:18:15 +00:00
Potuz
1a03dad6bc
Include exiting and slashing as active in metrics (#7713)
Co-authored-by: terence tsao <terence@prysmaticlabs.com>
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2020-11-03 20:40:25 +00:00
terence tsao
2da1ec8052
Remove expensive validators only method (#7717)
* Remove validators only method

* Gazelle
2020-11-03 12:47:21 -06:00
terence tsao
19ac6782c9
Use batch verify signature for a signle block (#7687) 2020-11-02 15:27:29 -08:00
terence tsao
92b6e0b6af
Add and use HasStateInCache (#7691) 2020-10-31 11:38:01 -07:00
Raul Jordan
b3155a04f5
Revert "Revert "Add In Progress Checker For Checkpoint Cache"" (#7690)
This reverts commit 46c04b98d9.
2020-10-31 15:59:50 +00:00
terence tsao
f79b168ab2
Update to correct odering (#7688) 2020-10-31 10:08:22 +08:00
terence tsao
386bfdd6eb
Remove deprecated headstate method in DB (#7680)
* Remove head state in DB

* Clean up tests

* Fix pow tests

* Add stateGen to pow service
2020-10-30 15:11:08 +00:00
Nishant Das
46c04b98d9
Revert "Add In Progress Checker For Checkpoint Cache" (#7672)
This reverts commit 37bf6617c0.

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2020-10-29 14:35:30 +00:00
terence tsao
301499d134
Fill in blocks to fork choice store during init (#7665)
* Fill in blocks to fork choice store during init

* Use format option

* Use format option

* Use correct head block. Thanks Nishant

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-29 05:27:30 +00:00
Nishant Das
37bf6617c0
Add In Progress Checker For Checkpoint Cache (#7659)
* add inprogress checker

* fix test

* fix

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
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-29 01:21:49 +00:00
Preston Van Loon
149d3b84fa
Check attestation target checkpoint epoch matches attestation slot (#7667)
* Check attestation target checkpoint is within current or previous epoch

* reject bad att where slot does not match target

* Add test, reduce redundant check
2020-10-29 00:52:18 +00:00
Preston Van Loon
5092093389
Revert "Remove redundant checks in processAttestation" (#7666)
This reverts commit 3b34954e75.
2020-10-28 22:46:26 +00:00
terence tsao
3b34954e75
Remove continue checks (#7663) 2020-10-28 13:04:28 -07:00
Preston Van Loon
ec5e59e212
remove unused and untested method (#7662)
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2020-10-28 12:03:30 -07:00
Raul Jordan
d9e4084d6d
Remove Lock Contention in getAttPreState (#7656)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-28 05:42:54 +00:00
Preston Van Loon
fcbb168c76
Code health: review map usage (#7635)
* remove unused cache states map

* correct typo

* Remove unused array

* Add lock around deposits cache chainstart pubkeys

* Copy attestation before grabbing lock. This may reduce lock contention time as other callers wanting the lock do not need to wait as long for the lock to become available.

* Copy attestation before grabbing lock. This may reduce lock contention time as other callers wanting the lock do not need to wait as long for the lock to become available.

* Set capacity to 1 since it is known that the slice will be 1 after insertion

* require validatorSlashingPreconditionCheck caller to hold lock

* Add lock for voluntary exits pool HasBeenIncluded

* Require rate limiter retrieveCollector to hold lock

* Add lock requirement assertions in sync

* Remove unused struct

* remove ClearCachedStates API

* field initSyncState is unused

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2020-10-26 21:17:07 +00:00
terence tsao
ec77196197
Remove checkpoint info cache and usages (#7642)
* Remove checkpoint info cache and usages

* Gazelle
2020-10-26 14:09:19 -05:00
Nishant Das
ff50ea2e0d
Better Logging When Using Head Sync (#7626)
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2020-10-23 21:00:53 +00:00
terence tsao
ebb3fa71f1
VerifyFinalizedConsistency - return early when canonical (#7628)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-23 19:02:20 +00:00
terence tsao
e07a12e6b7
Move IsCanonical implementation to forkchoice package (#7602)
* Move IsCanonical implementation to forkchoice pkg

* Remove debug print log

* Add tests

* Fixed current tests

* Fixed a test

* Fixed a test

* Add tests for cov
2020-10-23 01:32:13 +00:00
terence tsao
840ffc84ac
Save state to DB during long non-finality (#7597)
* Starting saving state during hot

* Add a log

* Add helpers to turn on/off mode

* Add locks

* Add missing return

* Clean up

* Add logic to migration to handle db roots

* Add tests for on and off

* Add more tests

* Add test for migrate

* @prestonvanloon's feedback

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 00:35:30 +00:00
Raul Jordan
e54ac48f9d
Deep Source Security Issues (#7617)
* deep source issues

* fix broken build

* fix beacon chain build

* gaz

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-22 23:31:52 +00:00
Raul Jordan
e7723c4d1f
Remove Deprecated Participation Metrics (#7616)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-22 20:14:58 +00:00
Nishant Das
ddbece5988
Fix Range Request Responses (#7531)
* checkpoint

* fix tests

* fix all tests

* imports

* gazelle

* reviews

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2020-10-22 09:33:01 -05:00
terence tsao
42b7a37281
Add span for AncestorRoot (#7595)
* Add spans for AncestorRoot

* Add span for ancestor by DB

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-21 16:26:19 +00:00
terence tsao
a5ce6db38e
Update participation metrics (#7582)
* Update participation metrics

* Add unhappy tests
2020-10-20 14:14:24 -05:00
terence tsao
9db6c0042b
Add LMD FFG consistency check to aggregated attestation (#7573)
* Add lmd and ffg check

* Update tests

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-19 23:19:44 +00:00
terence tsao
3d70d757a1
Add checking for finalized consistency (#7568)
* Add checking for finalized consistency

* Add tests

* @prestonvanloon's feedback

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-19 21:52:18 +00:00
terence tsao
e25cd08049
Rename unsafe-sync to head-sync (#7570)
* Rename unsafe-sync to head-sync

* Update comments

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-19 20:03:31 +00:00
Nishant Das
f31d40cf34
Fix Unsafe Sync Flag (#7563)
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-18 22:28:44 +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
terence tsao
9e712e4598
Add justified block insertion to forkchoice when missed (#7520)
* Add justified block insertion to fork choice when missed

* Add regression test
2020-10-13 18:26:43 +00:00
terence tsao
e9c23673c5
Remove inital sync don't verify att sig flag (#7517) 2020-10-13 06:08:21 +00:00
Radosław Kapka
06d16a24b9
Reduce deposit memory (#7478)
* remove deposit proof and pending deposits

* wip

* wip

* wip

* clean up logs/comments

* function for pruning deposits and feature flag

* remove log

* add flag to beacon flags

* addressed PR feedback from terence

* add test assertions for errors

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-12 18:10:49 +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
4c09e59b3b
Remove duplicate imports (#7491)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-10 03:54:31 +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
terence tsao
8aaa5b6ad0
Refactor ancestor lookup (#7472)
* Add ancestor root fall back to DB check

* Add a warning message

* Refactor ancestor lookups into seperate functions

* Update error string

* Fix has parent check and add a regression test

* Add a conext error test

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-10 00:07:56 +00:00
Victor Farazdagi
f92244d497
Remove redundant err checking (#7488)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-09 23:39:23 +00:00
Radosław Kapka
25ebed9a70
Cache deposits only up to finalized block (#7453)
* cache deposits until finalized block

* take deposit index from state instead of block

* use stateByRoot

* use eth1data deposit count

* use depositCount-1

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-08 10:12:21 +00:00
terence tsao
7ad2929f0f
Revamp proposer cache to fix lookahead bug (#7442)
* Add and test proposer indices cache

* Remove proposer indices usages from committee cache

* Adopt the new proposer indices cache

* Add comments on why genesis epoch is skipped

* Fix the failing tests

* Update beacon-chain/blockchain/process_block.go

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

* Update beacon-chain/core/helpers/committee.go

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

* Update beacon-chain/core/helpers/slot_epoch.go

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

* Update beacon-chain/core/helpers/slot_epoch.go

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

* Update beacon-chain/core/helpers/slot_epoch_test.go

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

* Update beacon-chain/core/helpers/validators.go

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

* Address additional feedbacks from @prestonvanloon

* Add comments on why genesis epoch is skipped

* Refactor EndSlot to use StartSlot within

* Add proposer indices disabled

* Add libfuzz tags

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-07 17:25:08 +00:00
terence tsao
c0ed43d920
Refactor head info for better usages for lock (#7432)
* Refactor head info for better usages for lock

* Fix headroot test to use [32]byte{}

* go fmt: issue introduced in #7429

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-06 10:57:18 +00:00
Radosław Kapka
3e0b20529b
Miscellaneous code quality improvements (#7414)
* anti-patterns

* performance issues

* handle skipped defer

* gazelle fix

* misc bug risks

* make logging of proposer slashings more robust

* simplify calling span.End()

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-04 15:03:10 +00:00
terence tsao
7b3efcf62b
Move read lock after hasHeadState (#7427)
* Move read lock before hasHeadState

* Export the locked version

* Update beacon-chain/blockchain/head.go

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

* Update beacon-chain/blockchain/chain_info.go

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

* Update beacon-chain/blockchain/chain_info.go

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

* Update beacon-chain/blockchain/chain_info.go

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

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
2020-10-03 20:53:05 +00:00
terence tsao
c24fb792cb
Add locks around head getters (#7423) 2020-10-03 00:45:59 +00:00
Victor Farazdagi
d169b490fa
Fix ineffectual assignments (#7403)
* update rpc/beacon
* more fixes to beacon-chain/rpc
* update beacon-chain/sync
* Merge refs/heads/master into fix-ineffectual-assignments
* updates beacon-chain/p2p
* Merge branch 'fix-ineffectual-assignments' of github.com:prysmaticlabs/prysm into fix-ineffectual-assignments
* update beacon-chain/*
* fix imports
* update beacon-chain/blockchain
* more updates
* Merge refs/heads/master into fix-ineffectual-assignments
* Merge branch 'master' into fix-ineffectual-assignments
* Merge refs/heads/master into fix-ineffectual-assignments
* next round of updated
* Merge branch 'fix-ineffectual-assignments' of github.com:prysmaticlabs/prysm into fix-ineffectual-assignments
* wrap up remaining items
2020-10-01 18:53:36 +00:00