Commit Graph

886 Commits

Author SHA1 Message Date
Raul Jordan
6eb006175a
Capture ChainReorg, FinalizedCheckpoint, and NewHead Events in Beacon Node (#9011)
* capture missing events needed for eth2 apis

* handle underflow

* no hash tree roots

* gazelle

* static

* race tests passing

* simplify

* correctness and abstracting method for forwarding to state feed

* genesis root

* add in slotutil
2021-06-10 16:13:15 -05:00
Raul Jordan
5aac06f04e
Move EthereumAPIs Into Prysm (#8968)
* begin move

* use same import path

* imports

* regen protos

* regen

* no rename

* generate ssz

* gaz

* fmt

* edit build file

* imports

* modify

* remove generated files

* remove protos

* edit imports in prysm

* beacon chain all builds

* edit script

* add generated pbs

* add replace rules

* license for ethereumapis protos

* change visibility

* fmt

* update build files to gaz ignore

* use proper form

* edit imports

* wrap block

* revert scripts

* revert go mod
2021-06-02 18:49:52 -05:00
Nishant Das
91bd477f4f
Add Metadata V2 Object and Interface (#8962)
* checkpoint changes

* gaz

* add error check

* gaz

* fix tests

* fix tests

* terence's review

* terence's review

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2021-06-02 13:44:34 +08:00
Ivan Martinez
40b4079924
Update deprecated function usages (#8953)
* Clear deprecated usages within Prysm

* Remove deprecatd usages where possible

* Update
2021-05-28 08:57:47 +02:00
Ivan Martinez
e97f6cfdbf
ETH2 APIs: Handle invalid validator status as error (#8946)
* Handle invalid validator status as error

* Change text

* Fix review comments

* Remove nil status check

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
2021-05-27 06:44:36 +00:00
terence tsao
276d03553c
Block interface clean up (#8947) 2021-05-26 11:33:46 -07:00
Nishant Das
caf9bdbc6f
Use Block Interface Across Prysm (#8918)
* commit initial work

* checkpoint current work

* gaz

* checkpoint

* req/resp changes

* initial-sync

* finally works

* fix error

* fix bugs

* fix issue

* fix issues

* fix refs

* tests

* more text fixes

* more text fixes

* more text fixes

* fix tests

* fix tests

* tests

* finally fix builds

* finally

* comments

* fix fuzz

* share common library

* fix

* fix

* add in more defensive nil checks

* add in more defensive nil checks

* imports

* Apply suggestions from code review

Co-authored-by: terence tsao <terence@prysmaticlabs.com>

* Apply suggestions from code review

Co-authored-by: terence tsao <terence@prysmaticlabs.com>

* Update shared/interfaces/block_interface.go

Co-authored-by: terence tsao <terence@prysmaticlabs.com>

* Update shared/interfaces/block_wrapper.go

Co-authored-by: terence tsao <terence@prysmaticlabs.com>

* Update shared/interfaces/block_interface.go

Co-authored-by: terence tsao <terence@prysmaticlabs.com>

* imports

* fix bad changes

* fix

* terence's review

* terence's review

* fmt

* Update beacon-chain/rpc/beacon/blocks.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* fix tests

* fix

* fix all tests

Co-authored-by: terence tsao <terence@prysmaticlabs.com>
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
2021-05-26 16:19:54 +00:00
Ivan Martinez
d5ad15ed80
ETH2 APIs: Implement Validator Status support (#8940)
* Update protos for new changes

* Begin implementing validator status

* Add support for validator status to state/validators

* Fix nil pointer
2021-05-26 00:24:29 -04:00
Ivan Martinez
aa0fb058c6
ETH2 APIs: Update protos for new ethapis changes (#8920)
* Update protos for new changes

* Fix

* Fix deps

* Fix build

* Include newer changes to ethapis

* Fix

* Fix import

* Do not return unconnected peers
2021-05-24 20:02:01 -05:00
Nishant Das
76cdbaca22
Interface Analyzer (#8923) 2021-05-23 21:55:42 -07:00
Ivan Martinez
f4d6e91e72
ETH2 APIs: Add spans and remove unused Server fields (#8916)
* Add spans and remove unused Server fields

* Remove more
2021-05-20 14:56:53 -05:00
Ivan Martinez
213369f5d0
Fix testing for attestation pools endpoint (#8914)
* Fix testing for attestation pools endpoint

* Remove
2021-05-20 18:59:25 +00:00
Ivan Martinez
8aa909de2d
ETH2 API: Implement v1/state/validator endpoints (#8896)
* Implement validator endpoints

* Import

* Fix errors

* Add comments and fix naming :wq

* Fix functions to access state once

* Optimization for slots

* Test more

* Fix

* test listing committees for specific epoch

* Fix error retrurn

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: rkapka <rkapka@wp.pl>
2021-05-20 07:41:39 +00:00
Ivan Martinez
9db4eba72b
ETH2 API: Implement ListPoolAttestations endpoint (#8902)
* Implement ListPoolAttestations

* Spacing

* add lil doc

* Fix testing and rework logic
2021-05-19 09:55:24 -05:00
Radosław Kapka
519e1e4f4a
Decode peer ID properly when fetching peer (#8883)
# Conflicts:
#	beacon-chain/rpc/nodev1/node_test.go

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2021-05-17 18:58:13 +00:00
Ivan Martinez
2f10b1c7b1
Change gogoproto compiler to protoc-gen-go-cast (#8697)
* Remove gogoproto compiler

* Remove more gogoproto

* Improvements

* Fix gengo

* More scripts

* Gazelle, fix deps

* Fix version and errors

* Fix gocast for arrays

* Fix ethapis

* Fixes

* Fix compile errors

* fix go.mod

* //proto/... builds

* Update for protov2

* temp fix compilation to move on

* Change everything to emptypb.empty

* Add grpc to proto/slashings

* Fix almost all build failures

* Oher build problems

* FIX THIS FUCKING THING

* gaz literally every .bazel

* Final touches

* Final final touches

* Fix proto

* Begin moving proto.Marshal to native

* Fix site_data

* Fixes

* Fix duplicate gateway

* Fix gateway target

* Fix ethapis

* Fixes from review

* Update

* Fix

* Fix status test

* Fix fuzz

* Add isprotoslice to fun

* Change DeepEqual to DeepSSZEqual for proto arrays

* Fix build

* Fix gaz

* Update go

* Fixes

* Fixes

* Add case for nil validators after copy

* Fix cast

* Fix test

* Fix imports

* Go mod

* Only use extension where needed

* Fixes

* Split gateway from gengo

* gaz

* go mod

* Add back hydrated state

* fix hydrate

* Fix proto.clone

* Fies

* Revert "Split gateway from gengo"

This reverts commit 7298bb2054d446e427d9af97e13b8fabe8695085.

* Revert "gaz"

This reverts commit ca952565701a88727e22302d6c8d60ac48d97255.

* Merge all gateway into one target

* go mod

* Gaz

* Add generate v1_gateway files

* run pb again

* goimports

* gaz

* Fix comments

* Fix protos

* Fix PR

* Fix protos

* Update grpc-gateway and ethapis

* Update ethapis and gen-go-cast

* Go tidy

* Reorder

* Fix ethapis

* fix spec tests

* Fix script

* Remove unused import

* Fix fuzz

* Fix gomod

* Update version

* Error if the cloned result is nil

* Handle optional slots

* ADd more empty checks to clone

* Undo fuzz changes

* Fix build.bazel

* Gaz

* Redo fuzz changes

* Undo some eth1data changes

* Update go.mod

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

* Undo clone beacon state

* Remove gogo proto more and unused v1_gateway

* Add manual fix for nil vals

* Fix gaz

* tidy

* Tidy again

* Add detailed error

* Revert "Add detailed error"

This reverts commit 59bc053dcd59569a54c95b07739d5a379665ec5d.

* Undo varint changes

* Fix nil validators in deposit test

* Commit

* Undo

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Co-authored-by: Nishant Das <nishdas93@gmail.com>
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2021-05-17 18:32:04 +00:00
Radosław Kapka
e254e8edcc
Simplify handling hex state ID (#8890)
Co-authored-by: terence tsao <terence@prysmaticlabs.com>
2021-05-17 09:56:00 +02:00
terence tsao
bc27a73600
Various code cleanups (#8889) 2021-05-13 08:29:14 +02:00
Nishant Das
4ef5c9ad15
add it in (#8885) 2021-05-12 15:59:26 +08:00
Radosław Kapka
ddab82e52a
Handle undiscovered peers when listing peers (#8882)
* Handle undiscovered peers when listing peers

* off by 1 fix
2021-05-11 19:11:34 +02:00
Radosław Kapka
f97c7ee1da
Initialize VoluntaryExitsPool and BlockReceiver in rpc server (#8876)
* Initialize `VoluntaryExitsPool` in rpc server

* initialize `BlockReceiver`
2021-05-11 07:16:13 +00:00
Nishant Das
255354f27e
Fallback For Deposit Trie Creation (#8869)
* fallback

* make it an error

* comment

* Update beacon-chain/rpc/validator/proposer.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
2021-05-10 07:34:10 +08:00
Nishant Das
71f53d908f
Add Stricter Checks To The Deposit Cache (#8838)
* add stricter checks

* fix tests
2021-04-29 14:24:13 +02:00
Preston Van Loon
424e115331
Independent eth1 voting (#8811) 2021-04-24 18:32:45 -07:00
Victor Farazdagi
386b69f473
Fix comments (#8802)
* fix incorrect exported name in comments

* add comments to exported methods
2021-04-23 12:06:05 +00:00
terence tsao
a4ff97d24b
Refactor signature function's argument (#8773) 2021-04-15 11:35:53 -07:00
terence tsao
169cd78bbd
Refactor process operation function arguments (#8767)
* Pass slash validator func as argument

* Refactor ProcessBlockHeaderNoVerify

* Refactor Eth1Data and Randao

* Refactor ProposerSlashing

* Refactor AttesterSlashing

* Refactor VoluntaryExit

* Add VerifyNilBeaconBlock to ProcessBlock

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
2021-04-15 13:58:54 +00:00
Radosław Kapka
a8716d2949
Implement ListForkChoiceHeads in the debug API (#8675)
* initial implementation

* use ChainHeads to get heads

* API unit tests

* remove unnecessary identifier

* fix formatting

* gzl

* Update chainheads to fork choice scope

* use HeadFetcher

* fix test

* gzl

* remove junk

* remove ChainHeads from forkchoice

Co-authored-by: terence tsao <terence@prysmaticlabs.com>
Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
2021-04-14 17:01:24 +00:00
terence tsao
8b494fb1bc
ProcessRewardsAndPenaltiesPrecompute taking in rewards funcs (#8737)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-04-13 04:55:45 +00:00
Preston Van Loon
a91f2688f1
Set test timeout on //beacon-chain/rpc/validator:go_default_test. Sometimes exceeds 800s otherwise (#8752) 2021-04-13 00:24:04 +00:00
Victor Farazdagi
91df0112c7
Add LatestWeakSubjectivityEpoch() method (#8707)
* Add IsWithinWeakSubjectivityPeriod helper method

* Add LatestWeakSubjectivityEpoch method

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2021-04-06 09:08:44 +03:00
terence tsao
01eb77c834
ProcessPreGenesisDeposits: Remove context.TODO() usage (#8705)
* ProcessPreGenesisDeposits: Remove context.TODO() usage

* apply #8704 change

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-04-05 15:07:56 +00:00
Victor Farazdagi
acf17f9b82
Weak subjectivity period calculating helper (#8695)
* move helpers to their own file

* implement ComputeWeakSubjectivityCheckptEpoch

* remove helper func

* fix unit tests

* rename
2021-04-01 22:50:04 +00:00
Radosław Kapka
f822f0436e
Break long lines in beacon chain package (#8686)
* Break long lines in beacon chain package

* change log formatting

* Revert "change log formatting"

This reverts commit b610fd67edbf4f9f095f0336e313376e4472d50a.

* Revert "Break long lines in beacon chain package"

This reverts commit 53215fdcde0ad5cbed5c9e0616979e3ae396322c.

* wrap lines over 160

* revert go.mod and go.sum
2021-03-30 11:24:46 +00:00
Radosław Kapka
190d862552
Implement GetBeaconState in the debug API (#8631)
* Return status.Errorf instead of plain errors from gRPC functions

* return plain errors from helper functions

* change errors to lowercase in node

* correct test expectations

* extracted StateFetcher

* StateFetcher tests

* extract beacon state creation option and fix state tests

* add comment to StateFetcher

* register the server

* implement grpc function

* test ToProto

* gRPC function test with mock state fetcher

* reduce visibility of packages

* add missing error assertion

* removed unused code

* overwrite config name

* gzl

* Fix service fields

* rename StateFetcher to Provider

* Update beacon-chain/state/stateV0/state_trie.go

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>

* adjust code to new v0 interfaces

* interface/struct naming changes

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2021-03-29 21:04:35 +00:00
terence tsao
5f2f53a0a6
Harden beacon state interface for Altair (#8673)
* State: clean up

* Add error to return signature

* Remove SetCurrentEpochAttestations and SetPreviousEpochAttestations

* Fix tests

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2021-03-26 18:15:03 +00:00
Raul Jordan
82f25bacf2
Fix All Deep Source Shell Issues and Go Issues (#8661)
* most issues resolved

* fuzz wrapper fixes

* more deepsource

* more shell

* export

* shell

* combine func params, fix go deep source issues

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-03-24 19:57:27 +00:00
Radosław Kapka
2fe50c5edd
Rename state_fetcher.go (#8646)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-03-24 09:08:39 +00:00
Radosław Kapka
c112d27ab5
Extract filling testutil's beacon chain root (#8645)
* Extract filling testutil's beacon chain root

* gzl

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-03-24 03:47:36 +00:00
Radosław Kapka
8281634131
Introduce API StateFetcher (#8639)
* Return status.Errorf instead of plain errors from gRPC functions

* return plain errors from helper functions

* change errors to lowercase in node

* correct test expectations

* extracted StateFetcher

* StateFetcher tests

* extract beacon state creation option and fix state tests

* add comment to StateFetcher

* remove empty line

* overwrite config name

* fix field names

* remove FillRootsNaturalOpt helper

* reduce statefetcher package visibility

* gzl

* add missing error assertion

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: terence tsao <terence@prysmaticlabs.com>
2021-03-22 15:19:38 +00:00
kevlu93
4a64d4d133
Embed Config Pattern For Attestation, POW Chain, and RPC Services (#8635) 2021-03-21 16:58:41 +00:00
Preston Van Loon
e477fdfd6d
Embedded mainnet genesis state + load genesis.ssz from file (#8614)
* Update rules_go and fix proto conflicts

* gaz

* Update generated code

* First pass inclusion of using baked states

* more emptypb fixes

* remove testnet genesis files, only embed mainnet

* Refactoring for SaveGenesisData, fix tests that use mainnet config but do not support mainnet genesis values

* a bit more refactoring, load genesis from a file. Needs tests still

* Add method to ensure an embedded genesis file also has the appropriate genesis block

* gofmt

* more clear error

* Check genesis fork version to ensure testnet config matches genesis file

* viz

* test for SaveGenesisData

* More genesis db method tests

* Merge

* Minor tweaks, lint, fmt, etc

* Add more test to genesis db methods

* Revert beacon-chain/state/stateV0/BUILD.bazel

* Update beacon-chain/db/iface/errors.go

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>

* PR feedback

* Update beacon-chain/db/kv/genesis.go

Co-authored-by: terence tsao <terence@prysmaticlabs.com>

* fmt.Errorf works better for nil errors

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: terence tsao <terence@prysmaticlabs.com>
2021-03-18 21:00:00 +00:00
terence tsao
ce725ceec3
Move state pkg to stateV0 pkg (#8620)
* Move state pkg to stateV0 pkg

* Build.bazel

* Remove unused RootsArrayHashTreeRoot

* Revert "Remove unused RootsArrayHashTreeRoot"

This reverts commit bf0bda30d1a8eb7a071f6e3ce9ee85041b45aca6.

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-03-17 19:49:49 +00:00
Radosław Kapka
0a73be7389
Return status.Errorf instead of plain errors from gRPC functions (#8619)
* Return status.Errorf instead of plain errors from gRPC functions

* return plain errors from helper functions

* change errors to lowercase in node

* correct test expectations

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-03-17 16:47:44 +00:00
terence tsao
9fea9816bd
BeaconState: Expose MarshalSSZ (#8609) 2021-03-16 00:43:27 +00:00
Radosław Kapka
c577fbd772
Move attestation's source checkpoint validation to VerifyAttestationNoVerifySignature (#8598)
* Move attestation's source checkpoint validation to VerifyAttestationNoVerifySignature

* change parameter type to ReadOnlyBeaconState

Co-authored-by: terence tsao <terence@prysmaticlabs.com>
2021-03-12 21:43:20 +00:00
Preston Van Loon
eb694ab5d5
Update rules_go and fix proto conflicts (#8596)
* Update rules_go and fix proto conflicts

* gaz

* Update generated code

* more emptypb fixes

* gaz

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
2021-03-11 18:03:19 -06:00
terence tsao
bdf2b2019b
Use beacon state interfaces across (#8552) 2021-03-08 14:37:33 -08:00
Victor Farazdagi
f2125e5f64
Proposer attestation selection using max-cover (#8571)
* Proposer attestation selection using max-cover

* better alisgn struct field

* more tests

* cleanup

* simplify expressions

* add benchmarks

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-03-08 18:46:24 +00:00
Radosław Kapka
79754bded2
Implement SubmitAttestations in the beacon API (#8563)
* update ethereumapis deps

* V1AttToV1Alpha1 migration

* Implementation plus happy path test

* fix root variable names

* Invalid attestation test

* gzl

* mod tidy

* use a single append to concatenate two slices

* remove outdated comment from attestation processing

* invoke ProcessAttestationNoVerifySignature when validating attestations

* implement missing PoolMock members

* use new VerifyAttestationNoVerifySignature function
2021-03-08 15:42:05 +01:00