server

package
v0.0.1-tenderly Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: GPL-3.0, LGPL-3.0 Imports: 86 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnavailable = errors.New("bor service is currently unavailable, try again later")
View Source
var ErrUnavailable2 = errors.New("bor service unavailable even after waiting for 10 seconds, make sure bor is running")

Functions

func CloseMockServer

func CloseMockServer(server *Server)

func ConvertBloomToProtoBloom

func ConvertBloomToProtoBloom(bloom types.Bloom) *protobor.Bloom

func ConvertLogsToProtoLogs

func ConvertLogsToProtoLogs(logs []*types.Log) []*protobor.Log

func ConvertReceiptToProtoReceipt

func ConvertReceiptToProtoReceipt(receipt *types.Receipt) *protobor.Receipt

func ConvertTopicsToProtoTopics

func ConvertTopicsToProtoTopics(topics []common.Hash) []*protocommon.H256

func DefaultDataDir

func DefaultDataDir() string

func Hostname

func Hostname() string

func MakeDatabaseHandles

func MakeDatabaseHandles(max int) (int, error)

func MakePasswordListFromFile

func MakePasswordListFromFile(path string) ([]string, error)

func PeerInfoToPeer

func PeerInfoToPeer(info *p2p.PeerInfo) *proto.Peer

func WithGRPCAddress

func WithGRPCAddress() serverOption

func WithGRPCListener

func WithGRPCListener(lis net.Listener) serverOption

Types

type APIConfig

type APIConfig struct {
	// Enabled selects whether the api is enabled
	Enabled bool `hcl:"enabled,optional" toml:"enabled,optional"`

	// Port is the port number for this api
	Port uint64 `hcl:"port,optional" toml:"port,optional"`

	// Prefix is the http prefix to expose this api
	Prefix string `hcl:"prefix,optional" toml:"prefix,optional"`

	// Host is the address to bind the api
	Host string `hcl:"host,optional" toml:"host,optional"`

	// API is the list of enabled api modules
	API []string `hcl:"api,optional" toml:"api,optional"`

	// VHost is the list of valid virtual hosts
	VHost []string `hcl:"vhosts,optional" toml:"vhosts,optional"`

	// Cors is the list of Cors endpoints
	Cors []string `hcl:"corsdomain,optional" toml:"corsdomain,optional"`

	// Origins is the list of endpoints to accept requests from (only consumed for websockets)
	Origins []string `hcl:"origins,optional" toml:"origins,optional"`

	// ExecutionPoolSize is max size of workers to be used for rpc execution
	ExecutionPoolSize uint64 `hcl:"ep-size,optional" toml:"ep-size,optional"`

	// ExecutionPoolRequestTimeout is timeout used by execution pool for rpc execution
	ExecutionPoolRequestTimeout    time.Duration `hcl:"-,optional" toml:"-"`
	ExecutionPoolRequestTimeoutRaw string        `hcl:"ep-requesttimeout,optional" toml:"ep-requesttimeout,optional"`
}

type AUTHConfig

type AUTHConfig struct {
	// JWTSecret is the hex-encoded jwt secret.
	JWTSecret string `hcl:"jwtsecret,optional" toml:"jwtsecret,optional"`

	// Addr is the listening address on which authenticated APIs are provided.
	Addr string `hcl:"addr,optional" toml:"addr,optional"`

	// Port is the port number on which authenticated APIs are provided.
	Port uint64 `hcl:"port,optional" toml:"port,optional"`

	// VHosts is the list of virtual hostnames which are allowed on incoming requests
	// for the authenticated api. This is by default {'localhost'}.
	VHosts []string `hcl:"vhosts,optional" toml:"vhosts,optional"`
}

type AccountsConfig

type AccountsConfig struct {
	// Unlock is the list of addresses to unlock in the node
	Unlock []string `hcl:"unlock,optional" toml:"unlock,optional"`

	// PasswordFile is the file where the account passwords are stored
	PasswordFile string `hcl:"password,optional" toml:"password,optional"`

	// AllowInsecureUnlock allows user to unlock accounts in unsafe http environment.
	AllowInsecureUnlock bool `hcl:"allow-insecure-unlock,optional" toml:"allow-insecure-unlock,optional"`

	// UseLightweightKDF enables a faster but less secure encryption of accounts
	UseLightweightKDF bool `hcl:"lightkdf,optional" toml:"lightkdf,optional"`

	// DisableBorWallet disables the personal wallet endpoints
	DisableBorWallet bool `hcl:"disable-bor-wallet,optional" toml:"disable-bor-wallet,optional"`
}

type CacheConfig

