prysm-pulse/beacon-chain/rpc/beaconv1/server.go
Ivan Martinez daf0b51361
Eth2 API: Implement block endpoints (#7433)
* Start Beacon API outline

* Rename to v1

* Add impl

* Change to outline

* Add comments

* Remove unneeded items

* Fix linting

* tidy

* Fix visibility

* go.sum

* Fix deps

* Tidy

* Implement blocks API endpoints

* Add check for interface type and fix pointers

* Fix pointer name

* gaz

* Fix comments

* Fix imports

* Fix analysis

* Add more coverage

* Add coverage and fix errors

* Fix head test

* Fix test remove println

* Fix error text and cleanup

* Change tests to TDD

* Add tests for finalized

* Fix att test

* Fix analysis

* Fix go mo d

* Fix proto

* fix go mod

* Extend testing

* Fix tests

* Move migration to package and test block atts

* Fix migration

* Gaz

* Check for block canonical before returning

* Fix text

* Gaz

* Fix tests

* Fix tests

* Fix canonical

* Fix test again

* Fix tests

* Remove unneeded comment

* Plug in RPC service

* Fix err msg
2020-10-15 18:00:49 +00:00

48 lines
2.0 KiB
Go

// Package beaconv1 defines a gRPC beacon service implementation,
// following the official API standards https://ethereum.github.io/eth2.0-APIs/#/.
// This package includes the beacon and config endpoints.
package beaconv1
import (
"context"
"time"
"github.com/prysmaticlabs/prysm/beacon-chain/blockchain"
"github.com/prysmaticlabs/prysm/beacon-chain/cache/depositcache"
blockfeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/block"
"github.com/prysmaticlabs/prysm/beacon-chain/core/feed/operation"
statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state"
"github.com/prysmaticlabs/prysm/beacon-chain/db"
"github.com/prysmaticlabs/prysm/beacon-chain/operations/attestations"
"github.com/prysmaticlabs/prysm/beacon-chain/operations/slashings"
"github.com/prysmaticlabs/prysm/beacon-chain/p2p"
"github.com/prysmaticlabs/prysm/beacon-chain/powchain"
"github.com/prysmaticlabs/prysm/beacon-chain/state/stategen"
"github.com/prysmaticlabs/prysm/beacon-chain/sync"
pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
)
// Server defines a server implementation of the gRPC Beacon Chain service,
// providing RPC endpoints to access data relevant to the Ethereum 2.0 phase 0
// beacon chain.
type Server struct {
BeaconDB db.ReadOnlyDatabase
Ctx context.Context
ChainStartFetcher powchain.ChainStartFetcher
ChainInfoFetcher blockchain.ChainInfoFetcher
DepositFetcher depositcache.DepositFetcher
BlockFetcher powchain.POWBlockFetcher
GenesisTimeFetcher blockchain.TimeFetcher
BlockReceiver blockchain.BlockReceiver
StateNotifier statefeed.Notifier
BlockNotifier blockfeed.Notifier
AttestationNotifier operation.Notifier
Broadcaster p2p.Broadcaster
AttestationsPool attestations.Pool
SlashingsPool *slashings.Pool
CanonicalStateChan chan *pbp2p.BeaconState
ChainStartChan chan time.Time
StateGen *stategen.State
SyncChecker sync.Checker
}