execution

package
v0.0.0-...-40c18d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PortUserRPC   = 8545
	PortEngineRPC = 8551
)

Variables

View Source
var AllEngineCalls = []string{
	"engine_forkchoiceUpdatedV1",
	"engine_forkchoiceUpdatedV2",
	"engine_forkchoiceUpdatedV3",
	"engine_getPayloadV1",
	"engine_getPayloadV2",
	"engine_getPayloadV3",
	"engine_newPayloadV1",
	"engine_newPayloadV2",
	"engine_newPayloadV3",
}
View Source
var AllForkchoiceUpdatedCalls = []string{
	"engine_forkchoiceUpdatedV1",
	"engine_forkchoiceUpdatedV2",
	"engine_forkchoiceUpdatedV3",
}
View Source
var AllGetPayloadCalls = []string{
	"engine_getPayloadV1",
	"engine_getPayloadV2",
	"engine_getPayloadV3",
}
View Source
var AllNewPayloadCalls = []string{
	"engine_newPayloadV1",
	"engine_newPayloadV2",
	"engine_newPayloadV3",
}

Functions

func Combine

func Combine(a, b *proxy.Spoof) *proxy.Spoof

func GetNewToken

func GetNewToken(jwtSecretBytes []byte, iat time.Time) (string, error)

JWT Tokens

func MakeSpoofs

func MakeSpoofs(
	fields map[string]interface{},
	methods ...string,
) []*proxy.Spoof

MakeSpoofs creates a slice of spoof requests with the same fields and different methods.

func UnmarshalFromJsonRPCRequest

func UnmarshalFromJsonRPCRequest(b []byte, params ...interface{}) error

func UnmarshalFromJsonRPCResponse

func UnmarshalFromJsonRPCResponse(b []byte, result interface{}) error

Types

type BinaryMarshable

type BinaryMarshable interface {
	MarshalBinary() ([]byte, error)
}

type EnodeClient

type EnodeClient interface {
	clients.Client
	GetEnodeURL() (string, error)
}

type ExecutionClient

type ExecutionClient struct {
	clients.Client
	Logger utils.Logging
	Config ExecutionClientConfig
	// contains filtered or unexported fields
}

func (*ExecutionClient) BalanceAt

func (ec *ExecutionClient) BalanceAt(
	parentCtx context.Context,
	account common.Address,
	n *big.Int,
) (*big.Int, error)

func (*ExecutionClient) BlockByHash

func (ec *ExecutionClient) BlockByHash(
	parentCtx context.Context,
	h common.Hash,
) (*types.Block, error)

func (*ExecutionClient) BlockByNumber

func (ec *ExecutionClient) BlockByNumber(
	parentCtx context.Context,
	n *big.Int,
) (*types.Block, error)

func (*ExecutionClient) CheckTTD

func (ec *ExecutionClient) CheckTTD(parentCtx context.Context) (bool, error)

func (*ExecutionClient) ConfiguredTTD

func (en *ExecutionClient) ConfiguredTTD() *big.Int

func (*ExecutionClient) EngineForkchoiceUpdated

func (en *ExecutionClient) EngineForkchoiceUpdated(
	parentCtx context.Context,
	fcState *api.ForkchoiceStateV1,
	pAttributes *api.PayloadAttributes,
	version int,
) (*api.ForkChoiceResponse, error)

func (*ExecutionClient) EngineGetPayload

func (en *ExecutionClient) EngineGetPayload(
	parentCtx context.Context,
	payloadID *api.PayloadID,
	version int,
) (*api.ExecutableData, *big.Int, *api.BlobsBundleV1, *bool, error)

func (*ExecutionClient) EngineNewPayload

func (en *ExecutionClient) EngineNewPayload(
	parentCtx context.Context,
	payload *api.ExecutableData,
	version int,
) (*api.PayloadStatusV1, error)

func (*ExecutionClient) EngineRPCAddress

func (en *ExecutionClient) EngineRPCAddress() (string, error)

func (*ExecutionClient) GetLatestForkchoiceUpdated

func (en *ExecutionClient) GetLatestForkchoiceUpdated(
	ctx context.Context,
) (*api.ForkchoiceStateV1, error)

func (*ExecutionClient) HeaderByHash

func (ec *ExecutionClient) HeaderByHash(
	parentCtx context.Context,
	h common.Hash,
) (*types.Header, error)

func (*ExecutionClient) HeaderByLabel

func (ec *ExecutionClient) HeaderByLabel(
	parentCtx context.Context,
	l string,
) (*types.Header, error)

func (*ExecutionClient) HeaderByNumber

func (ec *ExecutionClient) HeaderByNumber(
	parentCtx context.Context,
	n *big.Int,
) (*types.Header, error)

func (*ExecutionClient) Init

func (en *ExecutionClient) Init(ctx context.Context) error

func (*ExecutionClient) IsRunning

func (en *ExecutionClient) IsRunning() bool

func (*ExecutionClient) Logf