type CacheConfig struct {
	// Cache is the amount of cache of the node
	Cache uint64 `hcl:"cache,optional" toml:"cache,optional"`

	// PercGc is percentage of cache used for garbage collection
	PercGc uint64 `hcl:"gc,optional" toml:"gc,optional"`

	// PercSnapshot is percentage of cache used for snapshots
	PercSnapshot uint64 `hcl:"snapshot,optional" toml:"snapshot,optional"`

	// PercDatabase is percentage of cache used for the database
	PercDatabase uint64 `hcl:"database,optional" toml:"database,optional"`

	// PercTrie is percentage of cache used for the trie
	PercTrie uint64 `hcl:"trie,optional" toml:"trie,optional"`

	// NoPrefetch is used to disable prefetch of tries
	NoPrefetch bool `hcl:"noprefetch,optional" toml:"noprefetch,optional"`

	// Preimages is used to enable the track of hash preimages
	Preimages bool `hcl:"preimages,optional" toml:"preimages,optional"`

	// TxLookupLimit sets the maximum number of blocks from head whose tx indices are reserved.
	TxLookupLimit uint64 `hcl:"txlookuplimit,optional" toml:"txlookuplimit,optional"`

	// Number of block states to keep in memory (default = 128)
	TriesInMemory uint64 `hcl:"triesinmemory,optional" toml:"triesinmemory,optional"`

	// This is the number of blocks for which logs will be cached in the filter system.
	FilterLogCacheSize int `hcl:"blocklogs,optional" toml:"blocklogs,optional"`

	// Time after which the Merkle Patricia Trie is stored to disc from memory
	TrieTimeout    time.Duration `hcl:"-,optional" toml:"-"`
	TrieTimeoutRaw string        `hcl:"timeout,optional" toml:"timeout,optional"`

	// Directory path to the journal used for persisting trie data across node restarts
	TrieJournalDirectory string `hcl:"triejournaldirectory,optional" toml:"triejournaldirectory,optional"`

	// Raise the open file descriptor resource limit (default = system fd limit)
	FDLimit int `hcl:"fdlimit,optional" toml:"fdlimit,optional"`

	// Address-specific cache sizes for biased caching (format: "address=sizeMB,address=sizeMB")
	// Size is specified in MB (megabytes)
	// Example: "0x1234...=1024,0x5678...=512" (1024MB and 512MB)
	AddressCacheSizesRaw string            `hcl:"addresscachesizes,optional" toml:"addresscachesizes,optional"`
	AddressCacheSizes    map[string]string `hcl:"-,optional" toml:"-"`

	// PreloadRateLimit limits cache preload I/O in bytes per second per address.
	// This prevents preloading from overwhelming the disk during sync.
	// Accepts values like "500KB", "1MB", "0" (for unlimited). Default: 1MB/s
	PreloadRateLimit string `hcl:"preloadratelimit,optional" toml:"preloadratelimit,optional"`

	// GC settings
	// GoMemLimit sets the soft memory limit for the runtime
	GoMemLimit string `hcl:"gomemlimit,optional" toml:"gomemlimit,optional"`

	// GoGC sets the initial garbage collection target percentage
	GoGC int `hcl:"gogc,optional" toml:"gogc,optional"`

	// GoDebug sets debugging variables for the runtime
	GoDebug string `hcl:"godebug,optional" toml:"godebug,optional"`
}

type Command

type Command struct {
	UI cli.Ui
	// contains filtered or unexported fields
}

Command is the command to start the sever

func (*Command) Flags

func (c *Command) Flags(config *Config) *flagset.Flagset

func (*Command) GetConfig

func (c *Command) GetConfig() *Config

GetConfig returns the user specified config

func (*Command) Help

func (c *Command) Help() string

Help implements the cli.Command interface

func (*Command) MarkDown

func (c *Command) MarkDown() string

MarkDown implements cli.MarkDown interface

func (*Command) Run

func (c *Command) Run(args []string) int

Run implements the cli.Command interface

func (*Command) Synopsis

func (c *Command) Synopsis() string

Synopsis implements the cli.Command interface

type Config

type Config struct {

	// Chain is the chain to sync with
	Chain string `hcl:"chain,optional" toml:"chain,optional"`

	// Identity of the node
	Identity string `hcl:"identity,optional" toml:"identity,optional"`

	// RequiredBlocks is a list of required (block number, hash) pairs to accept
	RequiredBlocks map[string]string `hcl:"eth.requiredblocks,optional" toml:"eth.requiredblocks,optional"`

	// Verbosity is the level of the logs to put out
	Verbosity int `hcl:"verbosity,optional" toml:"verbosity,optional"`

	// Record information useful for VM and contract debugging
	EnablePreimageRecording bool `hcl:"vmdebug,optional" toml:"vmdebug,optional"`

	// VMTrace enables live VM tracing at startup
	VMTrace string `hcl:"vmtrace,optional" toml:"vmtrace,optional"`

	// VMTraceJsonConfig is the JSON config for the VM tracer
	VMTraceJsonConfig string `hcl:"vmtrace.jsonconfig,optional" toml:"vmtrace.jsonconfig,optional"`

	// Enable state size tracking
	StateSizeTracking bool `hcl:"state.size-tracking,optional" toml:"state.size-tracking,optional"`

	// DataDir is the directory to store the state in
	DataDir string `hcl:"datadir,optional" toml:"datadir,optional"`

	// Ancient is the directory to store the state in
	Ancient string `hcl:"ancient,optional" toml:"ancient,optional"`

	// DBEngine is used to select leveldb or pebble as database
	DBEngine string `hcl:"db.engine,optional" toml:"db.engine,optional"`

	// KeyStoreDir is the directory to store keystores
	KeyStoreDir string `hcl:"keystore,optional" toml:"keystore,optional"`

	// Maximum number of requests in a batch (default=1000, use 0 for no limits)
	BatchRequestLimit int `hcl:"rpc.batch-request-limit,optional" toml:"rpc.batch-request-limit,optional"`

	// Maximum number of response bytes across all requests in a batch (default=25MB, use 0 for no limits)
	BatchResponseMaxSize int `hcl:"rpc.batch-response-max-size,optional" toml:"rpc.batch-response-max-size,optional"`

	// Maximum size (in bytes) a result of an rpc request could have (default=100000, use 0 for no limits)
	RPCReturnDataLimit uint64 `hcl:"rpc.returndatalimit,optional" toml:"rpc.returndatalimit,optional"`

	// SyncMode selects the sync protocol
	SyncMode string `hcl:"syncmode,optional" toml:"syncmode,optional"`

	// GcMode selects the garbage collection mode for the trie
	GcMode string `hcl:"gcmode,optional" toml:"gcmode,optional"`

	// state.scheme selects the Scheme to use for storing ethereum state ('hash' or 'path')
	StateScheme string `hcl:"state.scheme,optional" toml:"state.scheme,optional"`

	// Snapshot enables the snapshot database mode
	Snapshot bool `hcl:"snapshot,optional" toml:"snapshot,optional"`

	// BorLogs enables bor log retrieval
	BorLogs bool `hcl:"bor.logs,optional" toml:"bor.logs,optional"`

	// Ethstats is the address of the ethstats server to send telemetry
	Ethstats string `hcl:"ethstats,optional" toml:"ethstats,optional"`

	// DisableBlindForkValidation disables additional fork validation and accept blind forks without tracing back to last whitelisted entry
	DisableBlindForkValidation bool `hcl:"disable-blind-fork-validation,optional" toml:"disable-blind-fork-validation,optional"`

	// MaxBlindForkValidationLimit denotes the maximum number of blocks to traverse back in the database when validating blind forks
	MaxBlindForkValidationLimit uint64 `hcl:"max-blind-fork-validation-limit,optional" toml:"max-blind-fork-validation-limit,optional"`

	// Logging has the logging related settings
	Logging *LoggingConfig `hcl:"log,block" toml:"log,block"`

	// P2P has the p2p network related settings
	P2P *P2PConfig `hcl:"p2p,block" toml:"p2p,block"`

	// Heimdall has the heimdall connection related settings
	Heimdall *HeimdallConfig `hcl:"heimdall,block" toml:"heimdall,block"`

	// TxPool has the transaction pool related settings
	TxPool *TxPoolConfig `hcl:"txpool,block" toml:"txpool,block"`

	// Sealer has the validator related settings
	Sealer *SealerConfig `hcl:"miner,block" toml:"miner,block"`

	// JsonRPC has the json-rpc related settings
	JsonRPC *JsonRPCConfig `hcl:"jsonrpc,block" toml:"jsonrpc,block"`

	// Gpo has the gas price oracle related settings
	Gpo *GpoConfig `hcl:"gpo,block" toml:"gpo,block"`

	// Telemetry has the telemetry related settings
	Telemetry *TelemetryConfig `hcl:"telemetry,block" toml:"telemetry,block"`

	// Cache has the cache related settings
	Cache *CacheConfig `hcl:"cache,block" toml:"cache,block"`

	ExtraDB *ExtraDBConfig `hcl:"leveldb,block" toml:"leveldb,block"`

	// Account has the validator account related settings
	Accounts *AccountsConfig `hcl:"accounts,block" toml:"accounts,block"`

	// GRPC has the grpc server related settings
	GRPC *GRPCConfig `hcl:"grpc,block" toml:"grpc,block"`

	// Developer has the developer mode related settings
	Developer *DeveloperConfig `hcl:"developer,block" toml:"developer,block"`

	// ParallelEVM has the parallel evm related settings
	ParallelEVM *ParallelEVMConfig `hcl:"parallelevm,block" toml:"parallelevm,block"`

	// Witness has the witness related settings
	Witness *WitnessConfig `hcl:"witness,block" toml:"witness,block"`

	// Develop Fake Author mode to produce blocks without authorisation
	DevFakeAuthor bool `hcl:"devfakeauthor,optional" toml:"devfakeauthor,optional"`

	// Pprof has the pprof related settings
	Pprof *PprofConfig `hcl:"pprof,block" toml:"pprof,block"`

	// HistoryConfig has historical data retention related settings
	History *HistoryConfig `hcl:"history,block" toml:"history,block"`

	// HealthConfig has health check related settings
	Health *HealthConfig `hcl:"health,block" toml:"health,block"`

	// Relay has transaction relay related settings
	Relay *RelayConfig `hcl:"relay,block" toml:"relay,block"`
	// contains filtered or unexported fields
}

func DefaultConfig

func DefaultConfig() *Config

func (*Config) Merge

func (c *Config) Merge(cc ...*Config) error

type DeveloperConfig

type DeveloperConfig struct {
	// Enabled enables the developer mode
	Enabled bool `hcl:"dev,optional" toml:"dev,optional"`

	// Period is the block period to use in developer mode
	Period uint64 `hcl:"period,optional" toml:"period,optional"`

	// Initial block gas limit
	GasLimit uint64 `hcl:"gaslimit,optional" toml:"gaslimit,optional"`
}

type ExtraDBConfig

type ExtraDBConfig struct {
	LevelDbCompactionTableSize           uint64  `hcl:"compactiontablesize,optional" toml:"compactiontablesize,optional"`
	LevelDbCompactionTableSizeMultiplier float64 `hcl:"compactiontablesizemultiplier,optional" toml:"compactiontablesizemultiplier,optional"`
	LevelDbCompactionTotalSize           uint64  `hcl:"compactiontotalsize,optional" toml:"compactiontotalsize,optional"`
	LevelDbCompactionTotalSizeMultiplier float64 `hcl:"compactiontotalsizemultiplier,optional" toml:"compactiontotalsizemultiplier,optional"`
}

type GRPCConfig

type GRPCConfig struct {
	// Addr is the bind address for the grpc rpc server
	Addr string `hcl:"addr,optional" toml:"addr,optional"`
}

type GpoConfig

type GpoConfig struct {
	// Blocks is the number of blocks to track to compute the price oracle
	Blocks uint64 `hcl:"blocks,optional" toml:"blocks,optional"`

	// Percentile sets the weights to new blocks
	Percentile uint64 `hcl:"percentile,optional" toml:"percentile,optional"`

	// Maximum header history of gasprice oracle
	MaxHeaderHistory int `hcl:"maxheaderhistory,optional" toml:"maxheaderhistory,optional"`

	// Maximum block history of gasprice oracle
	MaxBlockHistory int `hcl:"maxblockhistory,optional" toml:"maxblockhistory,optional"`

	// MaxPrice is an upper bound gas price
	MaxPrice    *big.Int `hcl:"-,optional" toml:"-"`
	MaxPriceRaw string   `hcl:"maxprice,optional" toml:"maxprice,optional"`

	// IgnorePrice is a lower bound gas price
	IgnorePrice    *big.Int `hcl:"-,optional" toml:"-"`
	IgnorePriceRaw string   `hcl:"ignoreprice,optional" toml:"ignoreprice,optional"`
}

type HealthConfig

type HealthConfig struct {
	// MaxGoRoutineThreshold is the maximum number of goroutines before bor health check fails.
	MaxGoRoutineThreshold int `hcl:"max_goroutine_threshold,optional" toml:"max_goroutine_threshold,optional"`

	// WarnGoRoutineThreshold is the maximum number of goroutines before bor health check warns.
	WarnGoRoutineThreshold int `hcl:"warn_goroutine_threshold,optional" toml:"warn_goroutine_threshold,optional"`

	// MinPeerThreshold is the minimum number of peers before bor health check fails.
	MinPeerThreshold int `hcl:"min_peer_threshold,optional" toml:"min_peer_threshold,optional"`

	// WarnPeerThreshold is the minimum number of peers before bor health check warns.
	WarnPeerThreshold int `hcl:"warn_peer_threshold,optional" toml:"warn_peer_threshold,optional"`
}

type HealthStatus

type HealthStatus struct {
	Level   HealthStatusLevel `json:"level"`
	Code    int               `json:"code"`
	Message string            `json:"message"`
}

HealthStatus represents the health status with level, code, and message

type HealthStatusLevel

type HealthStatusLevel int

HealthStatusLevel represents the health status level.

const (
	StatusOK HealthStatusLevel = iota
	StatusWarn
	StatusCritical
)

func (HealthStatusLevel) Code

func (h HealthStatusLevel) Code() int

Code returns the numeric code for the health status level.

func (HealthStatusLevel) MarshalJSON

func (h HealthStatusLevel) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface to return the string representation of the health status level.

func (HealthStatusLevel) String

func (h HealthStatusLevel) String() string

String returns the string representation of the health status level.

type HeimdallConfig

type HeimdallConfig struct {
	// URL is the url of the heimdall server (comma-separated for failover: "url1,url2,url3")
	URL string `hcl:"url,optional" toml:"url,optional"`

	Timeout time.Duration `hcl:"timeout,optional" toml:"timeout,optional"`

	// Without is used to disable remote heimdall during testing
	Without bool `hcl:"bor.without,optional" toml:"bor.without,optional"`

	// GRPCAddress is the address of the heimdall grpc server (comma-separated for failover: "addr1,addr2")
	GRPCAddress string `hcl:"grpc-address,optional" toml:"grpc-address,optional"`

	// WSAddress is the address of the heimdall ws subscription server (comma-separated for failover: "addr1,addr2")
	WSAddress string `hcl:"ws-address,optional" toml:"ws-address,optional"`

	// RunHeimdall is used to run heimdall as a child process
	RunHeimdall bool `hcl:"bor.runheimdall,optional" toml:"bor.runheimdall,optional"`

	// RunHeimdal args are the arguments to run heimdall with
	RunHeimdallArgs string `hcl:"bor.runheimdallargs,optional" toml:"bor.runheimdallargs,optional"`

	// UseHeimdallApp is used to fetch data from heimdall app when running heimdall as a child process
	UseHeimdallApp bool `hcl:"bor.useheimdallapp,optional" toml:"bor.useheimdallapp,optional"`
}

type HistoryConfig

type HistoryConfig struct {
	// TransactionHistory denotes the maximum number of blocks from head whose tx indices are reserved.
	TransactionHistory uint64 `hcl:"transactions,block" toml:"transactions,block"`

	// LogHistory denotes the maximum number of blocks from head where a log search index is maintained.
	LogHistory uint64 `hcl:"logs,block" toml:"logs,block"`

	// LogNoHistory denotes whether log search index is maintained or not.
	LogNoHistory bool `hcl:"logs.disable,block" toml:"logs.disable,block"`

	// StateHistory denotes number of recent blocks to retain state history for (only relevant
	// in state.scheme=path)
	StateHistory uint64 `hcl:"state,block" toml:"state,block"`
}

type HttpTimeouts

type HttpTimeouts struct {
	// ReadTimeout is the maximum duration for reading the entire
	// request, including the body.
	//
	// Because ReadTimeout does not let Handlers make per-request
	// decisions on each request body's acceptable deadline or
	// upload rate, most users will prefer to use
	// ReadHeaderTimeout. It is valid to use them both.
	ReadTimeout    time.Duration `hcl:"-,optional" toml:"-"`
	ReadTimeoutRaw string        `hcl:"read,optional" toml:"read,optional"`

	// ReadHeaderTimeout is the amount of time allowed to read
	// request headers.
	ReadHeaderTimeout    time.Duration `hcl:"-,optional" toml:"-"`
	ReadHeaderTimeoutRaw string        `hcl:"readheader,optional" toml:"readheader,optional"`

	// WriteTimeout is the maximum duration before timing out
	// writes of the response. It is reset whenever a new
	// request's header is read. Like ReadTimeout, it does not
	// let Handlers make decisions on a per-request basis.
	WriteTimeout    time.Duration `hcl:"-,optional" toml:"-"`
	WriteTimeoutRaw string        `hcl:"write,optional" toml:"write,optional"`

	// IdleTimeout is the maximum amount of time to wait for the
	// next request when keep-alives are enabled. If IdleTimeout
	// is zero, the value of ReadTimeout is used. If both are
	// zero, ReadHeaderTimeout is used.
	IdleTimeout    time.Duration `hcl:"-,optional" toml:"-"`
	IdleTimeoutRaw string        `hcl:"idle,optional" toml:"idle,optional"`
}

Used from rpc.HTTPTimeouts

type InfluxDBConfig

type InfluxDBConfig struct {
	// V1Enabled enables influx v1 mode
	V1Enabled bool `hcl:"influxdb,optional" toml:"influxdb,optional"`

	// Endpoint is the url endpoint of the influxdb service
	Endpoint string `hcl:"endpoint,optional" toml:"endpoint,optional"`

	// Database is the name of the database in Influxdb to store the metrics.
	Database string `hcl:"database,optional" toml:"database,optional"`

	// Enabled is the username to authorize access to Influxdb
	Username string `hcl:"username,optional" toml:"username,optional"`

	// Password is the password to authorize access to Influxdb
	Password string `hcl:"password,optional" toml:"password,optional"`

	// Tags are tags attaches to all generated metrics
	Tags map[string]string `hcl:"tags,optional" toml:"tags,optional"`

	// Enabled enables influx v2 mode
	V2Enabled bool `hcl:"influxdbv2,optional" toml:"influxdbv2,optional"`

	// Token is the token to authorize access to Influxdb V2.
	Token string `hcl:"token,optional" toml:"token,optional"`

	// Bucket is the bucket to store metrics in Influxdb V2.
	Bucket string `hcl:"bucket,optional" toml:"bucket,optional"`

	// Organization is the name of the organization for Influxdb V2.
	Organization string `hcl:"organization,optional" toml:"organization,optional"`
}

type JsonRPCConfig

type JsonRPCConfig struct {
	// IPCDisable enables whether ipc is enabled or not
	IPCDisable bool `hcl:"ipcdisable,optional" toml:"ipcdisable,optional"`

	// IPCPath is the path of the ipc endpoint
	IPCPath string `hcl:"ipcpath,optional" toml:"ipcpath,optional"`

	// GasCap is the global gas cap for eth-call variants.
	GasCap uint64 `hcl:"gascap,optional" toml:"gascap,optional"`

	// Sets a timeout used for eth_call (0=infinite)
	RPCEVMTimeout    time.Duration `hcl:"-,optional" toml:"-"`
	RPCEVMTimeoutRaw string        `hcl:"evmtimeout,optional" toml:"evmtimeout,optional"`

	// TxFeeCap is the global transaction fee cap for send-transaction variants
	TxFeeCap float64 `hcl:"txfeecap,optional" toml:"txfeecap,optional"`

	// LogQueryLimit is the max number of addresses or topics allowed in filter criteria for eth_getLogs.
	LogQueryLimit int `hcl:"logquerylimit,optional" toml:"logquerylimit,optional"`

	// RangeLimit is the maximum block range allowed for eth_getLogs and bor_getLogs (0 = no limit).
	RangeLimit uint64 `hcl:"rangelimit,optional" toml:"rangelimit,optional"`

	// Http has the json-rpc http related settings
	Http *APIConfig `hcl:"http,block" toml:"http,block"`

	// Ws has the json-rpc websocket related settings
	Ws *APIConfig `hcl:"ws,block" toml:"ws,block"`

	// Graphql has the json-rpc graphql related settings
	Graphql *APIConfig `hcl:"graphql,block" toml:"graphql,block"`

	// AUTH RPC related settings
	Auth *AUTHConfig `hcl:"auth,block" toml:"auth,block"`

	HttpTimeout *HttpTimeouts `hcl:"timeouts,block" toml:"timeouts,block"`

	AllowUnprotectedTxs bool `hcl:"allow-unprotected-txs,optional" toml:"allow-unprotected-txs,optional"`

	// EnablePersonal enables the deprecated personal namespace.
	EnablePersonal bool `hcl:"enabledeprecatedpersonal,optional" toml:"enabledeprecatedpersonal,optional"`

	// Default timeout for eth_sendRawTransactionSync (e.g. 2s, 500ms)
	TxSyncDefaultTimeout    time.Duration `hcl:"-,optional" toml:"-"`
	TxSyncDefaultTimeoutRaw string        `hcl:"txsync.defaulttimeout,optional" toml:"txsync.defaulttimeout,optional"`

	// Maximum allowed timeout for eth_sendRawTransactionSync (e.g. 5m)
	TxSyncMaxTimeout    time.Duration `hcl:"-,optional" toml:"-"`
	TxSyncMaxTimeoutRaw string        `hcl:"txsync.maxtimeout,optional" toml:"txsync.maxtimeout,optional"`

	// AcceptPreconfTx allows the RPC server to accept preconf transactions
	AcceptPreconfTx bool `hcl:"accept-preconf-tx,optional" toml:"accept-preconf-tx,optional"`

	// AcceptPrivateTx allows the RPC server to accept private transactions
	AcceptPrivateTx bool `hcl:"accept-private-tx,optional" toml:"accept-private-tx,optional"`
}

type LoggingConfig

type LoggingConfig struct {
	// Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)
	Vmodule string `hcl:"vmodule,optional" toml:"vmodule,optional"`

	// Format logs with JSON
	Json bool `hcl:"json,optional" toml:"json,optional"`

	// Request a stack trace at a specific logging statement (e.g. "block.go:271")
	Backtrace string `hcl:"backtrace,optional" toml:"backtrace,optional"`

	// Prepends log messages with call-site location (file and line number)
	Debug bool `hcl:"debug,optional" toml:"debug,optional"`

	// EnableBlockTracking allows logging of information collected while tracking block lifecycle
	EnableBlockTracking bool `hcl:"enable-block-tracking,optional" toml:"enable-block-tracking,optional"`
}

type P2PConfig

type P2PConfig struct {
	// MaxPeers sets the maximum number of connected peers
	MaxPeers uint64 `hcl:"maxpeers,optional" toml:"maxpeers,optional"`

	// MaxPendPeers sets the maximum number of pending connected peers
	MaxPendPeers uint64 `hcl:"maxpendpeers,optional" toml:"maxpendpeers,optional"`

	// Bind is the bind address
	Bind string `hcl:"bind,optional" toml:"bind,optional"`

	// Port is the port number
	Port uint64 `hcl:"port,optional" toml:"port,optional"`

	// NoDiscover is used to disable discovery
	NoDiscover bool `hcl:"nodiscover,optional" toml:"nodiscover,optional"`

	// NAT it used to set NAT options
	NAT string `hcl:"nat,optional" toml:"nat,optional"`

	// Connectivity can be restricted to certain IP networks.
	// If this option is set to a non-nil value, only hosts which match one of the
	// IP networks contained in the list are considered.
	NetRestrict string `hcl:"netrestrict,optional" toml:"netrestrict,optional"`

	// P2P node key file
	NodeKey string `hcl:"nodekey,optional" toml:"nodekey,optional"`

	// P2P node key as hex
	NodeKeyHex string `hcl:"nodekeyhex,optional" toml:"nodekeyhex,optional"`

	// Discovery has the p2p discovery related settings
	Discovery *P2PDiscovery `hcl:"discovery,block" toml:"discovery,block"`

	// TxArrivalWait sets the maximum duration the transaction fetcher will wait for
	// an announced transaction to arrive before explicitly requesting it
	TxArrivalWait    time.Duration `hcl:"-,optional" toml:"-"`
	TxArrivalWaitRaw string        `hcl:"txarrivalwait,optional" toml:"txarrivalwait,optional"`

	// TxAnnouncementOnly is used to only announce transactions to peers
	TxAnnouncementOnly bool `hcl:"txannouncementonly,optional" toml:"txannouncementonly,optional"`

	// DisableTxPropagation disables transaction broadcast and announcement completely to its peers
	DisableTxPropagation bool `hcl:"disable-tx-propagation,optional" toml:"disable-tx-propagation,optional"`
}

type P2PDiscovery

type P2PDiscovery struct {
	// DiscoveryV4 specifies whether V4 discovery should be started.
	DiscoveryV4 bool `hcl:"v4disc,optional" toml:"v4disc,optional"`

	// DiscoveryV5 specifies whether the new topic-discovery based V5 discovery
	// protocol should be started or not.
	DiscoveryV5 bool `hcl:"v5disc,optional" toml:"v5disc,optional"`

	// Bootnodes is the list of initial bootnodes
	Bootnodes []string `hcl:"bootnodes,optional" toml:"bootnodes,optional"`

	// BootnodesV4 is the list of initial v4 bootnodes
	BootnodesV4 []string `hcl:"bootnodesv4,optional" toml:"bootnodesv4,optional"`

	// BootnodesV5 is the list of initial v5 bootnodes
	BootnodesV5 []string `hcl:"bootnodesv5,optional" toml:"bootnodesv5,optional"`

	// StaticNodes is the list of static nodes
	StaticNodes []string `hcl:"static-nodes,optional" toml:"static-nodes,optional"`

	// TrustedNodes is the list of trusted nodes
	TrustedNodes []string `hcl:"trusted-nodes,optional" toml:"trusted-nodes,optional"`

	// DNS is the list of enrtree:// URLs which will be queried for nodes to connect to
	DNS []string `hcl:"dns,optional" toml:"dns,optional"`
}

type ParallelEVMConfig

type ParallelEVMConfig struct {
	Enable bool `hcl:"enable,optional" toml:"enable,optional"`

	SpeculativeProcesses int `hcl:"procs,optional" toml:"procs,optional"`

	Enforce bool `hcl:"enforce,optional" toml:"enforce,optional"`
}

type PprofConfig

type PprofConfig struct {
	// Enableed enable the pprof HTTP server
	Enabled bool `hcl:"pprof,optional" toml:"pprof,optional"`

	// pprof HTTP server listening port
	Port int `hcl:"port,optional" toml:"port,optional"`

	// pprof HTTP server listening interface
	Addr string `hcl:"addr,optional" toml:"addr,optional"`

	// Turn on memory profiling with the given rate
	MemProfileRate int `hcl:"memprofilerate,optional" toml:"memprofilerate,optional"`

	// Turn on block profiling with the given rate
	BlockProfileRate int `hcl:"blockprofilerate,optional" toml:"blockprofilerate,optional"`
}

type RelayConfig

type RelayConfig struct {
	// EnablePreconfs enables relay to accept transactions for preconfs
	EnablePreconfs bool `hcl:"enable-preconfs,optional" toml:"enable-preconfs,optional"`

	// EnablePrivateTx enables relaying transactions privately to block producers
	EnablePrivateTx bool `hcl:"enable-private-tx,optional" toml:"enable-private-tx,optional"`

	// BlockProducerRpcEndpoints is a list of block producer rpc endpoints to submit transactions to
	BlockProducerRpcEndpoints []string `hcl:"bp-rpc-endpoints,optional" toml:"bp-rpc-endpoints,optional"`
}

type ResponseRecorder

