relay

package
v0.0.0-...-7a2e46d Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLength = fmt.Errorf("incorrect byte length")
	ErrSign   = fmt.Errorf("negative value casted as unsigned int")
)
View Source
var ZeroU256 = boostTypes.IntToU256(0)

Functions

func BoostBidToBidTrace

func BoostBidToBidTrace(bidTrace *boostTypes.BidTrace) *apiv1.BidTrace

func SanityBuilderBlock

func SanityBuilderBlock(payload builderTypes.BuilderBlockBid) error

func SignedBuilderBid

func SignedBuilderBid(builderBid builderTypes.BuilderBlockBid, sk *bls.SecretKey, publicKey phase0.BLSPubKey, domain signing.Domain) (*relayTypes.SignedBuilderBlockBid, error)

func SignedBuilderBidOpen

func SignedBuilderBidOpen(ExecutionPayloadHeader *common.VersionedExecutionPayloadHeader,
	bidValue *big.Int,
	sk *bls.SecretKey,
	publicKey phase0.BLSPubKey,
	domain signing.Domain) (*relayTypes.SignedBuilderBlockBid, error)

func U256StrToUint256

func U256StrToUint256(s types.U256Str) *uint256.Int

Types

type Address

type Address [20]byte

type BidTrace

type BidTrace struct {
	Slot                 uint64    `json:"slot,string"`
	ParentHash           Hash      `json:"parent_hash" ssz-size:"32"`
	BlockHash            Hash      `json:"block_hash" ssz-size:"32"`
	BuilderPubkey        PublicKey `json:"builder_pubkey" ssz-size:"48"`
	ProposerPubkey       PublicKey `json:"proposer_pubkey" ssz-size:"48"`
	ProposerFeeRecipient Address   `json:"proposer_fee_recipient" ssz-size:"20"`
	GasLimit             uint64    `json:"gas_limit,string"`
	GasUsed              uint64    `json:"gas_used,string"`
	Value                U256Str   `json:"value" ssz-size:"32"`
}

type Bloom

type Bloom [256]byte

type BuilderGetValidatorsResponseEntry

type BuilderGetValidatorsResponseEntry struct {
	Slot           uint64                                  `json:"slot,string"`
	ValidatorIndex uint64                                  `json:"validator_index,string"`
	Entry          *boostTypes.SignedValidatorRegistration `json:"entry"`
}

type BuilderOpenBid

type BuilderOpenBid struct {
	Capella *capella.SubmitBlockRequest
}

func (*BuilderOpenBid) BuilderPubkey

func (b *BuilderOpenBid) BuilderPubkey() phase0.BLSPubKey

func (*BuilderOpenBid) ExecutionPayloadHeader

func (b *BuilderOpenBid) ExecutionPayloadHeader() (*commonTypes.VersionedExecutionPayloadHeader, error)

func (*BuilderOpenBid) ExecutionPayloadResponse

func (b *BuilderOpenBid) ExecutionPayloadResponse() (*utils.GetPayloadResponse, error)

func (*BuilderOpenBid) GetHeaderResponse

func (b *BuilderOpenBid) GetHeaderResponse(signedBid *relayTypes.SignedBuilderBlockBid) (*utils.GetHeaderResponse, error)

func (*BuilderOpenBid) HasExecutionPayload

func (b *BuilderOpenBid) HasExecutionPayload() bool

func (*BuilderOpenBid) Message

func (b *BuilderOpenBid) Message() *apiv1.BidTrace

func (*BuilderOpenBid) NumTx

func (b *BuilderOpenBid) NumTx() int

func (*BuilderOpenBid) Signature

func (b *BuilderOpenBid) Signature() phase0.BLSSignature

func (*BuilderOpenBid) Slot

func (b *BuilderOpenBid) Slot() uint64

func (*BuilderOpenBid) Value

func (b *BuilderOpenBid) Value() *big.Int

type BuilderWinningBid

type BuilderWinningBid struct {
	BidID             string  `json:"bid_id"`
	HighestBidValue   big.Int `json:"highest_bid_value"`
	HighestBidBuilder string  `json:"highest_bid_builder"`
}

type EcdsaAddress

type EcdsaAddress [20]byte

func (EcdsaAddress) String

func (e EcdsaAddress) String() string

type EcdsaSignature

type EcdsaSignature [65]byte

func (EcdsaSignature) String

func (e EcdsaSignature) String() string

type EthNetwork

type EthNetwork struct {
	Network             uint64
	GenesisTime         uint64
	DomainBuilder       signing.Domain
	DomainBeaconCapella signing.Domain
}

