Documentation ¶
Overview ¶
Package testing provides useful mocks for an eth1 powchain service as needed by unit tests for the beacon node.
Index ¶
- Variables
- func SetupRPCServer() (*rpc.Server, string, error)
- type Chain
- func (m *Chain) BlockByTimestamp(_ context.Context, time uint64) (*types.HeaderInfo, error)
- func (m *Chain) BlockExists(_ context.Context, hash common.Hash) (bool, *big.Int, error)
- func (m *Chain) BlockHashByHeight(_ context.Context, height *big.Int) (common.Hash, error)
- func (m *Chain) BlockTimeByHeight(_ context.Context, height *big.Int) (uint64, error)
- func (m *Chain) ChainStartEth1Data() *ethpb.Eth1Data
- func (*Chain) ClearPreGenesisData()
- func (m *Chain) ETH1ConnectionErrors() []error
- func (m *Chain) ETH1Endpoints() []string
- func (*Chain) ExecutionClientConnected() bool
- func (m *Chain) ExecutionClientConnectionErr() error
- func (m *Chain) ExecutionClientEndpoint() string
- func (m *Chain) GenesisExecutionChainInfo() (uint64, *big.Int)
- func (m *Chain) InsertBlock(height int, time uint64, hash []byte) *Chain
- func (m *Chain) PreGenesisState() state.BeaconState
- type EngineClient
- func (e *EngineClient) ExchangeTransitionConfiguration(_ context.Context, _ *pb.TransitionConfiguration) error
- func (e *EngineClient) ExecutionBlockByHash(_ context.Context, h common.Hash, _ bool) (*pb.ExecutionBlock, error)
- func (e *EngineClient) ForkchoiceUpdated(_ context.Context, fcs *pb.ForkchoiceState, _ payloadattribute.Attributer) (*pb.PayloadIDBytes, []byte, error)
- func (e *EngineClient) GetPayload(_ context.Context, _ [8]byte, s primitives.Slot) (interfaces.ExecutionData, error)
- func (e *EngineClient) GetTerminalBlockHash(ctx context.Context, transitionTime uint64) ([]byte, bool, error)
- func (e *EngineClient) LatestExecutionBlock(_ context.Context) (*pb.ExecutionBlock, error)
- func (e *EngineClient) NewPayload(_ context.Context, _ interfaces.ExecutionData) ([]byte, error)
- func (e *EngineClient) ReconstructFullBellatrixBlockBatch(ctx context.Context, blindedBlocks []interfaces.ReadOnlySignedBeaconBlock) ([]interfaces.SignedBeaconBlock, error)
- func (e *EngineClient) ReconstructFullBlock(_ context.Context, blindedBlock interfaces.ReadOnlySignedBeaconBlock) (interfaces.SignedBeaconBlock, error)
- type FaultyExecutionChain
- func (*FaultyExecutionChain) BlockByTimestamp(context.Context, uint64) (*types.HeaderInfo, error)
- func (f *FaultyExecutionChain) BlockExists(context.Context, common.Hash) (bool, *big.Int, error)
- func (*FaultyExecutionChain) BlockHashByHeight(context.Context, *big.Int) (common.Hash, error)
- func (*FaultyExecutionChain) BlockTimeByHeight(context.Context, *big.Int) (uint64, error)
- func (*FaultyExecutionChain) ChainStartEth1Data() *ethpb.Eth1Data
- func (*FaultyExecutionChain) ClearPreGenesisData()
- func (*FaultyExecutionChain) Eth2GenesisPowchainInfo() (uint64, *big.Int)
- func (*FaultyExecutionChain) IsConnectedToETH1() bool
- func (*FaultyExecutionChain) PreGenesisState() state.BeaconState
- type RPCClient
Constants ¶
This section is empty.
Variables ¶
var GenesisTime = time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC).Unix()
GenesisTime represents a static past date - JAN 01 2000.
Functions ¶
Types ¶
type Chain ¶
type Chain struct { ChainFeed *event.Feed LatestBlockNumber *big.Int HashesByHeight map[int][]byte TimesByHeight map[int]uint64 BlockNumberByTime map[uint64]*big.Int Eth1Data *ethpb.Eth1Data GenesisEth1Block *big.Int GenesisState state.BeaconState CurrEndpoint string CurrError error Endpoints []string Errors []error }
Chain defines a properly functioning mock for the powchain service.
func (*Chain) BlockByTimestamp ¶
BlockByTimestamp --
func (*Chain) BlockExists ¶
BlockExists --
func (*Chain) BlockHashByHeight ¶
BlockHashByHeight --
func (*Chain) BlockTimeByHeight ¶
BlockTimeByHeight --
func (*Chain) ChainStartEth1Data ¶
ChainStartEth1Data --
func (*Chain) ETH1ConnectionErrors ¶
func (*Chain) ETH1Endpoints ¶
func (*Chain) ExecutionClientConnected ¶
func (*Chain) ExecutionClientConnectionErr ¶
func (*Chain) ExecutionClientEndpoint ¶
func (*Chain) GenesisExecutionChainInfo ¶
GenesisExecutionChainInfo --
func (*Chain) InsertBlock ¶
InsertBlock adds provided block info into the chain.
func (*Chain) PreGenesisState ¶
func (m *Chain) PreGenesisState() state.BeaconState
PreGenesisState --
type EngineClient ¶
type EngineClient struct { NewPayloadResp []byte PayloadIDBytes *pb.PayloadIDBytes ForkChoiceUpdatedResp []byte ExecutionPayload *pb.ExecutionPayload ExecutionPayloadCapella *pb.ExecutionPayloadCapella ExecutionBlock *pb.ExecutionBlock Err error ErrLatestExecBlock error ErrExecBlockByHash error ErrForkchoiceUpdated error ErrNewPayload error ErrGetPayload error ExecutionPayloadByBlockHash map[[32]byte]*pb.ExecutionPayload BlockByHashMap map[[32]byte]*pb.ExecutionBlock NumReconstructedPayloads uint64 TerminalBlockHash []byte TerminalBlockHashExists bool OverrideValidHash [32]byte BlockValue uint64 }
EngineClient --
func (*EngineClient) ExchangeTransitionConfiguration ¶
func (e *EngineClient) ExchangeTransitionConfiguration(_ context.Context, _ *pb.TransitionConfiguration) error
ExchangeTransitionConfiguration --
func (*EngineClient) ExecutionBlockByHash ¶
func (e *EngineClient) ExecutionBlockByHash(_ context.Context, h common.Hash, _ bool) (*pb.ExecutionBlock, error)
ExecutionBlockByHash --
func (*EngineClient) ForkchoiceUpdated ¶
func (e *EngineClient) ForkchoiceUpdated( _ context.Context, fcs *pb.ForkchoiceState, _ payloadattribute.Attributer, ) (*pb.PayloadIDBytes, []byte, error)
ForkchoiceUpdated --
func (*EngineClient) GetPayload ¶
func (e *EngineClient) GetPayload(_ context.Context, _ [8]byte, s primitives.Slot) (interfaces.ExecutionData, error)
GetPayload --
func (*EngineClient) GetTerminalBlockHash ¶
func (e *EngineClient) GetTerminalBlockHash(ctx context.Context, transitionTime uint64) ([]byte, bool, error)
GetTerminalBlockHash --
func (*EngineClient) LatestExecutionBlock ¶
func (e *EngineClient) LatestExecutionBlock(_ context.Context) (*pb.ExecutionBlock, error)
LatestExecutionBlock --
func (*EngineClient) NewPayload ¶
func (e *EngineClient) NewPayload(_ context.Context, _ interfaces.ExecutionData) ([]byte, error)
NewPayload --
func (*EngineClient) ReconstructFullBellatrixBlockBatch ¶
func (e *EngineClient) ReconstructFullBellatrixBlockBatch( ctx context.Context, blindedBlocks []interfaces.ReadOnlySignedBeaconBlock, ) ([]interfaces.SignedBeaconBlock, error)
ReconstructFullBellatrixBlockBatch --
func (*EngineClient) ReconstructFullBlock ¶
func (e *EngineClient) ReconstructFullBlock( _ context.Context, blindedBlock interfaces.ReadOnlySignedBeaconBlock, ) (interfaces.SignedBeaconBlock, error)
ReconstructFullBlock --
type FaultyExecutionChain ¶
FaultyExecutionChain defines an incorrectly functioning powchain service.
func (*FaultyExecutionChain) BlockByTimestamp ¶
func (*FaultyExecutionChain) BlockByTimestamp(context.Context, uint64) (*types.HeaderInfo, error)
BlockByTimestamp --
func (*FaultyExecutionChain) BlockExists ¶
BlockExists --
func (*FaultyExecutionChain) BlockHashByHeight ¶
BlockHashByHeight --
func (*FaultyExecutionChain) BlockTimeByHeight ¶
BlockTimeByHeight --
func (*FaultyExecutionChain) ChainStartEth1Data ¶
func (*FaultyExecutionChain) ChainStartEth1Data() *ethpb.Eth1Data
ChainStartEth1Data --
func (*FaultyExecutionChain) ClearPreGenesisData ¶
func (*FaultyExecutionChain) ClearPreGenesisData()
ClearPreGenesisData --
func (*FaultyExecutionChain) Eth2GenesisPowchainInfo ¶
func (*FaultyExecutionChain) Eth2GenesisPowchainInfo() (uint64, *big.Int)
Eth2GenesisPowchainInfo --
func (*FaultyExecutionChain) IsConnectedToETH1 ¶
func (*FaultyExecutionChain) IsConnectedToETH1() bool
IsConnectedToETH1 --
func (*FaultyExecutionChain) PreGenesisState ¶
func (*FaultyExecutionChain) PreGenesisState() state.BeaconState
PreGenesisState --
type RPCClient ¶
type RPCClient struct { Backend *backends.SimulatedBackend BlockNumMap map[uint64]*types.HeaderInfo }
RPCClient defines the mock rpc client.