ligoprotocol

package
v0.0.0-...-5d85a61 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: GPL-3.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusMsg          = 0x00
	NewBlockHashesMsg  = 0x01
	TxMsg              = 0x02
	GetBlockHeadersMsg = 0x03
	BlockHeadersMsg    = 0x04
	GetBlockBodiesMsg  = 0x05
	BlockBodiesMsg     = 0x06
	NewBlockMsg        = 0x07

	GetNodeDataMsg = 0x0d
	NodeDataMsg    = 0x0e
	GetReceiptsMsg = 0x0f
	ReceiptsMsg    = 0x10

	TX3ProofDataMsg = 0x18

	GetPreImagesMsg = 0x19
	PreImagesMsg    = 0x1a
	TrieNodeDataMsg = 0x1b
)
View Source
const (
	ErrMsgTooLarge = iota
	ErrDecode
	ErrInvalidMsgCode
	ErrProtocolVersionMismatch
	ErrNetworkIdMismatch
	ErrGenesisBlockMismatch
	ErrNoStatusMsg
	ErrExtraStatusMsg
	ErrSuspendedPeer
	ErrTX3ValidateFail
)
View Source
const ProtocolMaxMsgSize = 10 * 1024 * 1024

Variables

View Source
var DefaultConfig = Config{

	SyncMode: downloader.FullSync,

	NetworkId:      9910,
	DatabaseCache:  512,
	TrieCleanCache: 256,
	TrieDirtyCache: 256,
	TrieTimeout:    60 * time.Minute,
	MinerGasFloor:  120000000,
	MinerGasCeil:   120000000,
	MinerGasPrice:  big.NewInt(params.GWei),

	TxPool: core.DefaultTxPoolConfig,
	GPO: gasprice.Config{
		Blocks:     20,
		Percentile: 60,
	},
}
View Source
var ProtocolVersions = []uint{intprotocol65, intprotocol64, intprotocol63}

Functions

func CreateConsensusEngine

func CreateConsensusEngine(ctx *node.ServiceContext, config *Config, chainConfig *params.ChainConfig, db ligodb.Database,
	cliCtx *cli.Context, cch core.CrossChainHelper) consensus.Tendermint

func NewBloomIndexer

func NewBloomIndexer(db ligodb.Database, size uint64) *core.ChainIndexer

Types

type BloomIndexer

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

func (*BloomIndexer) Commit

func (b *BloomIndexer) Commit() error

func (*BloomIndexer) Process

func (b *BloomIndexer) Process(header *types.Header)

func (*BloomIndexer) Reset

func (b *BloomIndexer) Reset(section uint64, lastSectionHead common.Hash) error

type Config

type Config struct {
	Genesis *core.Genesis `toml:",omitempty"`

	NetworkId uint64
	SyncMode  downloader.SyncMode

	NoPruning bool

	SkipBcVersionCheck bool `toml:"-"`
	DatabaseHandles    int  `toml:"-"`
	DatabaseCache      int

	TrieCleanCache int
	TrieDirtyCache int
	TrieTimeout    time.Duration

	Coinbase      common.Address `toml:",omitempty"`
	ExtraData     []byte         `toml:",omitempty"`
	MinerGasFloor uint64
	MinerGasCeil  uint64
	MinerGasPrice *big.Int

	SolcPath string

	TxPool core.TxPoolConfig

	GPO gasprice.Config

	EnablePreimageRecording bool

	Tendermint tendermint.Config

	DocRoot string `toml:"-"`

	PruneStateData bool
	PruneBlockData bool
}

func (Config) MarshalTOML

func (c Config) MarshalTOML() (interface{}, error)

func (*Config) UnmarshalTOML

func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error

type EthApiBackend

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

func (*EthApiBackend) AccountManager

func (b *EthApiBackend) AccountManager() *accounts.Manager

func (*EthApiBackend) BlockByNumber

func (b *EthApiBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)

func (*EthApiBackend) BloomStatus

func (b *EthApiBackend) BloomStatus() (uint64, uint64)

func (*EthApiBackend) BroadcastTX3ProofData

func (b *EthApiBackend) BroadcastTX3ProofData(proofData *types.TX3ProofData)

func (*EthApiBackend) ChainConfig

func (b *EthApiBackend) ChainConfig() *params.ChainConfig

func (*EthApiBackend) ChainDb

func (b *EthApiBackend) ChainDb() ligodb.Database

func (*EthApiBackend) CurrentBlock

func (b *EthApiBackend) CurrentBlock() *types.Block

func (*EthApiBackend) Downloader

func (b *EthApiBackend) Downloader() *downloader.Downloader

