Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update run time to v0.9.3 #4154

Merged
merged 180 commits into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from 148 commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
63e7173
Remove custody (#3986)
terencechain Nov 12, 2019
d69efa7
Decoy flip flop check (#3987)
terencechain Nov 13, 2019
6d1a3fa
Bounce attack check (#3989)
terencechain Nov 13, 2019
1c98fff
Conflict
terencechain Nov 13, 2019
d124627
Unskip mainnet spec tests (#3998)
terencechain Nov 13, 2019
394f5b0
Unskip minimal spec tests (#3999)
terencechain Nov 13, 2019
e825947
Unskip test (#4001)
terencechain Nov 14, 2019
dee290c
Update minimal seconds per slot to 6 (#3978)
terencechain Nov 14, 2019
8cfc3dc
Bounce attack tests (#3993)
terencechain Nov 14, 2019
936a605
Conflict
terencechain Nov 23, 2019
09f7b57
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
terencechain Nov 24, 2019
fb87f01
Conflict
terencechain Nov 24, 2019
b474c74
Fixed failed tests
terencechain Nov 24, 2019
7636ef6
Lower MinGenesisActiveValidatorCount to 16384 (#4100)
terencechain Nov 25, 2019
e1f6c69
Fork choice beacon block checks (#4107)
terencechain Nov 25, 2019
1f8bbdc
Update aggregation proto (#4121)
terencechain Nov 27, 2019
e57e0ba
Conflict
terencechain Nov 29, 2019
89bcd65
Update workspace
terencechain Nov 29, 2019
ced991b
patch
terencechain Nov 29, 2019
ea47a6b
Resolve conflict
terencechain Nov 29, 2019
16e4b17
Patch
terencechain Nov 29, 2019
d93146f
Change workspace
terencechain Nov 29, 2019
1416a82
Update ethereumapis to a forked branch at commit https://github.com/p…
prestonvanloon Nov 29, 2019
3830932
Fixed all the tests
terencechain Nov 29, 2019
5137967
Merge branch 'v0.9.2' of https://github.com/prysmaticlabs/prysm into …
terencechain Nov 30, 2019
b93fd2f
fix patch
prestonvanloon Nov 30, 2019
0a33116
Need to regenerate test data
terencechain Nov 30, 2019
1849830
Merge branch 'master' into v0.9.2
terencechain Nov 30, 2019
c815445
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
terencechain Nov 30, 2019
d2bfada
Enable snappy compression for all (#4157)
prestonvanloon Dec 1, 2019
46a2662
Validate aggregate and proof subscriber (#4159)
terencechain Dec 3, 2019
b152a99
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
terencechain Dec 4, 2019
8c806fa
Conflict
terencechain Dec 4, 2019
9be15a5
Update workspace
terencechain Dec 4, 2019
7b7d873
Conflict
terencechain Dec 4, 2019
36c47b3
Conflict
terencechain Dec 4, 2019
781e975
Conflict
terencechain Dec 4, 2019
bfeac19
Merge branch 'master' into v0.9.2
terencechain Dec 4, 2019
7e9e50a
Merge branch 'master' into v0.9.2
terencechain Dec 4, 2019
c9cb4ad
Conflict
terencechain Dec 6, 2019
7274e00
Merge branch 'v0.9.2' of https://github.com/prysmaticlabs/prysm into …
terencechain Dec 6, 2019
c68e762
Remove migrate to snappy (#4205)
terencechain Dec 6, 2019
8555ba6
Feature flag: Deprecate --prune-states, release to all (#4204)
prestonvanloon Dec 6, 2019
2bd421d
Refactoring for dynamic pubsub subscriptions for non-aggregated attes…
prestonvanloon Dec 7, 2019
b5e341d
Sync with master
terencechain Dec 8, 2019
a41bb30
Sync with master
terencechain Dec 8, 2019
8d097c0
RPC servers use attestation pool (#4223)
terencechain Dec 10, 2019
2df8790
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
terencechain Dec 11, 2019
17c6650
Refactor RPC to Fully Utilize Ethereum APIs (#4243)
rauljordan Dec 11, 2019
097c89b
Sync with master
terencechain Dec 11, 2019
5bb26a9
Merge branch 'v0.9.2' of https://github.com/prysmaticlabs/prysm into …
terencechain Dec 11, 2019
26e7b7b
Aggregate and proof subscriber (#4240)
terencechain Dec 12, 2019
64550b0
skip tests (#4275)
nisdas Dec 13, 2019
62a6123
Delete block attestations from the pool (#4241)
terencechain Dec 13, 2019
73d5f07
Initial work on voluntary exit (#4207)
mcdee Dec 13, 2019
e644dab
Fix critical proposer selection bug #4259 (#4265)
prestonvanloon Dec 17, 2019
224bbcb
Merge branch 'master' of github.com:prysmaticlabs/prysm into v0.9.2
prestonvanloon Dec 17, 2019
77536a8
Leftover merge files, oops
prestonvanloon Dec 17, 2019
aec89b9
gaz
prestonvanloon Dec 17, 2019
9375298
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 17, 2019
467c695
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 18, 2019
ea661d5
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 18, 2019
65d725f
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 18, 2019
0f981cd
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 18, 2019
d3f9110
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 18, 2019
b4667e3
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 18, 2019
f9262cc
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 18, 2019
74e508f
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 18, 2019
838ca52
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 18, 2019
53b40a5
Merge branch 'master' of https://github.com/prysmaticlabs/geth-shardi…
nisdas Dec 19, 2019
7252bbd
Fixes Duplicate Validator Bug (#4322)
nisdas Dec 19, 2019
97d1c77
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 19, 2019
f91d03c
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 19, 2019
7e1cb34
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 19, 2019
3938196
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 19, 2019
893937f
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 19, 2019
f181362
fixes after PR #4328
prestonvanloon Dec 20, 2019
718bf3d
Complete attestation pool for run time (#4286)
terencechain Dec 20, 2019
bd31949
resolve conflicts
prestonvanloon Dec 20, 2019
9bbc7b5
Merge branch 'v0.9.2' of github.com:prysmaticlabs/prysm into v0.9.2
prestonvanloon Dec 20, 2019
7ab470d
Merge branch 'master' of github.com:prysmaticlabs/prysm into v0.9.2
prestonvanloon Dec 20, 2019
2b91fe3
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 20, 2019
da887f0
Removed old protos and fixed tests (#4336)
terencechain Dec 20, 2019
f966689
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 21, 2019
65ff611
Disallow duplicated indices and test (#4339)
terencechain Dec 21, 2019
d3f6753
Explicit use of GENESIS_SLOT in fork choice (#4343)
terencechain Dec 23, 2019
5581374
Update from 2 to 3 (#4345)
terencechain Dec 23, 2019
72bf011
Remove verify unaggregated attestation when aggregating (#4347)
terencechain Dec 23, 2019
dc681bb
use slot ticker instead of run every (#4348)
prestonvanloon Dec 24, 2019
dadd0df
Add context check for unbounded loop work (#4346)
prestonvanloon Dec 24, 2019
62b17dc
Revert "Explicit use of GENESIS_SLOT in fork choice (#4343)" (#4349)
terencechain Dec 24, 2019
d4b1fc9
Refactor Powchain Service (#4306)
nisdas Dec 26, 2019
7978569
Ensure best better-justification is stored for fork choice (#4342)
terencechain Dec 26, 2019
61467b8
Ensure that epoch of attestation slot matches the target epoch (#4341)
terencechain Dec 26, 2019
f8699fe
Filter viable branches in fork choice (#4355)
terencechain Dec 26, 2019
f9d3ee0
Only activate upon finality (#4359)
terencechain Dec 26, 2019
c98a28b
Fixed failing test from 4359 (#4360)
terencechain Dec 27, 2019
dc049fb
Wait for state to be initialized at least once before running slot ti…
prestonvanloon Dec 28, 2019
1cfa522
Sync with master
terencechain Dec 28, 2019
1e27d63
Fix checkpoint root to use genesis block root (#4368)
terencechain Dec 28, 2019
00c8ae8
Return an error on nil head state in fork choice (#4369)
prestonvanloon Dec 28, 2019
7f450e5
Update metrics every epoch (#4367)
terencechain Dec 29, 2019
2b7acdf
return empty slice if state is nil (#4365)
terencechain Dec 29, 2019
83a7efd
Merge branch 'master' of github.com:prysmaticlabs/prysm into v0.9.2
prestonvanloon Dec 29, 2019
ef09782
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 30, 2019
fad01c7
Pubsub: Broadcast attestations to committee based subnets (#4316)
prestonvanloon Dec 30, 2019
aecc387
Merge branch 'master' of https://github.com/prysmaticlabs/geth-shardi…
nisdas Dec 30, 2019
7bc7233
remove condition
nisdas Dec 30, 2019
1af278b
Remove unused operation pool (#4361)
terencechain Dec 30, 2019
aef90ac
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Dec 30, 2019
06ce578
Aggregate attestations periodically (#4376)
terencechain Dec 30, 2019
6039fed
Persist ETH1 Data to Disk (#4329)
nisdas Dec 31, 2019
b3c09b7
Fixed VerifyIndexedAttestation (#4382)
terencechain Jan 1, 2020
e43fa01
rm signing root (#4381)
prestonvanloon Jan 2, 2020
bc5461c
Remove Redundant Trie Generation (#4383)
nisdas Jan 2, 2020
52a3470
Merge branch 'master' of https://github.com/prysmaticlabs/geth-shardi…
nisdas Jan 2, 2020
5da8112
fix build
nisdas Jan 2, 2020
ba9808c
Conflict
terencechain Jan 3, 2020
a4b6651
Implement StreamAttestations RPC Endpoint (#4390)
rauljordan Jan 3, 2020
dbeb4f3
Fixed goimport (#4394)
terencechain Jan 3, 2020
d7a70e1
Use custom stateutil ssz for ssz HTR spec tests (#4396)
prestonvanloon Jan 3, 2020
75f453c
Merge branch 'master' of github.com:prysmaticlabs/prysm into v0.9.2
prestonvanloon Jan 3, 2020
11e05a0
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Jan 3, 2020
f06a5aa
set mainnet to be the default for build and run (#4398)
prestonvanloon Jan 4, 2020
93e78e3
Merge branch 'master' of github.com:prysmaticlabs/prysm into v0.9.2
prestonvanloon Jan 4, 2020
fd46407
Merge branch 'master' of github.com:prysmaticlabs/prysm into v0.9.2
prestonvanloon Jan 4, 2020
01cf5d7
gracefully handle deduplicated registration of topic validators (#4399)
prestonvanloon Jan 4, 2020
784f911
SSZ: temporarily disable roots cache until cache issues can be resolv…
prestonvanloon Jan 4, 2020
7cf008b
Remove process block attestations as separate routine (#4408)
terencechain Jan 4, 2020
fe22107
Save Deposit Cache to Disk (#4384)
nisdas Jan 4, 2020
4eeefbe
Fix activation queue sorting (#4409)
terencechain Jan 5, 2020
752d39a
Merge branch 'master' of github.com:prysmaticlabs/prysm into v0.9.2
prestonvanloon Jan 5, 2020
ba3c1c6
Merge branch 'master' into v0.9.2
prestonvanloon Jan 5, 2020
06a11d7
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Jan 5, 2020
08a203b
stop recursive lookup if context is cancelled (#4420)
prestonvanloon Jan 5, 2020
6f58efd
Fix proposal bug (#4419)
prestonvanloon Jan 5, 2020
b5370dc
Add Pending Deposits Safely (#4422)
nisdas Jan 6, 2020
6e1174b
Release custom state ssz (#4421)
prestonvanloon Jan 6, 2020
0479a4a
Merge branch 'master' of github.com:prysmaticlabs/prysm into v0.9.2
prestonvanloon Jan 6, 2020
02101dd
Update initial sync save justified to align with v0.9.3 (#4432)
terencechain Jan 6, 2020
96ee007
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Jan 6, 2020
5e0ad6a
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Jan 6, 2020
5bbf98e
fix build
prestonvanloon Jan 6, 2020
05720c9
don't blacklist on pubsub (#4435)
prestonvanloon Jan 6, 2020
c80714f
Fix Flakey Slot Ticker Test (#4434)
rauljordan Jan 6, 2020
601d7e4
Configurable min genesis delay (#4437)
prestonvanloon Jan 7, 2020
4498c54
patch readme
prestonvanloon Jan 7, 2020
6b156ac
save keys unencrypted for validators (#4439)
prestonvanloon Jan 7, 2020
111e907
Add new demo configuration targeting mainnet scale (#4397)
prestonvanloon Jan 7, 2020
d4916f2
Save justified checkpoint state (#4433)
terencechain Jan 7, 2020
6231a6b
Update shared/testutil/deposits.go
terencechain Jan 7, 2020
eb51391
Update proto/testing/ssz_regression_test.go
terencechain Jan 7, 2020
c479fd4
Update beacon-chain/core/epoch/epoch_processing.go
terencechain Jan 7, 2020
516a331
Update beacon-chain/operations/attestations/kv/forkchoice.go
terencechain Jan 7, 2020
f0cbc3f
Update beacon-chain/operations/attestations/pool.go
terencechain Jan 7, 2020
f170314
Update beacon-chain/operations/attestations/pool.go
terencechain Jan 7, 2020
1a5499d
Update beacon-chain/powchain/log_processing_test.go
terencechain Jan 7, 2020
01e4689
Update beacon-chain/rpc/validator/exit_test.go
terencechain Jan 7, 2020
852b2c5
Update beacon-chain/operations/attestations/service.go
terencechain Jan 7, 2020
c1fcfaa
Update beacon-chain/sync/subscriber_beacon_blocks_test.go
terencechain Jan 7, 2020
1c6b0ae
Update beacon-chain/sync/subscriber_beacon_blocks_test.go
terencechain Jan 7, 2020
1924f7e
Update beacon-chain/sync/subscriber.go
terencechain Jan 7, 2020
f861628
Update beacon-chain/sync/subscriber.go
terencechain Jan 7, 2020
f2208d7
Update beacon-chain/rpc/validator/proposer.go
terencechain Jan 7, 2020
369f9c7
Update beacon-chain/rpc/validator/exit_test.go
terencechain Jan 7, 2020
6622e1b
Update beacon-chain/rpc/validator/exit_test.go
terencechain Jan 7, 2020
1fd4267
Update beacon-chain/operations/attestations/prepare_forkchoice.go
terencechain Jan 7, 2020
4539807
Update beacon-chain/powchain/log_processing_test.go
terencechain Jan 7, 2020
4d07d3f
Update beacon-chain/operations/attestations/pool.go
terencechain Jan 7, 2020
e9ccbcf
Update beacon-chain/powchain/log_processing_test.go
terencechain Jan 7, 2020
861f756
Update beacon-chain/rpc/aggregator/server.go
terencechain Jan 7, 2020
01021b7
Update beacon-chain/rpc/validator/exit.go
terencechain Jan 7, 2020
98690a8
Update beacon-chain/rpc/validator/exit_test.go
terencechain Jan 7, 2020
5ff1faf
Update beacon-chain/rpc/validator/exit_test.go
terencechain Jan 7, 2020
2ed7879
Update beacon-chain/cache/depositcache/pending_deposits.go
rauljordan Jan 7, 2020
64d845c
Update beacon-chain/cache/depositcache/pending_deposits_test.go
rauljordan Jan 7, 2020
25b6aa0
Update beacon-chain/rpc/validator/proposer.go
rauljordan Jan 7, 2020
a378e01
Merge refs/heads/master into v0.9.2
prylabs-bulldozer[bot] Jan 7, 2020
b40d1c5
Fix e2e genesis delay issues (#4442)
prestonvanloon Jan 7, 2020
4271dda
Batch Eth1 RPC Calls (#4392)
nisdas Jan 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ run --host_force_python=PY2
--experimental_sandbox_default_allow_network=false

# Use minimal protobufs at runtime
run --define ssz=minimal
run --define ssz=mainnet
test --define ssz=mainnet
build --define ssz=minimal
build --define ssz=mainnet

# Prevent PATH changes from rebuilding when switching from IDE to command line.
build --incompatible_strict_action_env
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Prysm: An Ethereum 2.0 Client Written in Go

[![Build status](https://badge.buildkite.com/b555891daf3614bae4284dcf365b2340cefc0089839526f096.svg?branch=master)](https://buildkite.com/prysmatic-labs/prysm)
[![ETH2.0_Spec_Version 0.9.0](https://img.shields.io/badge/ETH2.0%20Spec%20Version-v0.9.0-blue.svg)](https://github.com/ethereum/eth2.0-specs/tree/v0.9.0)
[![ETH2.0_Spec_Version 0.9.3](https://img.shields.io/badge/ETH2.0%20Spec%20Version-v0.9.3-blue.svg)](https://github.com/ethereum/eth2.0-specs/tree/v0.9.3)
[![Discord](https://user-images.githubusercontent.com/7288322/34471967-1df7808a-efbb-11e7-9088-ed0b04151291.png)](https://discord.gg/KSA7rPr)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/prysmaticlabs/geth-sharding?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

Expand Down
16 changes: 8 additions & 8 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "5c5b65a961b5e7251435efc9548648b45142a07993ad3e100850c240cb76e9af",
url = "https://github.com/ethereum/eth2.0-spec-tests/releases/download/v0.9.0/general.tar.gz",
sha256 = "72c6ee3c20d19736b1203f364a6eb0ddee2c173073e20bee2beccd288fdc42be",
url = "https://github.com/ethereum/eth2.0-spec-tests/releases/download/v0.9.4/general.tar.gz",
)

http_archive(
Expand All @@ -165,8 +165,8 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "3b5f0168af4331d09da52bebc26609def9d11be3e6c784ce7c3df3596617808d",
url = "https://github.com/ethereum/eth2.0-spec-tests/releases/download/v0.9.0/minimal.tar.gz",
sha256 = "a3cc860a3679f6f62ee57b65677a9b48a65fdebb151cdcbf50f23852632845ef",
url = "https://github.com/ethereum/eth2.0-spec-tests/releases/download/v0.9.4/minimal.tar.gz",
)

http_archive(
Expand All @@ -181,8 +181,8 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "f3ff68508dfe9696f23506daf0ca895cda955e30398741e00cffa33a01b0565c",
url = "https://github.com/ethereum/eth2.0-spec-tests/releases/download/v0.9.0/mainnet.tar.gz",
sha256 = "8fc1b6220973ca30fa4ddc4ed24d66b1719abadca8bedb5e06c3bd9bc0df28e9",
url = "https://github.com/ethereum/eth2.0-spec-tests/releases/download/v0.9.4/mainnet.tar.gz",
)

http_archive(
Expand Down Expand Up @@ -259,7 +259,7 @@ go_repository(

go_repository(
name = "com_github_prysmaticlabs_go_ssz",
commit = "142dfef39d12ed28360b7d2467b056b0578684f5",
commit = "e24db4d9e9637cf88ee9e4a779e339a1686a84ee",
importpath = "github.com/prysmaticlabs/go-ssz",
)

Expand Down Expand Up @@ -1255,7 +1255,7 @@ go_repository(

go_repository(
name = "com_github_prysmaticlabs_ethereumapis",
commit = "2a889fed542ad00e4bd3caf723f871b6a4eff63d",
commit = "87118fb893cc6f32b25793d819790fd3bcce3221",
importpath = "github.com/prysmaticlabs/ethereumapis",
patch_args = ["-p1"],
patches = [
Expand Down
5 changes: 2 additions & 3 deletions beacon-chain/blockchain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ go_library(
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/core/state:go_default_library",
"//beacon-chain/db:go_default_library",
"//beacon-chain/operations:go_default_library",
"//beacon-chain/operations/attestations:go_default_library",
"//beacon-chain/p2p:go_default_library",
"//beacon-chain/powchain:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/params:go_default_library",
"//shared/runutil:go_default_library",
"//shared/slotutil:go_default_library",
"//shared/traceutil:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_pkg_errors//:go_default_library",
Expand Down Expand Up @@ -67,7 +67,6 @@ go_test(
"//beacon-chain/core/state:go_default_library",
"//beacon-chain/db:go_default_library",
"//beacon-chain/db/testing:go_default_library",
"//beacon-chain/operations/testing:go_default_library",
"//beacon-chain/p2p:go_default_library",
"//beacon-chain/powchain:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
Expand Down
32 changes: 29 additions & 3 deletions beacon-chain/blockchain/chain_info.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package blockchain

import (
"bytes"
"context"
"time"

Expand Down Expand Up @@ -29,7 +30,7 @@ type GenesisTimeFetcher interface {
type HeadFetcher interface {
HeadSlot() uint64
HeadRoot() []byte
HeadBlock() *ethpb.BeaconBlock
HeadBlock() *ethpb.SignedBeaconBlock
HeadState(ctx context.Context) (*pb.BeaconState, error)
HeadValidatorsIndices(epoch uint64) ([]uint64, error)
HeadSeed(epoch uint64) ([32]byte, error)
Expand Down Expand Up @@ -60,6 +61,12 @@ func (s *Service) FinalizedCheckpt() *ethpb.Checkpoint {
return &ethpb.Checkpoint{Root: params.BeaconConfig().ZeroHash[:]}
}

// If head state exists but there hasn't been a finalized check point,
// the check point's root should refer to genesis block root.
if bytes.Equal(s.headState.FinalizedCheckpoint.Root, params.BeaconConfig().ZeroHash[:]) {
return &ethpb.Checkpoint{Root: s.genesisRoot[:]}
}

return s.headState.FinalizedCheckpoint
}

Expand All @@ -69,6 +76,12 @@ func (s *Service) CurrentJustifiedCheckpt() *ethpb.Checkpoint {
return &ethpb.Checkpoint{Root: params.BeaconConfig().ZeroHash[:]}
}

// If head state exists but there hasn't been a justified check point,
// the check point root should refer to genesis block root.
if bytes.Equal(s.headState.CurrentJustifiedCheckpoint.Root, params.BeaconConfig().ZeroHash[:]) {
return &ethpb.Checkpoint{Root: s.genesisRoot[:]}
}

return s.headState.CurrentJustifiedCheckpoint
}

Expand All @@ -78,6 +91,12 @@ func (s *Service) PreviousJustifiedCheckpt() *ethpb.Checkpoint {
return &ethpb.Checkpoint{Root: params.BeaconConfig().ZeroHash[:]}
}

// If head state exists but there hasn't been a justified check point,
// the check point root should refer to genesis block root.
if bytes.Equal(s.headState.PreviousJustifiedCheckpoint.Root, params.BeaconConfig().ZeroHash[:]) {
return &ethpb.Checkpoint{Root: s.genesisRoot[:]}
}

return s.headState.PreviousJustifiedCheckpoint
}

Expand All @@ -103,11 +122,11 @@ func (s *Service) HeadRoot() []byte {
}

// HeadBlock returns the head block of the chain.
func (s *Service) HeadBlock() *ethpb.BeaconBlock {
func (s *Service) HeadBlock() *ethpb.SignedBeaconBlock {
s.headLock.RLock()
defer s.headLock.RUnlock()

return proto.Clone(s.headBlock).(*ethpb.BeaconBlock)
return proto.Clone(s.headBlock).(*ethpb.SignedBeaconBlock)
}

// HeadState returns the head state of the chain.
Expand All @@ -126,11 +145,18 @@ func (s *Service) HeadState(ctx context.Context) (*pb.BeaconState, error) {

// HeadValidatorsIndices returns a list of active validator indices from the head view of a given epoch.
func (s *Service) HeadValidatorsIndices(epoch uint64) ([]uint64, error) {
if s.headState == nil {
return []uint64{}, nil
}
return helpers.ActiveValidatorIndices(s.headState, epoch)
}

// HeadSeed returns the seed from the head view of a given epoch.
func (s *Service) HeadSeed(epoch uint64) ([32]byte, error) {
if s.headState == nil {
return [32]byte{}, nil
}

return helpers.Seed(s.headState, epoch, params.BeaconConfig().DomainBeaconAttester)
}

Expand Down
8 changes: 4 additions & 4 deletions beacon-chain/blockchain/chain_info_norace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestHeadSlot_DataRace(t *testing.T) {
go func() {
s.saveHead(
context.Background(),
&ethpb.BeaconBlock{Slot: 777},
&ethpb.SignedBeaconBlock{Block: &ethpb.BeaconBlock{Slot: 777}},
[32]byte{},
)
}()
Expand All @@ -35,7 +35,7 @@ func TestHeadRoot_DataRace(t *testing.T) {
go func() {
s.saveHead(
context.Background(),
&ethpb.BeaconBlock{Slot: 777},
&ethpb.SignedBeaconBlock{Block: &ethpb.BeaconBlock{Slot: 777}},
[32]byte{},
)
}()
Expand All @@ -52,7 +52,7 @@ func TestHeadBlock_DataRace(t *testing.T) {
go func() {
s.saveHead(
context.Background(),
&ethpb.BeaconBlock{Slot: 777},
&ethpb.SignedBeaconBlock{Block: &ethpb.BeaconBlock{Slot: 777}},
[32]byte{},
)
}()
Expand All @@ -69,7 +69,7 @@ func TestHeadState_DataRace(t *testing.T) {
go func() {
s.saveHead(
context.Background(),
&ethpb.BeaconBlock{Slot: 777},
&ethpb.SignedBeaconBlock{Block: &ethpb.BeaconBlock{Slot: 777}},
[32]byte{},
)
}()
Expand Down
52 changes: 49 additions & 3 deletions beacon-chain/blockchain/chain_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ var _ = GenesisTimeFetcher(&Service{})
var _ = ForkFetcher(&Service{})

func TestFinalizedCheckpt_Nil(t *testing.T) {
c := setupBeaconChain(t, nil)
db := testDB.SetupDB(t)
defer testDB.TeardownDB(t, db)
c := setupBeaconChain(t, db)
c.headState, _ = testutil.DeterministicGenesisState(t, 1)
if !bytes.Equal(c.FinalizedCheckpt().Root, params.BeaconConfig().ZeroHash[:]) {
t.Error("Incorrect pre chain start value")
}
}

func TestHeadRoot_Nil(t *testing.T) {
c := setupBeaconChain(t, nil)
db := testDB.SetupDB(t)
defer testDB.TeardownDB(t, db)
c := setupBeaconChain(t, db)
if !bytes.Equal(c.HeadRoot(), params.BeaconConfig().ZeroHash[:]) {
t.Error("Incorrect pre chain start value")
}
Expand All @@ -47,6 +51,20 @@ func TestFinalizedCheckpt_CanRetrieve(t *testing.T) {
}
}

func TestFinalizedCheckpt_GenesisRootOk(t *testing.T) {
db := testDB.SetupDB(t)
defer testDB.TeardownDB(t, db)

cp := &ethpb.Checkpoint{Root: params.BeaconConfig().ZeroHash[:]}
c := setupBeaconChain(t, db)
c.headState = &pb.BeaconState{FinalizedCheckpoint: cp}
c.genesisRoot = [32]byte{'A'}

if !bytes.Equal(c.FinalizedCheckpt().Root, c.genesisRoot[:]) {
t.Errorf("Got: %v, wanted: %v", c.FinalizedCheckpt().Root, c.genesisRoot[:])
}
}

func TestCurrentJustifiedCheckpt_CanRetrieve(t *testing.T) {
db := testDB.SetupDB(t)
defer testDB.TeardownDB(t, db)
Expand All @@ -60,6 +78,20 @@ func TestCurrentJustifiedCheckpt_CanRetrieve(t *testing.T) {
}
}

func TestJustifiedCheckpt_GenesisRootOk(t *testing.T) {
db := testDB.SetupDB(t)
defer testDB.TeardownDB(t, db)

cp := &ethpb.Checkpoint{Root: params.BeaconConfig().ZeroHash[:]}
c := setupBeaconChain(t, db)
c.headState = &pb.BeaconState{CurrentJustifiedCheckpoint: cp}
c.genesisRoot = [32]byte{'B'}

if !bytes.Equal(c.CurrentJustifiedCheckpt().Root, c.genesisRoot[:]) {
t.Errorf("Got: %v, wanted: %v", c.CurrentJustifiedCheckpt().Root, c.genesisRoot[:])
}
}

func TestPreviousJustifiedCheckpt_CanRetrieve(t *testing.T) {
db := testDB.SetupDB(t)
defer testDB.TeardownDB(t, db)
Expand All @@ -73,6 +105,20 @@ func TestPreviousJustifiedCheckpt_CanRetrieve(t *testing.T) {
}
}

func TestPrevJustifiedCheckpt_GenesisRootOk(t *testing.T) {
db := testDB.SetupDB(t)
defer testDB.TeardownDB(t, db)

cp := &ethpb.Checkpoint{Root: params.BeaconConfig().ZeroHash[:]}
c := setupBeaconChain(t, db)
c.headState = &pb.BeaconState{PreviousJustifiedCheckpoint: cp}
c.genesisRoot = [32]byte{'C'}

if !bytes.Equal(c.PreviousJustifiedCheckpt().Root, c.genesisRoot[:]) {
t.Errorf("Got: %v, wanted: %v", c.PreviousJustifiedCheckpt().Root, c.genesisRoot[:])
}
}

func TestHeadSlot_CanRetrieve(t *testing.T) {
c := &Service{}
c.headSlot = 100
Expand All @@ -91,7 +137,7 @@ func TestHeadRoot_CanRetrieve(t *testing.T) {
}

func TestHeadBlock_CanRetrieve(t *testing.T) {
b := &ethpb.BeaconBlock{Slot: 1}
b := &ethpb.SignedBeaconBlock{Block: &ethpb.BeaconBlock{Slot: 1}}
c := &Service{headBlock: b}
if !reflect.DeepEqual(b, c.HeadBlock()) {
t.Error("incorrect head block received")
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/blockchain/forkchoice/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ go_library(
"//proto/beacon/p2p/v1:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/hashutil:go_default_library",
"//shared/params:go_default_library",
"//shared/stateutil:go_default_library",
"//shared/traceutil:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_pkg_errors//:go_default_library",
Expand Down Expand Up @@ -61,8 +61,8 @@ go_test(
"//proto/beacon/p2p/v1:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/hashutil:go_default_library",
"//shared/params:go_default_library",
"//shared/stateutil:go_default_library",
"//shared/testutil:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/blockchain/forkchoice/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func BenchmarkForkChoiceTree1(b *testing.B) {

store := NewForkChoiceService(ctx, db)

roots, err := blockTree1(db)
roots, err := blockTree1(db, []byte{'g'})
if err != nil {
b.Fatal(err)
}
Expand Down
Loading