func NewEthNetworkDetails

func NewEthNetworkDetails(network string, beaconClient *beaconclient.MultiBeaconClient) (*EthNetwork, error)

type ExecutionPayload

type ExecutionPayload struct {
	ParentHash    Hash            `json:"parent_hash" ssz-size:"32"`
	FeeRecipient  Address         `json:"fee_recipient" ssz-size:"20"`
	StateRoot     Root            `json:"state_root" ssz-size:"32"`
	ReceiptsRoot  Root            `json:"receipts_root" ssz-size:"32"`
	LogsBloom     Bloom           `json:"logs_bloom" ssz-size:"256"`
	Random        Hash            `json:"prev_randao" ssz-size:"32"`
	BlockNumber   uint64          `json:"block_number,string"`
	GasLimit      uint64          `json:"gas_limit,string"`
	GasUsed       uint64          `json:"gas_used,string"`
	Timestamp     uint64          `json:"timestamp,string"`
	ExtraData     []byte          `json:"extra_data" ssz-max:"32"`
	BaseFeePerGas U256Str         `json:"base_fee_per_gas" ssz-max:"32"`
	BlockHash     Hash            `json:"block_hash" ssz-size:"32"`
	Transactions  []hexutil.Bytes `json:"transactions" ssz-max:"1048576,1073741824" ssz-size:"?,?"`
}

type HTTPError

type HTTPError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type Hash

type Hash [32]byte

func (Hash) String

func (h Hash) String() string

type ProposerReqParams

type ProposerReqParams struct {
	Slot              uint64
	ProposerPubKeyHex string
	ParentHashHex     string
}

type PublicKey

type PublicKey [48]byte

type Relay

type Relay struct {
	URL string
	// contains filtered or unexported fields
}

func NewRelayAPI

func NewRelayAPI(params *RelayParams, log logrus.Entry) (relay *Relay, err error)

func (*Relay) BlockSlotTimestamp

func (relay *Relay) BlockSlotTimestamp(slot uint64) uint64

func (*Relay) RespondError

func (relay *Relay) RespondError(w http.ResponseWriter, code int, message string)

func (*Relay) RespondOK

func (relay *Relay) RespondOK(w http.ResponseWriter, response any)

func (*Relay) Routes

func (relay *Relay) Routes() http.Handler

func (*Relay) StartServer

func (relay *Relay) StartServer(ServerParams *RelayServerParams) (err error)

func (*Relay) TESThandleProposerHeader

func (relay *Relay) TESThandleProposerHeader(w http.ResponseWriter, req *http.Request)

type RelayConfig

type RelayConfig struct {
	MQTTBroker string `json:"mqtt_broker"`
	MQTTPort   uint16 `json:"mqtt_port"`
	PublicKey  string `json:"public_key"`
	Chain      uint64 `json:"chain"`
	Slot       uint64 `json:"current_slot"`
}

type RelayParams

type RelayParams struct {
	DbURL          string
	DatabaseParams databaseTypes.DatabaseOpts
	DbDriver       databaseTypes.DatabaseDriver
	DeleteTables   bool

	URL string

	PonPoolURL    string
	PonPoolAPIKey string

	BulletinBoardParams bulletinBoardTypes.RelayMQTTOpts

	BeaconClientUrls []string

	ReporterURL string

	Network string

	RedisURI string

	BidTimeOut time.Duration

	Sk *bls.SecretKey

	Version string

	DiscordWebhook string
	OpenRelay      bool
}

type RelayServerParams

type RelayServerParams struct {
	ReadTimeout       time.Duration
	ReadHeaderTimeout time.Duration
	WriteTimeout      time.Duration
	IdleTimeout       time.Duration
}

type Root

type Root = Hash

type Signature

type Signature phase0.BLSSignature

type Transaction

type Transaction []byte

func (Transaction) String

func (t Transaction) String() string

type U256Str

type U256Str Hash

func (*U256Str) FromBig

func (n *U256Str) FromBig(x *big.Int) error

func (*U256Str) FromSlice

func (n *U256Str) FromSlice(x []byte) error

func (U256Str) MarshalText

func (n U256Str) MarshalText() ([]byte, error)

func (*U256Str) String

func (n *U256Str) String() string

func (*U256Str) UnmarshalJSON

func (n *U256Str) UnmarshalJSON(input []byte) error

func (*U256Str) UnmarshalText

func (n *U256Str) UnmarshalText(input []byte) error

Jump to

Keyboard shortcuts

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