func (*EthApiBackend) Engine

func (b *EthApiBackend) Engine() consensus.Engine

func (*EthApiBackend) EventMux

func (b *EthApiBackend) EventMux() *event.TypeMux

func (*EthApiBackend) GetBlock

func (b *EthApiBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*EthApiBackend) GetCrossChainHelper

func (b *EthApiBackend) GetCrossChainHelper() core.CrossChainHelper

func (*EthApiBackend) GetEVM

func (b *EthApiBackend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error)

func (*EthApiBackend) GetLogs

func (b *EthApiBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error)

func (*EthApiBackend) GetPoolNonce

func (b *EthApiBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)

func (*EthApiBackend) GetPoolTransaction

func (b *EthApiBackend) GetPoolTransaction(hash common.Hash) *types.Transaction

func (*EthApiBackend) GetPoolTransactions

func (b *EthApiBackend) GetPoolTransactions() (types.Transactions, error)

func (*EthApiBackend) GetReceipts

func (b *EthApiBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)

func (*EthApiBackend) GetTd

func (b *EthApiBackend) GetTd(blockHash common.Hash) *big.Int

func (*EthApiBackend) HeaderByNumber

func (b *EthApiBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)

func (*EthApiBackend) ProtocolVersion

func (b *EthApiBackend) ProtocolVersion() int

func (*EthApiBackend) SendTx