func (en *ExecutionClient) Logf(format string, values ...interface{})

func (*ExecutionClient) MustGetEnode

func (en *ExecutionClient) MustGetEnode() string

func (*ExecutionClient) PrepareAuthCallToken

func (en *ExecutionClient) PrepareAuthCallToken(
	jwtSecretBytes []byte,
	iat time.Time,
) error

func (*ExecutionClient) PrepareDefaultAuthCallToken

func (en *ExecutionClient) PrepareDefaultAuthCallToken() error

func (*ExecutionClient) Proxy

func (en *ExecutionClient) Proxy() *Proxy

func (*ExecutionClient) SendTransaction

func (ec *ExecutionClient) SendTransaction(
	parentCtx context.Context,
	tx BinaryMarshable,
) error

func (*ExecutionClient) Shutdown

func (en *ExecutionClient) Shutdown() error

func (*ExecutionClient) Start

func (en *ExecutionClient) Start() error

func (*ExecutionClient) TotalDifficultyByHash

func (en *ExecutionClient) TotalDifficultyByHash(
	parentCtx context.Context,
	blockHash common.Hash,
) (*big.Int, error)

func (*ExecutionClient) TotalDifficultyByNumber

func (en *ExecutionClient) TotalDifficultyByNumber(
	parentCtx context.Context,
	blockNumber *big.Int,
) (*big.Int, error)

func (*ExecutionClient) UserRPCAddress

func (en *ExecutionClient) UserRPCAddress() (string, error)

func (*ExecutionClient) WaitForTerminalTotalDifficulty

func (ec *ExecutionClient) WaitForTerminalTotalDifficulty(
	parentCtx context.Context,
) error

type ExecutionClientConfig

type ExecutionClientConfig struct {
	ClientIndex             int
	ProxyConfig             *ExecutionProxyConfig
	TerminalTotalDifficulty int64
	EngineAPIPort           int
	RPCPort                 int
	Subnet                  string
	JWTSecret               []byte
}

type ExecutionClients

type ExecutionClients []*ExecutionClient

func (ExecutionClients) CheckHeads

func (all ExecutionClients) CheckHeads(
	l utils.Logging,
	parentCtx context.Context,
) (bool, error)

Returns true if all head hashes match

func (ExecutionClients) Enodes

func (all ExecutionClients) Enodes() (string, error)

Returns comma-separated Bootnodes of all running execution nodes

func (ExecutionClients) Running

func (all ExecutionClients) Running() ExecutionClients

Return subset of clients that are currently running

func (ExecutionClients) Subnet

func (all ExecutionClients) Subnet(subnet string) ExecutionClients

Return subset of clients that are part of an specific subnet

type ExecutionProxyConfig

type ExecutionProxyConfig struct {
	Host                   net.IP
	Port                   int
	LogEngineCalls         bool
	TrackForkchoiceUpdated bool
}

type Proxies

type Proxies []ProxyProvider

func (Proxies) Running

func (all Proxies) Running() []*Proxy

type Proxy

type Proxy struct {
	IP net.IP

	JWTSecret string
	// contains filtered or unexported fields
}

func NewProxy

func NewProxy(
	hostIP net.IP,
	port int,
	destination string,
	jwtSecret []byte,
) *Proxy

func (*Proxy) AddRequestCallbacks

func (p *Proxy) AddRequestCallbacks(
	callback func([]byte) *proxy.Spoof,
	methods ...string,
)

AddRequestCallbacks adds a callback for a request on multiple methods to the proxy.

func (*Proxy) AddRequests

func (p *Proxy) AddRequests(spoofs ...*proxy.Spoof)

AddRequests adds spoofs for a set of requests to the proxy.

func (*Proxy) AddResponseCallbacks

func (p *Proxy) AddResponseCallbacks(
	callback func([]byte, []byte) *proxy.Spoof,
	methods ...string,
)

AddResponseCallbacks adds a callback for a response on multiple methods to the proxy.

func (*Proxy) AddResponses

func (p *Proxy) AddResponses(spoofs ...*proxy.Spoof)

AddResponses adds spoofs for a set of responses to the proxy.

func (*Proxy) Cancel

func (p *Proxy) Cancel() error

func (*Proxy) EngineRPCAddress

func (p *Proxy) EngineRPCAddress() (string, error)

func (*Proxy) RPC

func (p *Proxy) RPC() *rpc.Client

func (*Proxy) UserRPCAddress

func (p *Proxy) UserRPCAddress() (string, error)

type ProxyProvider

type ProxyProvider interface {
	Proxy() *Proxy
}

Interface used to provide a proxy for a given execution client

type TD

type TD struct {
	TotalDifficulty *hexutil.Big `json:"totalDifficulty"`
}

Eth RPC Helper structs to fetch the TotalDifficulty

type TotalDifficultyHeader

type TotalDifficultyHeader struct {
	types.Header
	TD
}

func (*TotalDifficultyHeader) UnmarshalJSON

func (tdh *TotalDifficultyHeader) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL