Commit Graph

279 Commits

Author SHA1 Message Date
Raul Jordan
94dbac4016 Fix BlockTree RPC Server Response (#2556) 2019-05-10 10:07:43 -07:00
Raul Jordan
ecef1093eb
Fetch Block Tree from Justified Block to Highest Observed Slot via RPC (#2549)
* test block tree req

* tree improvement

* use the right data

* block tree blocked by children func

* rem file

* imports

* add ctx

* imports

* mock

* check expired context

* added block root

* gazelle

* sace
2019-05-09 12:38:05 -05:00
Raul Jordan
c1dfa2677e
Prevent Reorgs if Chain Head Does Not Change (#2548)
* revent reorgs if head does not change

* lint

* spacing
2019-05-09 11:42:24 -05:00
Raul Jordan
a4128f691b
Refactor DB Package to Enable Multiple Blocks/States at Slots (#2540)
* prefixed blocks blocked

* db refactor

* new historical state saving

* builds but tests fail

* more tests pass

* fix tests

* fix tests

* delete buf

* Update beacon-chain/db/block.go

Co-Authored-By: rauljordan <raul@prysmaticlabs.com>

* Update beacon-chain/db/block.go

Co-Authored-By: rauljordan <raul@prysmaticlabs.com>

* rem unused
2019-05-09 10:42:12 -05:00
terence tsao
b05f64ff91 enhance forkchoice log (#2537) 2019-05-08 19:00:30 -05:00
Raul Jordan
0bab9f492d Do Not Run Fork Choice on Block Proposals (#2526) 2019-05-07 23:02:52 -07:00
Preston Van Loon
57495bc8fe Revert "Canonical Blocks for Batch Block Request (#2511)" (#2532)
This reverts commit a818564b8d.
2019-05-08 00:52:34 -05:00
Raul Jordan
4954ed0221
Use Single Code Path for Receiving Blocks and Fork Choice (#2514)
* insert canonical

* one path

* single entry

* travis

* lint
2019-05-06 15:06:41 -05:00
terence tsao
a818564b8d
Canonical Blocks for Batch Block Request (#2511)
* only reply canonical block for reg sync

* CanonicalBlock test

* lint
2019-05-06 11:02:04 -07:00
terence tsao
38da4a5cd4
Add Forkchoice Tie Breaker (#2459) 2019-05-01 10:18:56 -07:00
terence tsao
de6ea81790 Recent Block Roots RPC API (#2455)
* add metrics for corret participation rate

* gaz

* add recent canonical roots API

* gaz

* all tests passed

* comments

* fmt
2019-05-01 10:14:46 -05:00
Raul Jordan
aa74b1dca3 Various Logging Improvements (#2454) 2019-04-30 14:55:59 -07:00
terence tsao
d453b0f199 fixed typos (#2444) 2019-04-30 14:55:14 -05:00
terence tsao
63998b92aa Add and Use Truncate Hash Library (#2417)
* add truncate lib

* use trunc

* spaces
2019-04-29 13:11:51 -05:00
Nishant Das
52250c9e7a Fix Fork Choice Reorg Conditions (#2413)
* make fixes

* change condition

* comment

* fixed up a few var names for clarity

* added test for isDescendant

* chain split reorg test

* interface for atts service

* comprehensive reorg regression test added

* space

* all tests pass

* target handler

* ci lint

* Update beacon-chain/sync/receive_block.go

Co-Authored-By: rauljordan <raul@prysmaticlabs.com>
2019-04-28 17:53:51 -04:00
frederickalcantara
a170c69653 upgrading linter from gometalinter to golangci-lint (#2100)
* upgrading linter from gometalinter to golangci-lint

* fixed golangci-lint linting

* removed linting before_script command

* removed disable-all command

* Fixed golang config file

* fixed golang config file v2

* removed gosec issue rule

* formatting

* fixed travis build to run golangci-lint

* Add install golangci-lint command

* fixing golangci-lint script

* removed https://

* Added golangci-lint cmd script

* added go get for local lint install

* created a before_script

* add install before script

* Added get script

* added go mod download

* removed go mod downloads

* changed

* removed before script

* Added before script go get lint

* added exit zero to see what went wrong

* removed golang run script

* removed before script

* change lint command

* verbose output

* removed verbose

* change linter enable and disable configuration

* Update .golangci.yml

Removed gotype as a linter

* Update .golangci.yml

Added typecheck linter

* Update .golangci.yml

Added fixed lint version

* Update .golangci.yml

Added gotype

* Update .golangci.yml

Added typecheck

* removed env:lint

* Added env lint

* fixing lint upgrade

* Changing travis configuration

* FIxed spelling errors

* disabled typecheck

* Enabled typecheck

* remove binary

* Deleting lib binary

* adding more linters

* fixed constants

* fix spelling

* fixed all lint issues

* Revert "Changing travis configuration"

This reverts commit 334afe9d05e96261b01f275aa3ada20e7f36aac4.

* Merge branch 'master' of https://github.com/prysmaticlabs/prysm into update-linter

* Changed from Infof to Info

* Fixing commits

* fixing commits with linter config

* added install

* Fixing

* fix log statement
2019-04-26 14:24:01 +08:00
Raul Jordan
2318a53fa5
Lock Down the ReceiveBlock Function (#2387)
* lock down receive block

* imports
2019-04-25 23:06:16 -05:00
Raul Jordan
538d7ec07c Prevent Fetching Head State Many Times in Requesting Latest Attestation (#2374) 2019-04-25 09:44:35 -07:00
terence tsao
b81eeec374 Optimize block fetch with attestation target fetch (#2373)
* 1st attemp to optimize blk fetch w/ att tgt fetch

* test test test test
2019-04-24 12:21:00 -05:00
Nishant Das
54f6fffb58 Batch Attestations in Attestation Service (#2370)
* fix state reads

* add method to retrieve validator from state

* lint

* batch update attestation

* handle nil case

* add test

* lint

* batch update attestation
2019-04-24 09:28:52 -05:00
shayzluf
6c1740eefc Add Caching to Tree Hashing Algorithm (#1929)
* added todo to hash file in ssz

* params and copy of block cache

* start hash cache

* Hash cache implementation

* fixed some comments

* fixed promatheus duplicate counter name

* removed TODO

* change to use special expiration cache

* function name fixes junk object generator

* naming changes

* gazzle fix

* added pruning last read data test

* fixed gometallinter errors

* fix benchmarks and no int64 not serializable

* move struct from test

* add feature flag

* fix merge issues

* add featureflag to beacon and validator

* featureflag init for tests

* added feature flag to all ssz dependent tests

* remove setter func

* replace k8s tweaked expiration cache to https://github.com/karlseguin/ccache

* remove else

* change request by preston

* added init featureflags to genesis_test

* Update shared/ssz/hash_cache.go

add dot

Co-Authored-By: shayzluf <thezluf@gmail.com>

* Update shared/ssz/hash_cache.go

Co-Authored-By: shayzluf <thezluf@gmail.com>

* Update shared/ssz/hash_cache.go

remove extra space

Co-Authored-By: shayzluf <thezluf@gmail.com>

* Update shared/params/config.go

add dot

Co-Authored-By: shayzluf <thezluf@gmail.com>

* Update shared/featureconfig/config.go

remove dot

Co-Authored-By: shayzluf <thezluf@gmail.com>

* Update shared/featureconfig/config.go

remove dot

Co-Authored-By: shayzluf <thezluf@gmail.com>

* remove powchain from prometheus hash cache name

* fixes fron change requests

* fix change requests

* remove faulty merge test

* gazelle fix

* fix fmt.sprintf

* remove debug binary

* fix gazelle
2019-04-24 13:39:02 +08:00
Raul Jordan
e36714805a
Enable Ancestor Cache By Default (#2358)
* remove ancestor cache flag

* ancestor cache on by default
2019-04-23 13:15:58 -05:00
Raul Jordan
2d8dd203f1
Optimize LMD-GHOST Vote Counting (#2333)
* use att targets

* risky head request

* timing lmd

* fixed ancestor cache hits

* tests pass

* comment on func

* advance state transition

* advance N empty state transitions

* imports

* imports

* use risky head state

* use validator registry

* revert timing

* imports
2019-04-22 19:59:02 -05:00
Raul Jordan
1df15f72c4
Ensure Block Processing Failures Return an Error (#2325)
* ensure block failed processing returns an error

* fixed test

* test assertion corrected

* comments

* fix tests

* imports
2019-04-21 17:38:14 -05:00
Nishant Das
2af49b5c55 Fix Assingments Bug (#2320)
* fix

* fix tests
2019-04-21 11:47:53 -05:00
Nishant Das
0499da2b95 Only Update Head of Chain with Child Blocks (#2310)
* change block child loop

* remove redundant hashing

* wrap in conditional

* gazelle

* fix test
2019-04-20 10:17:08 -05:00
terence tsao
1602c5d0c5
Use Withfields for Logging (#2305)
* use with fields

* gaz
2019-04-19 21:09:01 -07:00
terence tsao
cc730d17af Optimize Counting Target Votes using Ancestor Cache (#2279)
* use committee cache in UpdateLatestAttestation

* fmt

* gaz

* fixed existing tests

* verify cache miss works

* gaz

* added test for committee hit and update attestation target

* verify cache miss works

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

Co-Authored-By: terenc3t <terence@prysmaticlabs.com>

* rm declaring err

* add feature flag

* fork choice vote count to use cached ancestor

* comments

* fmt

* spelling and grammer

* no extra space

* renamed vars & added a test for cache miss

* lint

* add cache hit test case : )

* gaz

* Remove Enableblock, it was a copy/paste typo

* refactor cached ancestor blk getter into its own function
2019-04-18 22:26:22 -05:00
Raul Jordan
63549e9db9
Blacklist Bad Block Hashes (#2297)
* prevent blacklisted block hashes

* comments

* test passing blacklisted blocks

* bad blocks prom counter

* Update beacon-chain/sync/receive_block.go

Co-Authored-By: rauljordan <raul@prysmaticlabs.com>

* Update beacon-chain/db/block.go

Co-Authored-By: rauljordan <raul@prysmaticlabs.com>

* fix test
2019-04-18 16:57:19 -05:00
Preston Van Loon
2018d882f1 Handle error (#2296) 2019-04-18 13:37:50 -07:00
Raul Jordan
ffdc16a304
Use Parent State When Processing Blocks (#2291)
* parent fork fix

* tests
2019-04-18 12:40:46 -05:00
terence tsao
a9da23f444 Proposer Server Filters Attestation by Canonical (#2271)
* filter attestations by canonical

* fix test

* added mutex

* fixed rpc tests

* forgot to init map, all existing tests passing

* added test for filter non-canonical atts

* lint
2019-04-16 13:19:31 -05:00
Raul Jordan
3e525ebe8b
Block Deletion Upon Block State Transition Error (#2270)
* block deletion upon block state transition error

* include tests

* tests complete

* comment

* imports spacing
2019-04-16 13:06:53 -05:00
Ivan Martinez
62279489a3 Add deposit index to beacon state (#2232)
* Begin adding Deposit Index to beacon state

* Move deposit index increment to ProcessDeposit

* Fix initial deposits bug

* Fix bug in RPC

* More bug fixes

* Fix RPC bug, ensure deposits are processed in the right order

* Fix tests

* Fix merge

* Attempt to fix pruning deposits on regular sync

* Fix pending deposits on node restart

* Fix test

* Fix tests properly

* Gofmt

* Remove unneeded logs

* Fix build
2019-04-14 18:17:39 +10:00
Nishant Das
98042c613d
Update State to Include Current and Previous Justified Roots (#2186)
* update protos

* Revert "Use DB to Fetch Justified Block (#2172)"

This reverts commit 60c254d818.

* use justified root and previous justified root across the repo

* change attester server to use state justified root

* remove commented code

* fix build issues

* fix test

* fix all tests

* fix merge issues
2019-04-10 14:52:06 +08:00
skillful-alex
9165706805 Verify State Root in Block Processing (#1964)
* Verify State Root in Block Processing

* separated tests

* try to fix the goimports

* fix unit test error

* goimports

* fix merge error

* deleted commented lines of code

* formating

* Update block_processing_test.go

* fix merge error

* fix more merge error

* fix language error in comment
2019-04-10 02:30:17 -04:00
terence tsao
83e5492e55 Save State during Init Genesis State (#2193)
* added spans and save state during init state

* fix other svcs

* tests

* Delete saving hist state
2019-04-09 15:06:23 -04:00
Nishant Das
1ff3d7ea66 add fix (#2221) 2019-04-09 14:43:29 -04:00
terence tsao
97b5ef0cc2
remove unused funcs and vars (#2214) 2019-04-08 16:29:02 +10:00
Preston Van Loon
97b184e5c7
Historical pruning by flag only (#2210)
* add flag

* use flag

* fixes
2019-04-07 22:46:55 -04:00
Raul Jordan
3704126533
Improve Beacon Node Logging (#2175)
* improve beacon node logging

* better info logging

* much nicer balance logging

* lint

* tests
2019-04-05 22:37:46 -05:00
Preston Van Loon
c925632cc9
Add a span to block-by-slot (#2184)
* Add a span to block-by-slot

* /goroutinez
2019-04-05 19:19:27 -05:00
Raul Jordan
60c254d818
Use DB to Fetch Justified Block (#2172)
* builds

* db tests in core

* spacing

* Gazelle

* fix lint

* iterative block root loop

* Update beacon-chain/core/blocks/block_operations_test.go

Co-Authored-By: rauljordan <raul@prysmaticlabs.com>

* imports
2019-04-05 14:48:49 -05:00
terence tsao
a19f08f7b6 Attestation Using Head State instead of Latest State (#2156)
* headRoot is a better name

* yay merged with master

* fixed attester server returning incorrect attestation field values

* revert stupid mock changes

* fixed and updated all the tests

* uncomment

* head start should handle skip blocks

* Raul's feedback
2019-04-05 09:41:49 -05:00
Preston Van Loon
83130358a9
Rollback state to handle side chain with skip blocks (#2147)
* Add initial test

* chkpt

* add failing test

* add span to historical state lookup

* use db.HighestBlockSlot()

* fix comment

* update comment

* i wrote a test like a good programmer.

* add test back

* add assertion and unskip test, something new failing tho

* trying to fix test

* remove -1, not sure if i need it yet

* Revert "remove -1, not sure if i need it yet"

This reverts commit 2cfcbb8108b28bb3d7135a993d9053150d5f1e6e.

* save historical state on every save state

* fix hsitorical states

* set historical state in initialize state

* change to a bool

* fix error with empty retrieval of states

* Add missing import

* fix test

* lock in receive block

* remove state generator

* Revert "lock in receive block"

This reverts commit 151b10829d70b2dad3055a8db36d0e1269a853f2.

* Fix Initial Sync Not Processing Canonical Block to Produce Canonical State (#2152)

* fix init sync

* fatal if highest observed root does not match

* proto fields

* Update beacon-chain/sync/initial-sync/service.go

* confirm canonical state root

* fix most tests

* failing test

* fix PR tests

* lint

* no simbackend changes

* logf revert

* add todo

* fix off by one

* fix test with deleted property

* merge #2157

* passing tests :)
2019-04-04 22:39:51 -05:00
Preston Van Loon
40ade64ffa
don't use c.ctx, use argument ctx instead (#2157) 2019-04-04 08:30:23 -05:00
Preston Van Loon
252b2ec3e5 Use db.HighestBlockSlot() for fork choice children reading (#2150)
* use db.HighestBlockSlot()

* fix comment

* update comment

* i wrote a test like a good programmer.
2019-04-03 10:32:59 -05:00
Raul Jordan
eb900a8193
Refactor Initial Sync, Enable Catching Up to Chain (#2111)
* refactor initial sync to prevent reorg infinite loops

* lint

* fixed build

* passing tests

* tests passing

* terence suggestion

* new attempt

* clean up and refactor sync service

* complete the new initial sync logic

* revert head

* init sync working

* config for blockchain receive block

* all works

* builds

* fix a few more tests

* init sync tests pass

* revert scripts

* revert accounts changes

* lint

* lint2

* travis lint

* fix build

* fix single use argument

* any peer

* imports spacing

* imports

* ready for a rolling restart

* add todo

* fork choice in blocks when exiting sync

* readd finalized state root to requests

* successful build

* revert blockchain config

* old config reversion

* initial sync tests pass

* initial sync full test works

* lint

* use the new block processing api

* new proto defs

* init sync functions again

* remove sync polling

* tests fixed

* fixed catching up with chain

* tests pass

* spacing

* lint

* goimports

* add changes

* add lock and conditional to prevent multiple goroutines

* make reg sync synchronous

* add

* fixed the parent block issue

* fix errors in chain service

* tests pass

* check nil block

* typo

* fix nil state

* merge & conflicts

* revert synchronus reg sync

* add more spans to state db

* fix lint

* lint
2019-04-03 10:13:19 -05:00
terence tsao
fa063c85ca
Remove unused service fields (#2139) 2019-04-03 07:59:18 -07:00
terence tsao
1a6d2e0114
Efficient logging for attestations (#2146) 2019-04-02 09:54:13 -07:00