func (b *EthApiBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error

func (*EthApiBackend) ServiceFilter

func (b *EthApiBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)

func (*EthApiBackend) SetHead

func (b *EthApiBackend) SetHead(number uint64)

func (*EthApiBackend) StateAndHeaderByNumber

func (b *EthApiBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)

func (*EthApiBackend) Stats

func (b *EthApiBackend) Stats() (pending int, queued int)

func (*EthApiBackend) SubscribeChainEvent

func (b *EthApiBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription

func (*EthApiBackend) SubscribeChainHeadEvent

func (b *EthApiBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription

func (*EthApiBackend) SubscribeChainSideEvent

func (b *EthApiBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription

func (*EthApiBackend) SubscribeLogsEvent

func (b *EthApiBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription

func (*EthApiBackend) SubscribeRemovedLogsEvent

func (b *EthApiBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription

func (*EthApiBackend) SubscribeTxPreEvent

func (b *EthApiBackend) SubscribeTxPreEvent(ch chan<- core.TxPreEvent) event.Subscription

func (*EthApiBackend) SuggestPrice

func (b *EthApiBackend) SuggestPrice(ctx context.Context) (*big.Int, error)

func (*EthApiBackend) TxPoolContent

type LesServer

type LesServer interface {
	Start(srvr *p2p.Server)
	Stop()
	Protocols() []p2p.Protocol
	SetBloomBitsIndexer(bbIndexer *core.ChainIndexer)
}

type LigoAI

type LigoAI struct {
	ApiBackend *EthApiBackend
	// contains filtered or unexported fields
}

func New

func New(ctx *node.ServiceContext, config *Config, cliCtx *cli.Context,
	cch core.CrossChainHelper, logger log.Logger, isTestnet bool) (*LigoAI, error)

func (*LigoAI) APIs

func (s *LigoAI) APIs() []rpc.API

func (*LigoAI) AccountManager

func (s *LigoAI) AccountManager() *accounts.Manager

func (*LigoAI) BlockChain

func (s *LigoAI) BlockChain() *core.BlockChain

func (*LigoAI) ChainConfig

func (s *LigoAI) ChainConfig() *params.ChainConfig

func (*LigoAI) ChainDb

func (s *LigoAI) ChainDb() ligodb.Database

func (*LigoAI) Coinbase

func (s *LigoAI) Coinbase() (eb common.Address, err error)

func (*LigoAI) Downloader

func (s *LigoAI) Downloader() *downloader.Downloader

func (*LigoAI) Engine

func (s *LigoAI) Engine() consensus.Tendermint

func (*LigoAI) EthVersion

func (s *LigoAI) EthVersion() int

func (*LigoAI) EventMux

func (s *LigoAI) EventMux() *event.TypeMux

func (*LigoAI) IsListening

func (s *LigoAI) IsListening() bool

func (*LigoAI) IsMining

func (s *LigoAI) IsMining() bool

func (*LigoAI) Miner

func (s *LigoAI) Miner() *miner.Miner

func (*LigoAI) NetVersion

func (s *LigoAI) NetVersion() uint64

func (*LigoAI) Protocols

func (s *LigoAI) Protocols() []p2p.Protocol

func (*LigoAI) ResetWithGenesisBlock

func (s *LigoAI) ResetWithGenesisBlock(gb *types.Block)

func (*LigoAI) SetCoinbase

func (self *LigoAI) SetCoinbase(coinbase common.Address)

func (*LigoAI) Start

func (s *LigoAI) Start(srvr *p2p.Server) error

func (*LigoAI) StartMining

func (s *LigoAI) StartMining(local bool) error

func (*LigoAI) StartScanAndPrune

func (s *LigoAI) StartScanAndPrune(blockNumber uint64)

func (*LigoAI) Stop

func (s *LigoAI) Stop() error

func (*LigoAI) StopMining

func (s *LigoAI) StopMining()

func (*LigoAI) TxPool

func (s *LigoAI) TxPool() *core.TxPool

type NodeInfo

type NodeInfo struct {
	Network    uint64              `json:"network"`
	Difficulty *big.Int            `json:"difficulty"`
	Genesis    common.Hash         `json:"genesis"`
	Config     *params.ChainConfig `json:"config"`
	Head       common.Hash         `json:"head"`
}

type PeerInfo

type PeerInfo struct {
	Version    int      `json:"version"`
	Difficulty *big.Int `json:"difficulty"`
	Head       string   `json:"head"`
}

type PrivateAdminAPI

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

func NewPrivateAdminAPI

func NewPrivateAdminAPI(eth *LigoAI) *PrivateAdminAPI

func (*PrivateAdminAPI) ExportChain

func (api *PrivateAdminAPI) ExportChain(file string) (bool, error)

func (*PrivateAdminAPI) ImportChain

func (api *PrivateAdminAPI) ImportChain(file string) (bool, error)

func (*PrivateAdminAPI) LatestPruneState

func (api *PrivateAdminAPI) LatestPruneState() (*datareduction.PruneStatus, error)

func (*PrivateAdminAPI) PruneStateData

func (api *PrivateAdminAPI) PruneStateData(height *hexutil.Uint64) (bool, error)

type PrivateDebugAPI

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

func NewPrivateDebugAPI

func NewPrivateDebugAPI(config *params.ChainConfig, eth *LigoAI) *PrivateDebugAPI

func (*PrivateDebugAPI) BroadcastRawDBNode

func (api *PrivateDebugAPI) BroadcastRawDBNode(ctx context.Context, hash common.Hash) (map[string]error, error)

func (*PrivateDebugAPI) BrokenPreimage

func (api *PrivateDebugAPI) BrokenPreimage(ctx context.Context, hash common.Hash, preimage hexutil.Bytes) (hexutil.Bytes, error)

func (*PrivateDebugAPI) FindBadPreimage

func (api *PrivateDebugAPI) FindBadPreimage(ctx context.Context) (interface{}, error)

func (*PrivateDebugAPI) GetBadBlocks

func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]core.BadBlockArgs, error)

func (*PrivateDebugAPI) GetModifiedAccountsByHash

func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error)

func (*PrivateDebugAPI) GetModifiedAccountsByNumber

func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error)

func (*PrivateDebugAPI) Preimage

func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)

func (*PrivateDebugAPI) PrintTrieNode

func (api *PrivateDebugAPI) PrintTrieNode(ctx context.Context, root common.Hash) ([]resultNode, error)

func (*PrivateDebugAPI) ReadRawDBNode

func (api *PrivateDebugAPI) ReadRawDBNode(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)

func (*PrivateDebugAPI) RemotePreimage

func (api *PrivateDebugAPI) RemotePreimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)

func (*PrivateDebugAPI) RemovePreimage

func (api *PrivateDebugAPI) RemovePreimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)

func (*PrivateDebugAPI) StorageRangeAt

func (api *PrivateDebugAPI) StorageRangeAt(ctx context.Context, blockHash common.Hash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error)

func (*PrivateDebugAPI) TraceBlock

func (api *PrivateDebugAPI) TraceBlock(ctx context.Context, blob []byte, config *TraceConfig) ([]*txTraceResult, error)

func (*PrivateDebugAPI) TraceBlockByHash

func (api *PrivateDebugAPI) TraceBlockByHash(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)

func (*PrivateDebugAPI) TraceBlockByNumber

func (api *PrivateDebugAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]*txTraceResult, error)

func (*PrivateDebugAPI) TraceBlockFromFile

func (api *PrivateDebugAPI) TraceBlockFromFile(ctx context.Context, file string, config *TraceConfig) ([]*txTraceResult, error)

func (*PrivateDebugAPI) TraceChain

func (api *PrivateDebugAPI) TraceChain(ctx context.Context, start, end rpc.BlockNumber, config *TraceConfig) (*rpc.Subscription, error)

func (*PrivateDebugAPI) TraceTransaction

func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error)

type PrivateMinerAPI

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

func NewPrivateMinerAPI

func NewPrivateMinerAPI(e *LigoAI) *PrivateMinerAPI

func (*PrivateMinerAPI) SetCoinbase

func (api *PrivateMinerAPI) SetCoinbase(coinbase common.Address) bool

func (*PrivateMinerAPI) SetExtra

func (api *PrivateMinerAPI) SetExtra(extra string) (bool, error)

func (*PrivateMinerAPI) SetGasPrice

func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool

func (*PrivateMinerAPI) Start

func (api *PrivateMinerAPI) Start(threads *int) error

func (*PrivateMinerAPI) Stop

func (api *PrivateMinerAPI) Stop() bool

type ProtocolManager

type ProtocolManager struct {
	SubProtocols []p2p.Protocol
	// contains filtered or unexported fields
}

func NewProtocolManager

func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, networkId uint64, mux *event.TypeMux, txpool txPool, engine consensus.Engine, blockchain *core.BlockChain, chaindb ligodb.Database, cch core.CrossChainHelper) (*ProtocolManager, error)

func (*ProtocolManager) BroadcastBlock

func (pm *ProtocolManager) BroadcastBlock(block *types.Block, propagate bool)

func (*ProtocolManager) BroadcastMessage

func (pm *ProtocolManager) BroadcastMessage(msgcode uint64, data interface{})

func (*ProtocolManager) BroadcastTX3ProofData

func (pm *ProtocolManager) BroadcastTX3ProofData(hash common.Hash, proofData *types.TX3ProofData)

func (*ProtocolManager) BroadcastTx

func (pm *ProtocolManager) BroadcastTx(hash common.Hash, tx *types.Transaction)

func (*ProtocolManager) Enqueue

func (pm *ProtocolManager) Enqueue(id string, block *types.Block)

func (*ProtocolManager) FindPeers

func (self *ProtocolManager) FindPeers(targets map[common.Address]bool) map[common.Address]consensus.Peer

func (*ProtocolManager) NodeInfo

func (self *ProtocolManager) NodeInfo() *NodeInfo

func (*ProtocolManager) Start

func (pm *ProtocolManager) Start(maxPeers int)

func (*ProtocolManager) Stop

func (pm *ProtocolManager) Stop()

func (*ProtocolManager) TryFixBadPreimages

func (pm *ProtocolManager) TryFixBadPreimages()

type PublicDebugAPI

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

func NewPublicDebugAPI

func NewPublicDebugAPI(eth *LigoAI) *PublicDebugAPI

func (*PublicDebugAPI) DumpBlock

func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error)

type PublicEthereumAPI

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

func NewPublicEthereumAPI

func NewPublicEthereumAPI(e *LigoAI) *PublicEthereumAPI

func (*PublicEthereumAPI) Coinbase

func (api *PublicEthereumAPI) Coinbase() (string, error)

func (*PublicEthereumAPI) Etherbase

func (api *PublicEthereumAPI) Etherbase() (string, error)

type PublicMinerAPI

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

func NewPublicMinerAPI

func NewPublicMinerAPI(e *LigoAI) *PublicMinerAPI

func (*PublicMinerAPI) GetWork

func (api *PublicMinerAPI) GetWork() ([3]string, error)

func (*PublicMinerAPI) Mining

func (api *PublicMinerAPI) Mining() bool

func (*PublicMinerAPI) SubmitHashrate

func (api *PublicMinerAPI) SubmitHashrate(hashrate hexutil.Uint64, id common.Hash) bool

func (*PublicMinerAPI) SubmitWork

func (api *PublicMinerAPI) SubmitWork(nonce types.BlockNonce, solution, digest common.Hash) bool

type StdTraceConfig

type StdTraceConfig struct {
	*vm.LogConfig
	Reexec *uint64
	TxHash common.Hash
}

type StorageRangeResult

type StorageRangeResult struct {
	Storage storageMap   `json:"storage"`
	NextKey *common.Hash `json:"nextKey"`
}

type TraceConfig

type TraceConfig struct {
	*vm.LogConfig
	Tracer  *string
	Timeout *string
	Reexec  *uint64
}

Directories

Path Synopsis
Package tracers is a collection of JavaScript transaction tracers.
Package tracers is a collection of JavaScript transaction tracers.
internal/tracers
Package tracers contains the actual JavaScript tracer assets.
Package tracers contains the actual JavaScript tracer assets.

Jump to

Keyboard shortcuts

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