service

package
v0.0.0-...-1845101 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: GPL-3.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExceedsValidatorUpdateBlock = fmt.Errorf("ErrExceedsValidatorUpdateBlock")
View Source
var ErrHandlerExit = fmt.Errorf("exit")
View Source
var ErrMissingEth1Block = fmt.Errorf("beacon chain missing eth1 block: %w", ErrHandlerExit)

Functions

This section is empty.

Types

type CachedBeaconBlock

type CachedBeaconBlock struct {
	BeaconBlockId        uint64
	ExecutionBlockNumber uint64
	ProposerIndex        uint64
	Withdrawals          []*CachedWithdrawal
}

type CachedTransaction

type CachedTransaction struct {
	// big endian
	Recipient []byte
	// big endian
	Amount []byte
}

type CachedWithdrawal

type CachedWithdrawal struct {
	ValidatorIndex uint64
	Amount         uint64
}

type ExitElection

type ExitElection struct {
	WithdrawCycle      uint64
	ValidatorIndexList []uint64
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

type Node

type Node struct {
	NodeAddress  common.Address
	NodeType     uint8 // 1 light node 2 trust node
	PubkeyNumber uint64
}

type NodeNewReward

type NodeNewReward struct {
	Address                string          `json:"address"` // hex with 0x
	TotalRewardAmount      decimal.Decimal `json:"totalRewardAmount"`
	TotalExitDepositAmount decimal.Decimal `json:"totalExitDepositAmount"`
}

type NodeNewRewardsMap

type NodeNewRewardsMap map[common.Address]*NodeNewReward // nodeAddress(hex with 0x) -> nodeNewReward

type NodeReward

type NodeReward struct {
	Address                string          `json:"address"` // hex with 0x
	Index                  uint32          `json:"index"`
	TotalRewardAmount      decimal.Decimal `json:"totalRewardAmount"`      // accumulative
	TotalExitDepositAmount decimal.Decimal `json:"totalExitDepositAmount"` // accumulative
	Proof                  string          `json:"proof"`                  // proof of {address/index/totalRewardAmount/totalExitDepositAmount}
	TotalDepositAmount     decimal.Decimal `json:"totalDepositAmount"`     // accumulative, totalDepositAmount >= totalExitDepositAmount
}

type NodeRewardsList

type NodeRewardsList struct {
	Epoch uint64
	List  []*NodeReward
}

type NodeRewardsMap

type NodeRewardsMap map[common.Address]*NodeReward // nodeAddress(hex with 0x) -> nodeReward

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(
	cfg *config.Config,
	manager *ServiceManager,
	conn *connection.CachedConnection,
	localStore *local_store.LocalStore,
) (*Service, error)

func (*Service) GetValidatorDepositedListBeforeBlock

func (s *Service) GetValidatorDepositedListBeforeBlock(block uint64) []*Validator

func (*Service) Start

func (s *Service) Start() error

func (*Service) Stop

func (s *Service) Stop()

type ServiceManager

type ServiceManager struct {
	// contains filtered or unexported fields
}

func NewServiceManager

func NewServiceManager(cfg *config.Config, keyPair *secp256k1.Keypair) (*ServiceManager, error)

func (*ServiceManager) CacheBeaconBlock

func (m *ServiceManager) CacheBeaconBlock(blockId uint64) (*CachedBeaconBlock, bool, error)

func (*ServiceManager) Start

func (m *ServiceManager) Start() error

func (*ServiceManager) Stop

func (m *ServiceManager) Stop()

type StakerWithdrawal

type StakerWithdrawal struct {
	WithdrawIndex uint64

	Address            common.Address
	EthAmount          decimal.Decimal
	BlockNumber        uint64
	ClaimedBlockNumber uint64
}

type Validator

type Validator struct {
	Pubkey []byte

	NodeAddress           common.Address
	DepositSignature      []byte
	NodeDepositAmountDeci decimal.Decimal // decimals 18
	NodeDepositAmount     uint64          //decimals 9
	DepositBlock          uint64
	ActiveEpoch           uint64
	EligibleEpoch         uint64
	ExitEpoch             uint64
	WithdrawableEpoch     uint64
	NodeType              uint8  // 1 light node 2 trust node
	ValidatorIndex        uint64 // Notice!!!!!!: validator index is zero before status waiting

	Balance          uint64 // realtime balance
	EffectiveBalance uint64 // realtime effectiveBalance
	Status           uint8  // status details defined in pkg/utils/eth2.go
}

Jump to

Keyboard shortcuts

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