Commit Graph

184 Commits

Author SHA1 Message Date
terence tsao
e51c2e5540 Use VerifyAttestation to Filter Attestation (#2281)
* use verify attestation to filter and tests

* fmt

* preston's feedback

* warn -> error

* Use WithError

* use WithError and Warn

* lint
2019-04-17 18:10:55 -05:00
terence tsao
8a6b55e93c
test attestations are equal (#2274) 2019-04-16 17:09:31 -07: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
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
Raul Jordan
249ec8751b Revert "Implement Cache Committee for RPC Server (#2151)" (#2227) 2019-04-11 07:50:01 +10:00
terence tsao
c2deace3f4 Implement Cache Committee for RPC Server (#2151)
* add committees cache

* Hook committee cache to rpc service

* fixed TestCommitteeAssignment_OK

* comments for ValidatorAssignment

* added tests for committees cache

* more updates to committee_cache_test.go

* new tests in validator_Server_test for cached/uncached scenearios

* removed ????

* gaz

* fmt

* added feature flags

* fmt

* remove hello

* uncomment

* lint

* Update beacon-chain/rpc/validator_server.go

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

* preseton's feedback

* better err handling

* fixed tests
2019-04-10 03:36:49 -04: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
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
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
674074cd16 Handle skip blocks when fetching justified block for producing attestations (#2174)
* recursive get !nil blocks

* update test
2019-04-05 14:15:08 -05:00
Preston Van Loon
d7488b9a1e
Support multiple pubkeys for committee assignments (#2164)
* support multiple pubkeys

* a bit of refactoring to avoid calling db.state multiple times

* Add test for supporting multiple keys

* rename proto field
2019-04-05 10:10:13 -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
92eeed4c05
Handle skip blocks when fetching justified block for producing attestations (#2160)
* Use DB for fetching justified state

* enhance test
2019-04-04 15:56:20 -05:00
Preston Van Loon
cdab78e979 Look up justified state from database rather than state block roots (#2154)
* failing test

* passing test
2019-04-03 17:50:35 -05:00
terence tsao
fa063c85ca
Remove unused service fields (#2139) 2019-04-03 07:59:18 -07:00
Preston Van Loon
76e30200fe Pass ctx to saveState (#2141)
* pass ctx to saveState

* add span
2019-04-02 16:49:45 +08:00
Nishant Das
c8611954f0 remove field (#2136) 2019-03-31 23:04:06 -05:00
terence tsao
142047ec03
limit deposits allowed in block & tests (#2122) 2019-03-31 19:47:38 -07:00
Raul Jordan
7489e52b99
Refactor Chain Service Block Processing API (#2124)
* new block processing api

* fix tests

* lint

* spacing

* Update beacon-chain/blockchain/block_processing.go

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

* fix tests, remove enable powchain
2019-03-31 20:44:16 -05:00
Ivan Martinez
365a06e709 Fix multiple deposits to the same pubkey pre-chain-start (#2030) 2019-03-28 20:44:27 -07:00
terence tsao
64508dc3c3
fixed ActiveValidatorIndices for ValidatorPerformance (#2103) 2019-03-28 14:37:59 -07:00
Raul Jordan
839845645c
Request Assignments From Canonical Slot Upon Activation (#2097)
* request assignments from the canonical head slot at first

* imports
2019-03-27 20:03:25 -05:00
Preston Van Loon
030f44bb04 Revert "Treat Post & Pre-ChainStart Validators Equally in Assignments Fetching (#2074)" (#2086)
This reverts commit fcc18fac02.
2019-03-26 22:30:22 -05:00
Preston Van Loon
7420fac5fc
Add gRPC prometheus middleware (#2077) 2019-03-26 11:26:47 -05:00
Raul Jordan
fcc18fac02
Treat Post & Pre-ChainStart Validators Equally in Assignments Fetching (#2074)
* treat post/prechainstart validators equally in assignment fetching

* Update validator/client/fake_validator_test.go

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

* status err code

* imports

* beyond activation epoch

* assigned to slot log

* gazelle
2019-03-26 09:03:05 -05:00
Raul Jordan
053038446c
Allow 8 Validator Multinode Cluster to Run Indefinitely (#2050)
* plug forkchoice to blockchain service's block processing

* fixed tests

* more fixes...

* clean ups

* fixed test

* Update beacon-chain/blockchain/block_processing.go

* merged with 2006 and started fixing tests

* remove prints

* fixed tests

* lint

* include ops service

* if there's a skip slot, slot--

* fixed typo

* started working on test

* no fork choice in propose

* bleh, need to fix state generator first

* state gen takes input slot

* feedback

* fixed tests

* preston's feedback

* fmt

* removed extra logging

* add more logs

* fixed validator attest

* builds

* fixed save block

* children fix

* removed verbose logs

* fix fork choice

* right logs

* Add Prometheus Counter for Reorg (#2051)

* fetch every slot (#2052)

* test Fixes

* lint

* only regenerate state if there was a reorg

* better logging

* fixed seed

* better logging

* process skip slots in assignment requests

* fix lint

* disable state root computation

* filter attestations in regular sync

* log important items

* better info logs

* added spans to stategen

* span in stategen

* set validator deadline

* randao stuff

* disable sig verify

* lint

* lint

* save only using historical states

* use new goroutine for handling sync messages

* change default buffer sizes

* better p2p

* rem some useless logs

* lint

* sync tests complete

* complete tests

* tests fixed

* lint

* fix flakey att service

* PR feedback

* undo k8s changes

* Update beacon-chain/blockchain/block_processing.go

* Update beacon-chain/sync/regular_sync.go

* Add feature flag to enable compute state root

* add comment

* gazelle lint fix
2019-03-25 10:21:21 -05:00
shayzluf
6335833c94 Validator: performing for multiple keys - update rpc proto (#2040)
* first version - broken

* Scripts to update mockgen

* working proto changes

* resolve review remarks

* fix goimport issues
2019-03-23 19:46:25 -05:00
Preston Van Loon
83b00369b4 add regression test (#2046) 2019-03-20 15:19:48 -07:00
Preston Van Loon
f44c7082d8
Prevent invalid pending attestations (#1994)
* prevent invalid pending attestations

* no past block

* regress test

* +1

* fix lint

* fix buld

* revert unrelated

* passing tests, still need regression tst
2019-03-19 12:25:34 -04:00
Raul Jordan
7a83acf46d
Improve Validator Logging and Default Flags (#2013)
* improve validator logging significantly

* warn validator not yet assigned to epoch

* build added

* report validator logs

* validator performance logging

* all logging improvements

* validator attest better logs

* improved attester logging

* average balances

* dont hash useless hashes

* Update validator/client/validator_propose.go

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

* address some comments

* standardize with block root hash32, renamings

* gazelle

* builds

* improve average eth balance

* eth net gains/losses

* fix tests

* spacing

* goimports

* avg balance

* update pbs

* addressed preston comments

* imports

* gazelle
2019-03-18 09:45:28 -06:00
Raul Jordan
a98912ea58
State Transition Configuration Options (#2023)
* logging config options

* tests pass

* better naming

* log proposer idx instead of sig

* log avg balance
2019-03-18 00:19:44 -06:00
Preston Van Loon
612bb38077 Cross p2p spans, more spans, synchronous attestations, minor fixes (#2009)
* Fix assignments bug where validators don't retry for assignments on failure

* synch only please

* trying to fix state issues

* trying random stuff

* do not explode

* use ctx

* working build, failing tests

* broadcast local addrs as well as relay addrs

* fixed p2p tests, more tests to fix still

* another test fixed, log warning instead of throw error

* Fix last tests

* godoc

* add test for broadcast in apply fork choiec

* remove unneeded code

* remove tracer adapter, not needed

* remove extra stuff

* remove any

* revert addr_factory

* revert addr_factory

* Revert "revert addr_factory"

This reverts commit e93fb706494a1070158b8db31e67146d6b0648ad.

* Revert "revert addr_factory"

This reverts commit dedaa405559cc818698870c4e4570953367f1e3c.

* revert removal of this code

* unused param
2019-03-17 10:56:05 +08:00
Raul Jordan
5371218b9b
Refactor ChainService for Receiving Blocks Synchronously (#1984)
* refactor chain service

* restructure service and lint

* all calls to receive block in chain service are now blocking

* begin fixing tests

* refactored blockchain tests

* builds correctly

* blockchain tests pass again

* lint

* sync and rpc tests pass again

* done

* add in open tracing

* span in fork choice

* Update beacon-chain/blockchain/block_processing.go

Co-Authored-By: rauljordan <raul@prysmaticlabs.com>
2019-03-13 17:17:32 -04:00
Raul Jordan
c1a9937760
Post ChainStart Validator Activation (#1934)
* implemented all the merkle func signatures

* branch indices complete

* check for index out of range in generating merkle proof

* completed full tests for sparse merkle trie impl

* lint

* formatting

* gazelle

* commentary

* ivan comments

* fmt

* get rid of the deposit trie

* recalculate trie when eth1 data changes

* default data response recalculates tree

* update merkle trie to use raw bytes

* use the new verify merkle root func

* builds

* if default data response historical deposits are empty, return the deposit root at the contract at the time

* work on trie

* trying again with more logging

* keep track of merkle trie indices, use correct big int ops

* use uint for merkle idx

* add todo

* update ticker correctly

* fix config and remove unnecessary logs

* readd plus one fix

* clarify some details

* weird imports spacing

* gazelle, lint

* fix tests using the new deposit trie

* builds but tests still fail

* rpc tests

* lint

* tests pass

* bazel lint

* rem commented block

* revert att slot fix

* preston comments

* comments

* fix build

* address last comment

* use counter

* imports
2019-03-12 00:05:55 -04:00
Preston Van Loon
bdbc572f3f Add grpc middleware to recover from panics (#1956) 2019-03-10 18:19:52 -07:00
Preston Van Loon
e4588d9be0
Revert "Create and Verify Signatures for Attestations (#1908)" (#1958)
This reverts commit 23072983ff.
2019-03-10 20:02:47 -04:00
Ivan Martinez
23072983ff Create and Verify Signatures for Attestations (#1908)
* Verify signatures of attestations

* Implement BLS Signing for attestations

* Remove custody bit 0 from the attestation for now

* Fixes tests for attestations

* Fix tests to ensure they use proper attester indice

* Run gazelle

* Goimports

* Test attestation sigs in block operations

* Change formatting and make sure signatures are actually verified

* Fix duplicate import

* Fix duplicate import from merge

* Organize attestation sig to be conssitent with codebase

* Update to comments

* Change signatures to use aggregation

* Run gazelle

* Change function to return err instead of bool
Also gofmt

* Fix for comments

* Move createAggregationSignature to a function in attestations.go
2019-03-08 15:30:01 +08:00
Raul Jordan
205594c5d6 Fix Travis Failures on Master (#1938)
* resolve travis conflicts

* cp proto

* revert

* remove unused context
2019-03-07 23:54:41 -05:00
Preston Van Loon
90225aac31 PendingAttestations: allow for request to specify a slot (#1922)
* PendingAttestations: allow for request to specify a slot

* enhance the test
2019-03-07 09:56:22 -06:00
Nishant Das
6d69ac1abd
Add State Generator (#1718)
* add finalized function

* add functions

* gazelle

* add separate package for import cycles

* main tests are passing

* add finalized state test

* add block test

* fix tests and gazelle

* lint

* build file

* remove package

* remove unecessary method

* visibility

* remove package

* comments

* final comments

* imports spacing

* goimports
2019-03-07 11:02:47 +08:00
Preston Van Loon
018f200ce9
Fix attestations again (#1916) 2019-03-06 18:59:47 -05:00
Raul Jordan
728c9fbfdc
fix the wait for activation condition (#1915) 2019-03-06 17:16:06 -06:00
Preston Van Loon
dbb519880f
Fix off by one edge case for pending attestations (#1914)
* fix off by one error

* better plus one

* lint

* fix off by one
2019-03-06 17:03:31 -06:00
Preston Van Loon
869f08ad26
Proposer Service: Only return attestations within the last epoch (#1911)
* Only return attestations within the last epoch

* make array

* rename for clarity
2019-03-06 11:54:02 -05:00
Raul Jordan
c22e4dc2ae
Wait for Validator Activation Stream Server (#1896)
* create wait for activation stream

* wait for activation server stream open

* complete server side logic

* formatting

* first test passing

* context closed test

* lint

* fix build failure

* imports

* eliminate unused cancel var
2019-03-05 17:06:50 -06:00
terence tsao
ef54152071 Add Spans for Processing Slots (#1890)
* add spans for processing slot

* gaz

* rm main
2019-03-05 14:22:09 -06:00
terence tsao
b00891880e
Implement Validator Status RPC Methods (#1839) 2019-03-03 21:28:00 -08:00
terence tsao
17682321fe
Clean Up Validator RPC Server (#1798) 2019-03-03 14:55:12 -08:00
Ivan Martinez
5aa7320507 Clear Up Code Inconsistencies (#1836) 2019-03-03 09:31:29 -08:00