Commit Graph

167 Commits

Author SHA1 Message Date
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
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
Raul Jordan
a4ea0a1eac
Disable Crosslinks for Testnet (#2075)
* disable crosslinks for testnet

* feature config

* add missing flag

* flag in tests

* fix tests
2019-03-26 10:40:55 -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
Preston Van Loon
58a13a2eb7 Use imported interfaces in sync package (#2032)
* Fix spans in regular_sync

* more regular sync ctx fixes

* rename

* use more imported interfaces

* add godoc comments
2019-03-19 17:07:49 -06:00
terence tsao
7f5b6eb3fc
Update FFG Check Points During Block Processing (#2006) 2019-03-19 10:16:17 -07: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
f1d77a816e Revert "Update FFG Check Points During Block Processing (#1991)" (#1998)
This reverts commit b1ffc693e0.
2019-03-14 16:05:31 -07:00
terence tsao
b1ffc693e0 Update FFG Check Points During Block Processing (#1991)
* update FFG check points in service

* where do stategenerators go?

* commented out state_generator_test for now

* moved state generator back to appropiate location

* fixed block processing with state generator

* fmt

* import circle bad commit

* fix

* taking preston's fix

* gaz

* save justified/finalized objs during beacon chain init
2019-03-14 11:22:05 -04:00
terence tsao
e5f66d0b21
Revert "Update FFG Check Points During Block Processing (#1982)" (#1987)
This reverts commit 2c805b731d.
2019-03-13 21:48:54 -07:00
terence tsao
2c805b731d Update FFG Check Points During Block Processing (#1982)
* update FFG check points in service

* where do stategenerators go?

* commented out state_generator_test for now

* moved state generator back to appropiate location

* fixed block processing with state generator

* fmt

* import circle bad commit

* fix

* taking preston's fix

* gaz
2019-03-14 00:22:47 -04: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
Ivan Martinez
84b7c3654b Rename forkutils -> forkutil (#1976) 2019-03-12 16:39:13 -07:00
Nishant Das
028506e7ed Handle Panics in Remaining Services (#1926)
* add recovery for initial sync

* add recovery for rpc

* adding to other services

* remaining services and tests

* fix test

* remove changes to rpc

* handle powchain

* handle in powchain

* abstract to shared package

* gazelle

* lint

* remove for operations

* add in more for operations

* travis

* fix lint
2019-03-10 17:53:28 -05:00
terence tsao
936c4dde77
Implement AttestationTargets for ForkChoice (#1912) 2019-03-06 15:03:52 -06:00
terence tsao
dd40320a1c Save and Delete Validators Pubkey - Idx Post Chainstart (#1873)
* starting tests

* added tests

* fixed comments

* gaz

* make sure key is using EntryExitEffectEpoch
2019-03-05 15:22:15 +08:00
Raul Jordan
20803b4c9d
Revert Usage of ssz.TreeHash Across Repo (#1711)
* revert using ssz.TreeHash

* gazelle
2019-02-25 21:42:31 -06:00
Raul Jordan
19abe81472
Implement Randao Reveal Signing in Proposer Client (#1650)
* finish the BLS API wrapper

* all tests passing

* unexported comment

* gofmt tests for bls

* block processing test into own package to avoid cycle

* randao tests pass

* blocks test passing

* use common deposit generator

* helper

* resolved import cycle

* setup initial

* builds

* almost done with blockchain tests

* fix blockchain tests

* getting through with chaintests

* revert client change

* lint

* sync master conflict gazelle

* randao test fixes

* randao proposer impl

* tests pass
2019-02-20 12:58:34 -06:00
Raul Jordan
b0f5324303
Implement BLS Based RANDAO (#1633)
* finish the BLS API wrapper

* all tests passing

* unexported comment

* gofmt tests for bls

* block processing test into own package to avoid cycle

* randao tests pass

* blocks test passing

* use common deposit generator

* helper

* resolved import cycle

* setup initial

* builds

* almost done with blockchain tests

* fix blockchain tests

* getting through with chaintests

* revert client change

* lint

* sync master conflict gazelle

* randao test fixes
2019-02-19 23:07:28 -06:00
terence tsao
9f64ee7ecf
Remove Processed Block Operations from DB (#1626) 2019-02-18 15:34:49 -08:00
Raul Jordan
ae13bb5c83
Use Tree Hashing Algorithm Everywhere for Block Roots and State Root (#1577)
* begin using tree hash instead of hash for state and blocks

* replace with ssz

* rem references to vote cache

* replace all instances of state/block hash with root

* goimports

* almost every test in the world fails

* goimports

* all tests pass, tree hash across repo
2019-02-14 14:04:47 -06:00
terence tsao
59e5e59300
Update Fork Choice to Use Balance (#1564) 2019-02-13 23:13:00 +00:00
Preston Van Loon
b0b55e8d1d
Remove pending deposits after receiving a processed block (#1530)
* Remove pending deposits after receiving a processed block

* Abstract createDeposit

* fix test

* Rename helper for clarity

* MaxDepositAmount
2019-02-09 09:07:30 -05:00
terence tsao
21ac564631
Aligning ETH2.0 spec - Make Epoch First Citizen (Package: Validators) (#1460) 2019-02-04 21:34:33 +01:00
Raul Jordan
cec6c8de83 Standardize Naming of Shared Packages, Remove Deprecated Packages (#1435)
* rem txpool

* standardize repo shared utils, remove deprecated items

* complete

* package lvl godoc
2019-01-31 10:53:58 +08:00
Raul Jordan
f89fce9bd7
Implement Basic LMD Ghost Fork Choice Skeleton + Helper Funcs (#1310)
* add fork choice helpers

* LMD GHOST basic implementation

* add todos

* add in the initial test and finalize rest of functions

* added tests

* more simulation, adding trivial case with only one option for a head

* panics

* begin helper function tests

* more helper tests

* higher vote wins

* LMD Ghost full test

* comment

* add types

* optimize

* prepared

* deposits for chain

* lint

* use the hash beacon block util

* rem unnecessary db methods

* comments

* setup works
2019-01-19 10:57:51 +08:00
Preston Van Loon
592c5c3d92 Refactor hashing of beaconblock to shared (#1315)
* Add beacon block hash function

* Refactor/remove old hash method

* gazelle
2019-01-15 00:41:20 +08:00
Andrei Ivasko
b29188128d ToBytes32 (#1306) 2019-01-13 09:04:14 -05:00
Raul Jordan
5d26efcfaa
Deprecate types.BeaconState with pb.BeaconState Generated Proto (#1164) 2018-12-23 16:51:04 -06:00
Raul Jordan
e49a190754
Replace Types of Block Primitives With Proto Generated Types (#1137)
* refactor repo to use protos

* removed block successfully in types

* db package updated

* db, core passing

* chain service done

* no more block instances

* all pass

* deprecate all block protos

* tests pass
2018-12-20 17:00:38 -05:00
Raul Jordan
6125c304ba
Remove Deprecated Spec Logic (#1138)
* no more deprecated stuff

* remove incentive functions

* rem deprecated

* remove funcs
2018-12-19 20:45:21 -05:00
Nishant Das
e92032346f Partial Implementation of the Slot Processing Routine (#1083) 2018-12-19 00:18:42 -05:00
Raul Jordan
a99de08562
Merge Active/Cystallized State (#1019) 2018-12-01 16:09:12 -06:00
terence tsao
391eacd1d7
Refactor Casper Validators Into Core/Validators Stateless Package (#875) 2018-11-20 22:44:04 -08:00
Raul Jordan
f6c1864d6d
Cleanup of Miscellaneous Items Around the Repo (#790) 2018-11-16 12:01:41 -05:00
Jie Hou
0de655eaab Move BlockVoteCache out of ActiveState (#739) 2018-11-11 08:54:17 -08:00
Raul Jordan
6476fb54af
Dynamic Chain Test Language Package With YAML Parser (#681) 2018-11-07 14:07:41 -05:00
Yutaro Mori
4c5099c8ba Miscellaneous Cleanup Around Block Processing Logic (#684)
* Cleanup code around block processing

* gazelle

* gofmt
2018-10-22 16:04:17 -05:00
Yutaro Mori
c00a1d3132 Replace LevelDB with Bolt (#666) 2018-10-17 01:11:24 -05:00
Yutaro Mori
8bffae1316 Various cleanup and bugfixes around validator/RBC interaction (#657) 2018-10-14 10:29:57 -05:00
Yutaro Mori
724ae3c999 Implement Precise Ticker For Slot Interval (#635) 2018-10-10 11:17:48 -05:00
Yutaro Mori
3e8a450e0f Fix Flaky Tests (#636) 2018-10-09 10:52:20 -05:00
Yutaro Mori
ce99bd7605 Refactor to Create DB Package (#582) 2018-10-05 13:14:50 -04:00
Preston Van Loon
8bcddf5fdc
Migrate dependencies on @com_github_ethereum_go_ethereum//event (#601)
* Add go-ethereum's event and

* remove swp file

* goimports

* remove unused code

* fix gazelle
2018-10-02 21:49:01 -04:00
Raul Jordan
e10baf7c80
Validator Assignment RPC Beacon Node Stream (#563) 2018-09-26 21:34:35 -05:00
Raul Jordan
4bc2176898
Refactor Block Processing + UpdateHead to Use Slot Numbers (#474) 2018-09-18 09:06:28 -04:00
Yutaro Mori
f312c013fc beacon-chain: Refactor Beacon Chain To Simplify Block Processing (#473) 2018-09-11 07:09:41 +02:00
Nishant Das
4891f68929
Persist Blocks and State in DB (#440)
* Persist Dag

* Add schema

* Add new message

* add mapping

* Adding check to save block

* Removing blocks mapping

* Make changes to block processing

* Change from mapping to a slice of hashes

* Adding tests to core

* adding more tests

* Fixing service test

* Add comments and fix bazel

* fix lint

* fix conflicts

* addressing review comments

* Removing references to active

* fixing tests with active state

* Protytype for #440: Persist blocks and latest state in DB

* simplify code

* removing block registry

* fix test

* adding block removal/iterator

* Addressing review comments

* Addressing comments

* removing extra line

* making vars private and adding canonical key

* fix lint

* splitting methods

* adding more changes

* lint

* improving coverage

* removing decodeslotnumber

* gazelle

* remove todos

* addressing preston's comments

* remove slotnumber

* lint
2018-09-03 00:44:03 +08:00
terence tsao
366e5168ba
Initialize New Cycle during Block Processing (#443) 2018-08-29 16:21:15 -07:00
terence tsao
1598ae8605
Part 3 of Aligning Beacon Chain with Latest 2.1 - Processing Attestations (#423) 2018-08-24 09:07:23 -07:00
Raul Jordan
4a1b5db07b
beacon: Store Incoming Blocks and Calculated States in DAG (#422)
* begin with a block/state dag approach in prep for fork choice

* add TODOs for fork choice items, add data structure for forks

* remove syncing and processing states for incoming block sync

* simulator only broadcasts blocks now, no more state simulation

* fix sim tests, no more state sim

* bazel rerun

* naive fork choice

* split update head routine

* pesky race conditions

* fork choice rule works

* dag + fork choice working

* canonical head storage across sessions

* todo: save dag

* no more stalling after 10 blocks, using event feeds

* address review

* sync instead uses event feed

* refactored pure funcs into casper package

* tests pass

* fix lint

* refactor get blockhash

* refactor blockhashforslot

* event feed for incoming blocks in chainservice

* use config

* addressed all comments

* fix typo

* address yutaro comment

* using db interface

* check if parent hash in previous slot DAG

* works

* tests

* drop ffg suffix

* bazel gazelle

* full cov validators by height shard

* gazelle

* state tests

* all state tests

* 100% cov types and 99% cover casper

* cov up

* 80% blockchain cov

* fix lint
2018-08-23 22:09:59 -06:00
Raul Jordan
d3b5a7c67b
beacon: Implement Beacon Node gRPC Server Streams (#400)
* remove client helper in internal

* tidying up the sharding client project

* update all docs

* implementing beacon rpc server methods

* address prs

* begin coverage

* regen proto

* include announcement chans

* tests pass, announcing as canonical only after block has passed all processing

* system functioning yay

* tests pass

* bootstrap validators

* default balance params

* fix lint

* fix all tests

* increasing cov

* 100% test cov rpc

* build file for internal

* typo

* graceful stop

* merge with Terence's PR

* address review comments

* fixed blockchain tests and lint

* added ethdb

* persists last simulated session

* cov

* ready

* fix lint

* fix cov tests

* fix lint

* config options for args

* fix lint

* lint fix
2018-08-17 21:34:56 -06:00
terence tsao
b7bf48bc3e Fixed NewSimulatedBackend (#405)
* sync functions for active and crystallized states

* make pb structure more semantic

* use run func to consolidate to one main routine

* remove mainchain package

* remove smc. yay!

* fixed NewSimulatedBackend

* added smc tests back

* race = off

* used latest commit from bazel-go-ethereum

* changed testoutput to all

* output test.log after failure

* disable race

* restore travis config to original state, add race=off to blockchain workspace

* added issue number and fixed typo
2018-08-16 15:37:53 -06:00
terence tsao
06ca8e758f beacon: Improve Test Coverage for Beacon Chain Package (#402) 2018-08-14 22:49:59 -06:00
Ivan Martinez
4976461e62 Implement GenesisBlock() to Grab the Block from Memory DB (#373)
* Fix odd placement of import

* Puts all of NewGenesisBlock() into GenesisBlock() 

Also removes the unneeded TODO

* Add error check for db retrieval

* Add missing bazel imports

* Add back NewGenesisBlock and create GenesisBlock in NewBeaconChian

* Fix GenesisBlock() to grab the block from memory db

* Fix according to requested changes

Fix GenesisBlock() to grab the block from memory db
Fix odd placement of import


Properly add ParentHash to Block


Remove no longer needed if statement condition


Puts all of NewGenesisBlock() into GenesisBlock() 

Also removes the unneeded TODO
Add error check for db retrieval


Add case for if the beaconChain is missing a genesisBlock


Add missing bazel imports


Add back NewGenesisBlock and create GenesisBlock in NewBeaconChian


Remove duplicate code


Change genesis block timestamp to unix 0


Adds info log when a genesis block isn't found

* Provide fakeClock to pass tests with a mocked genesisBlock

* Fix unexpected log in test from addition of genesis block

* Add tests for clock
2018-08-12 22:07:37 -04:00
Raul Jordan
13a011ce5f
proto: Structure Protos for Beacon and for Sharding (#359) 2018-07-31 13:54:45 -05:00
terence tsao
9b1966374a
Part 2 of State Sync - Active State Proto Struct (#355) 2018-07-30 18:13:25 -07:00
terence tsao
33c56092ad beacon: Part 1 of State Sync - Crystallized State Proto Struct (#354) 2018-07-30 19:29:40 -05:00
Yutaro Mori
9c9aef8194
Eliminate test only methods on types.Block (#350) 2018-07-31 00:45:44 +09:00
Yutaro Mori
f9d23da2dd Decouple Database From the ServiceRegistry (#335) 2018-07-29 23:14:50 -07:00
terence tsao
b1c47ab83a
Implement Validator Clean Up for Dynasty Transition (#329) 2018-07-26 11:20:55 -07:00
terence tsao
c0b4503d5f beacon: Check State Hashes while Processing Incoming Blocks (#319) 2018-07-24 16:09:04 -05:00
Raul Jordan
d46f1f6502
beacon: Block Processing Validity Conditions (#310) 2018-07-23 12:54:41 -04:00
terence tsao
3abfb77b87
Outline for Active State Transition Function (#309) 2018-07-22 13:00:10 -04:00
Raul Jordan
59fc2e13e7 client: Fix P2P Linter Error (#307)
Former-commit-id: 5f673dffed4267c1aca8ebfb4fe182798b9b2d2a [formerly 3fd494231ba5a350ab59a86fcf60ae9f56f1da00]
Former-commit-id: 1506dd418121884a8c7a727f8cf03c12e4c93cc3
2018-07-21 12:20:00 -05:00
Raul Jordan
92af8bc351 Rename Entire Project to Repo, Change Import Paths and Readmes (#298)
Former-commit-id: b7b8bbd10777012ae6f7d30eb6b05c3b1c3ec5d3 [formerly 06e1112fa0e1092a7137186d3a386972daa2effe]
Former-commit-id: ff2bc760c9dafb6250f056606eb2cbf96b6afa5b
2018-07-20 16:31:26 -05:00
Raul Jordan
4d5d229f0f beacon: Define a Core Blockchain Package and Persisted Structure for Beacon (#278)
Former-commit-id: bbd5b46e7f64f762350d6fb496492207e70d7130 [formerly 43a37f7139b7d1d90f0c27a7406b63bdf390ad96]
Former-commit-id: bb7a2ff0a7619f8de0bd38cd2c9eb0de7c189edb
2018-07-19 11:31:50 -05:00