type ResponseRecorder struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseRecorder captures the response from health-go handler.

func (*ResponseRecorder) Write

func (r *ResponseRecorder) Write(data []byte) (int, error)

func (*ResponseRecorder) WriteHeader

func (r *ResponseRecorder) WriteHeader(statusCode int)

type SealerConfig

type SealerConfig struct {
	// Enabled is used to enable validator mode
	Enabled bool `hcl:"mine,optional" toml:"mine,optional"`

	// AllowGasTipOverride allows a block producer to override the miner gas tip
	AllowGasTipOverride bool `hcl:"allow-gas-tip-override,optional" toml:"allow-gas-tip-override,optional"`

	// Etherbase is the address of the validator
	Etherbase string `hcl:"etherbase,optional" toml:"etherbase,optional"`

	// ExtraData is the block extra data set by the miner
	ExtraData string `hcl:"extradata,optional" toml:"extradata,optional"`

	// GasCeil is the target gas ceiling for mined blocks.
	GasCeil uint64 `hcl:"gaslimit,optional" toml:"gaslimit,optional"`

	// Dynamic gas limit configuration
	EnableDynamicGasLimit bool   `hcl:"enableDynamicGasLimit,optional" toml:"enableDynamicGasLimit,optional"`
	GasLimitMin           uint64 `hcl:"gasLimitMin,optional" toml:"gasLimitMin,optional"`
	GasLimitMax           uint64 `hcl:"gasLimitMax,optional" toml:"gasLimitMax,optional"`
	TargetBaseFee         uint64 `hcl:"targetBaseFee,optional" toml:"targetBaseFee,optional"`
	BaseFeeBuffer         uint64 `hcl:"baseFeeBuffer,optional" toml:"baseFeeBuffer,optional"`

	// Dynamic target gas percentage configuration (post-Lisovo, mutually exclusive with EnableDynamicGasLimit)
	// Shares TargetBaseFee and BaseFeeBuffer with dynamic gas limit configuration.
	EnableDynamicTargetGas bool   `hcl:"enableDynamicTargetGas,optional" toml:"enableDynamicTargetGas,optional"`
	TargetGasMinPercentage uint64 `hcl:"targetGasMinPercentage,optional" toml:"targetGasMinPercentage,optional"`
	TargetGasMaxPercentage uint64 `hcl:"targetGasMaxPercentage,optional" toml:"targetGasMaxPercentage,optional"`

	// GasPrice is the minimum gas price for mining a transaction
	GasPrice    *big.Int `hcl:"-,optional" toml:"-"`
	GasPriceRaw string   `hcl:"gasprice,optional" toml:"gasprice,optional"`

	// The time interval for miner to re-create mining work.
	Recommit    time.Duration `hcl:"-,optional" toml:"-"`
	RecommitRaw string        `hcl:"recommit,optional" toml:"recommit,optional"`

	CommitInterruptFlag bool `hcl:"commitinterrupt,optional" toml:"commitinterrupt,optional"`

	// BlockTime is the block time defined by the miner. Needs to be larger or equal to the consensus block time. If not set (default = 0), the miner will use the consensus block time.
	BlockTime    time.Duration `hcl:"-,optional" toml:"-"`
	BlockTimeRaw string        `hcl:"blocktime,optional" toml:"blocktime,optional"`

	// TargetGasPercentage is the target gas as percentage of gas limit (1-100, default 65) for post-Lisovo blocks
	TargetGasPercentage uint64 `hcl:"target-gas-percentage,optional" toml:"target-gas-percentage,optional"`

	// BaseFeeChangeDenominator is the base fee change rate (must be >0, default 64) for post-Lisovo blocks
	BaseFeeChangeDenominator uint64 `hcl:"base-fee-change-denominator,optional" toml:"base-fee-change-denominator,optional"`

	// EnablePrefetch enables transaction prefetching from pool during block building
	EnablePrefetch bool `hcl:"prefetch,optional" toml:"prefetch,optional"`

	// PrefetchGasLimitPercent is the gas limit percentage for prefetching (e.g., 100 = 100%, 110 = 110%)
	PrefetchGasLimitPercent uint64 `hcl:"prefetch-gaslimit-percent,optional" toml:"prefetch-gaslimit-percent,optional"`
}

type Server

type Server struct {
	proto.UnimplementedBorServer
	protobor.UnimplementedBorApiServer
	// contains filtered or unexported fields
}

func CreateMockServer

func CreateMockServer(config *Config) (*Server, error)

func NewServer

func NewServer(config *Config, opts ...serverOption) (*Server, error)

func (*Server) BorBlockReceipt

func (s *Server) BorBlockReceipt(ctx context.Context, req *protobor.ReceiptRequest) (*protobor.ReceiptResponse, error)

func (*Server) ChainSetHead

func (*Server) ChainWatch

func (s *Server) ChainWatch(req *proto.ChainWatchRequest, reply proto.Bor_ChainWatchServer) error

func (*Server) DebugBlock

func (s *Server) DebugBlock(req *proto.DebugBlockRequest, stream proto.Bor_DebugBlockServer) error

func (*Server) DebugPprof

func (s *Server) DebugPprof(req *proto.DebugPprofRequest, stream proto.Bor_DebugPprofServer) error

func (*Server) GetGrpcAddr

func (s *Server) GetGrpcAddr() string

func (*Server) GetLatestBlockNumber

func (s *Server) GetLatestBlockNumber() *big.Int

func (*Server) GetRootHash

func (*Server) GetVoteOnHash

func (*Server) PeersAdd

func (*Server) PeersList

func (*Server) PeersRemove

func (*Server) PeersStatus

func (*Server) Status

func (*Server) Stop

func (s *Server) Stop()

func (*Server) TransactionReceipt

func (s *Server) TransactionReceipt(ctx context.Context, req *protobor.ReceiptRequest) (*protobor.ReceiptResponse, error)

type TelemetryConfig

type TelemetryConfig struct {
	// Enabled enables metrics
	Enabled bool `hcl:"metrics,optional" toml:"metrics,optional"`

	// Expensive enables expensive metrics
	Expensive bool `hcl:"expensive,optional" toml:"expensive,optional"`

	// InfluxDB has the influxdb related settings
	InfluxDB *InfluxDBConfig `hcl:"influx,block" toml:"influx,block"`

	// Prometheus Address
	PrometheusAddr string `hcl:"prometheus-addr,optional" toml:"prometheus-addr,optional"`

	// Open collector endpoint
	OpenCollectorEndpoint string `hcl:"opencollector-endpoint,optional" toml:"opencollector-endpoint,optional"`
}

type TxPoolConfig

type TxPoolConfig struct {
	// Locals are the addresses that should be treated by default as local
	Locals []string `hcl:"locals,optional" toml:"locals,optional"`

	// NoLocals enables whether local transaction handling should be disabled
	NoLocals bool `hcl:"nolocals,optional" toml:"nolocals,optional"`

	// Journal is the path to store local transactions to survive node restarts
	Journal string `hcl:"journal,optional" toml:"journal,optional"`

	// Rejournal is the time interval to regenerate the local transaction journal
	Rejournal    time.Duration `hcl:"-,optional" toml:"-"`
	RejournalRaw string        `hcl:"rejournal,optional" toml:"rejournal,optional"`

	// PriceLimit is the minimum gas price to enforce for acceptance into the pool
	PriceLimit uint64 `hcl:"pricelimit,optional" toml:"pricelimit,optional"`

	// PriceBump is the minimum price bump percentage to replace an already existing transaction (nonce)
	PriceBump uint64 `hcl:"pricebump,optional" toml:"pricebump,optional"`

	// AccountSlots is the number of executable transaction slots guaranteed per account
	AccountSlots uint64 `hcl:"accountslots,optional" toml:"accountslots,optional"`

	// GlobalSlots is the maximum number of executable transaction slots for all accounts
	GlobalSlots uint64 `hcl:"globalslots,optional" toml:"globalslots,optional"`

	// AccountQueue is the maximum number of non-executable transaction slots permitted per account
	AccountQueue uint64 `hcl:"accountqueue,optional" toml:"accountqueue,optional"`

	// GlobalQueueis the maximum number of non-executable transaction slots for all accounts
	GlobalQueue uint64 `hcl:"globalqueue,optional" toml:"globalqueue,optional"`

	// lifetime is the maximum amount of time non-executable transaction are queued
	LifeTime    time.Duration `hcl:"-,optional" toml:"-"`
	LifeTimeRaw string        `hcl:"lifetime,optional" toml:"lifetime,optional"`

	// FilteredAddressesFile is the path to newline-separated list of addresses whose transactions will be filtered
	FilteredAddressesFile string `hcl:"filtered-addresses,optional" toml:"filtered-addresses,optional"`

	// Rebroadcast enables the stuck transaction rebroadcast mechanism
	Rebroadcast bool `hcl:"rebroadcast,optional" toml:"rebroadcast,optional"`

	// RebroadcastInterval is the interval between rebroadcast checks
	RebroadcastInterval    time.Duration `hcl:"-,optional" toml:"-"`
	RebroadcastIntervalRaw string        `hcl:"rebroadcast-interval,optional" toml:"rebroadcast-interval,optional"`

	// RebroadcastMaxAge is the maximum age for rebroadcast eligibility
	RebroadcastMaxAge    time.Duration `hcl:"-,optional" toml:"-"`
	RebroadcastMaxAgeRaw string        `hcl:"rebroadcast-max-age,optional" toml:"rebroadcast-max-age,optional"`

	// RebroadcastBatchSize is the maximum number of transactions per rebroadcast cycle
	RebroadcastBatchSize int `hcl:"rebroadcast-batch-size,optional" toml:"rebroadcast-batch-size,optional"`
}

type WitnessConfig

type WitnessConfig struct {
	// Enable enables the wit protocol
	Enable bool `hcl:"enable,optional" toml:"enable,optional"`

	// SyncWithWitnesses enables syncing blocks with witnesses
	SyncWithWitnesses bool `hcl:"syncwithwitnesses,optional" toml:"syncwithwitnesses,optional"`

	// ProduceWitnesses enables producing witnesses while syncing
	ProduceWitnesses bool `hcl:"producewitnesses,optional" toml:"producewitnesses,optional"`

	// Parallel stateless import (download path) toggle
	EnableParallelStatelessImport bool `hcl:"parallel-stateless-import,optional" toml:"parallel-stateless-import,optional"`

	// Number of workers (CPUs) to use for parallel stateless import. If 0, uses GOMAXPROCS.
	ParallelStatelessImportWorkers int `hcl:"parallel-stateless-import-workers,optional" toml:"parallel-stateless-import-workers,optional"`

	// WitnessAPI enables witness API endpoints
	WitnessAPI bool `hcl:"witnessapi,optional" toml:"witnessapi,optional"`

	// FileStore enables storing witness blobs on the filesystem instead of Pebble
	FileStore bool `hcl:"filestore,optional" toml:"filestore,optional"`

	// Minimum necessary distance between local header and peer to fast forward
	FastForwardThreshold uint64 `hcl:"fastforwardthreshold,optional" toml:"fastforwardthreshold,optional"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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