eth

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 33 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Ported from livepeer/go-livepeer at 0ff08af1bb4cb268f428d619cc968b5eaee0d093. Original implementation by Yondon Fu and Rafal Leszko; MIT notice in LICENSE.

Adapted from livepeer/go-livepeer eth/watchers/timewatcher.go and eth/blockwatch/block_watcher.go at 597f882cb9f4d42ad8430b0f592afd5929af4a6b: Nico Vergauwen (b4605f705, 3aec3aa16), Yondon Fu (0acd88bbd), and Rafał Leszko (4b6ede31f, 8c7ec0155). Immutable pinned observations and age refusal also adapt Mike Zupper's BlueClawNetwork/livepeer-node eth/chainview.go (2d95d40b8, 74f41b11f). Copyright (c) 2017 Livepeer; MIT notice in LICENSE.

Sender-key event invalidation and pinned recovery adapt livepeer/go-livepeer eth/watchers/senderwatcher.go (341b39a0c, 57e288706), by Nico Vergauwen. Immutable results, idle eviction and shared cold reads adapt Mike Zupper's BlueClawNetwork/livepeer-node eth/chainview.go (898977754, 5f20cab0f). Copyright (c) 2017 Livepeer; MIT notice in LICENSE.

Ported from livepeer/go-livepeer at 0ff08af1bb4cb268f428d619cc968b5eaee0d093. Original implementation by Yondon Fu and Rafal Leszko; MIT notice in LICENSE.

Voting APIs follow livepeer/go-livepeer/eth/client.go: poll voting by Nico Vergauwen (994f4c0e5a755717f47feab1a397c74307cef8ef) and proposal voting by Rick Staa (89d9ebc7fff0004aab11bbb733035327da7b2e1b).

Index

Constants

This section is empty.

Variables

View Source
var ErrObservationUnavailable = errors.New("chain observation unavailable")
View Source
var ErrReceiptUnavailable = errors.New("transaction inclusion could not be checked")

A failed live receipt check cannot establish that an inclusion timed out. Durable callers retain the monitoring cursor and try the check again.

View Source
var ErrRedeemerIsOrchestrator = errors.New("redeemer wallet is registered or active as an orchestrator")
View Source
var ErrReplacingMinedTx = errors.New("cannot replace a mined transaction")
View Source
var ErrTicketCreationRound = errors.New("ticket creationRound does not have a block hash")
View Source
var ErrUneconomicalRedemption = errors.New("ticket face value does not cover redemption cost")

Functions

func CreateAccount

func CreateAccount(dir string, password *string, passwordFile string) (ethcommon.Address, error)

CreateAccount saves a fresh account in the shared keystore directory.

func CreateKeystore

func CreateKeystore(keystorePath string, password *string, passwordPath string) (ethcommon.Address, error)

CreateKeystore generates an account and writes an owner-only encrypted geth keystore. The parent directory must exist; an existing path is never replaced. Password sources follow the same exact-byte rules as OpenKeystore.

func DecimalUnits

func DecimalUnits(value *big.Int, places int) string

DecimalUnits formats integer units exactly, without floating-point arithmetic.

func HexSignature

func HexSignature(sig []byte) string

func SelectKeystore

func SelectKeystore(dir, explicit string, account *ethcommon.Address) (string, ethcommon.Address, error)

SelectKeystore selects metadata without unlocking a key. An explicit file bypasses directory discovery; its address is checked again after decryption.

func ValidAddress

func ValidAddress(address string) bool

func WithRPCWork added in v1.0.7

func WithRPCWork(ctx context.Context, work string) context.Context

WithRPCWork distinguishes request-induced work from scheduled chain work.

Types

type AccountInspection

type AccountInspection struct {
	BlockSnapshot
	Address      common.Address `json:"address"`
	BalanceWei   string         `json:"balance_wei"`
	LPTBalance   string         `json:"lpt_balance_base_units"`
	PendingNonce uint64         `json:"pending_nonce"`
}

type BlockSnapshot

type BlockSnapshot struct {
	BlockNumber string      `json:"block_number"`
	BlockHash   common.Hash `json:"block_hash"`
}

type ChainSnapshot

type ChainSnapshot struct {
	Block                *big.Int // Protocol L1 block, including on Arbitrum.
	Number               *big.Int // Execution-chain height, distinct from the L1 clock.
	BlockHash            ethcommon.Hash
	Round                *big.Int // Last initialized round.
	RoundHash            ethcommon.Hash
	TicketValidityPeriod *big.Int // TicketBroker validity period at this block.
	CurrentRound         *big.Int // Protocol round; may exceed the initialized Round.
	// contains filtered or unexported fields
}

func (ChainSnapshot) ObservedAt added in v1.0.7

func (s ChainSnapshot) ObservedAt() time.Time

func (ChainSnapshot) TicketExpired added in v1.0.7

func (s ChainSnapshot) TicketExpired(creation int64) bool

func (ChainSnapshot) ValidTicketRound added in v1.0.7

func (s ChainSnapshot) ValidTicketRound(creation int64) bool

func (ChainSnapshot) Validate added in v1.0.7

func (s ChainSnapshot) Validate() error

Validate also rejects snapshots retained across an invalidation or shutdown. Direct reads and injected test chains retain their existing behavior.

type Confirmation

type Confirmation struct {
	Hash     common.Hash   `json:"transaction_hash"`
	Block    uint64        `json:"confirmed_block"`
	Attempts []common.Hash `json:"attempt_hashes"`
}

type Contracts

type Contracts struct {
	BeforeBroadcast     func(context.Context, *types.Transaction) error // Optional application policy, installed before workers start.
	CheckRedemptionCost bool
	RPC                 *RPC
	Controller          ethcommon.Address

	MaxFeePerGas *big.Int // Optional ceiling in wei per gas.
	// contains filtered or unexported fields
}

Contracts adapts upstream bindings to explicit transaction planning and canonical payment snapshots. Protocol addresses come from the Controller; Poll and price-feed addresses are explicit caller inputs.

func NewContracts

func NewContracts(rpc *RPC, controller ethcommon.Address) (*Contracts, error)

func OpenContracts

func OpenContracts(rpc *RPC, controller string) (*Contracts, error)

func (*Contracts) Broadcast

func (c *Contracts) Broadcast(ctx context.Context, tx SignedTransaction) error

Broadcast sends these exact signed bytes once. Always retain the local hash: any transport error can occur after the node has accepted the transaction.

func (*Contracts) Call

func (c *Contracts) Call(ctx context.Context, name string, address ethcommon.Address, method string, args ...any) ([]any, error)

func (*Contracts) CallAt

func (c *Contracts) CallAt(ctx context.Context, block any, name string, address ethcommon.Address, method string, args ...any) ([]any, error)

func (*Contracts) ChangeDelegate

func (c *Contracts) ChangeDelegate(ctx context.Context, from, to common.Address) (TransactionPlan, error)

func (*Contracts) ChangeDelegateWithOptions

func (c *Contracts) ChangeDelegateWithOptions(ctx context.Context, from, to common.Address, options FeeOptions) (TransactionPlan, error)

func (*Contracts) Fees

func (c *Contracts) Fees(ctx context.Context, initialTip *big.Int) (FeeInspection, error)

func (*Contracts) GetRewardCaller

func (c *Contracts) GetRewardCaller(ctx context.Context, target common.Address) (common.Address, error)

func (*Contracts) Inspect

func (c *Contracts) Inspect(ctx context.Context) (*Inspection, error)

func (*Contracts) InspectFees

func (c *Contracts) InspectFees(ctx context.Context, initialTip *big.Int) (FeeInspection, error)

InspectFees also reports the RPC suggestion when an explicit tip is selected.

func (*Contracts) Pack

func (c *Contracts) Pack(name, method string, args ...any) ([]byte, error)

func (*Contracts) PlanContract

func (c *Contracts) PlanContract(ctx context.Context, from common.Address, name, method string, value *big.Int, args ...any) (TransactionPlan, error)

PlanContract simulates and estimates a retained operation without signing or broadcasting. Staking operations reuse upstream pool-position preparation.

func (*Contracts) PlanContractWithOptions

func (c *Contracts) PlanContractWithOptions(ctx context.Context, from common.Address, name, method string, value *big.Int, options FeeOptions, args ...any) (TransactionPlan, error)

func (*Contracts) PlanTransaction

func (c *Contracts) PlanTransaction(ctx context.Context, from, to ethcommon.Address, data []byte, value *big.Int) (TransactionPlan, error)

PlanTransaction simulates a state change and estimates gas before any signing.

func (*Contracts) PlanTransactionWithOptions

func (c *Contracts) PlanTransactionWithOptions(ctx context.Context, from, to ethcommon.Address, data []byte, value *big.Int, options FeeOptions) (TransactionPlan, error)

func (*Contracts) Prepare

func (c *Contracts) Prepare(ctx context.Context, plan TransactionPlan, key *Key, chainID *big.Int) (SignedTransaction, error)

Prepare performs reads and signing only; callers can durably save the identity before the first possible broadcast.

func (*Contracts) PrepareAndStore

func (c *Contracts) PrepareAndStore(ctx context.Context, plan TransactionPlan, key *Key, chainID *big.Int, save func(SignedTransaction) error) (SignedTransaction, error)

PrepareAndStore holds the transaction account's nonce reservation through persistence. Save must durably store the identity without broadcasting it or calling back into this client's nonce methods. A failed save does not consume a nonce.

func (*Contracts) ProposalVote

func (c *Contracts) ProposalVote(ctx context.Context, from common.Address, proposal *big.Int, choice lpTypes.ProposalVoteChoice) (TransactionPlan, error)

func (*Contracts) ProposalVoteWithReason

func (c *Contracts) ProposalVoteWithReason(ctx context.Context, from common.Address, proposal *big.Int, choice lpTypes.ProposalVoteChoice, reason string) (TransactionPlan, error)

func (*Contracts) Resolve

func (c *Contracts) Resolve(ctx context.Context, name string) (ethcommon.Address, error)

func (*Contracts) ResolveAt

func (c *Contracts) ResolveAt(ctx context.Context, block any, name string) (ethcommon.Address, error)

func (*Contracts) RewardForTranscoder

func (c *Contracts) RewardForTranscoder(ctx context.Context, from, target common.Address) (TransactionPlan, error)

func (*Contracts) SetNonceFloor

func (c *Contracts) SetNonceFloor(address ethcommon.Address, floor uint64)

SetNonceFloor includes identities already durably saved by a caller. Local reservations cannot coordinate another process using the same signing key.

func (*Contracts) SetRewardCaller

func (c *Contracts) SetRewardCaller(ctx context.Context, from, caller common.Address) (TransactionPlan, error)

Reward-caller APIs follow Rick Staa's go-livepeer/eth/client.go LIP-118 support (a31522e08b3e7c953a3bba51e7be6d79b4bf5c8c).

func (*Contracts) Submit

func (c *Contracts) Submit(ctx context.Context, plan TransactionPlan, key *Key, chainID *big.Int) (ethcommon.Hash, error)

func (*Contracts) Vote

func (c *Contracts) Vote(ctx context.Context, from, poll common.Address, choice lpTypes.VoteChoice) (TransactionPlan, error)

Vote plans a vote on the explicitly selected Poll contract.

func (*Contracts) WaitConfirmation

func (c *Contracts) WaitConfirmation(ctx context.Context, first SignedTransaction, key *Key, options WaitOptions, beforeBroadcast func(SignedTransaction, TransactionPlan) error) (Confirmation, error)

WaitConfirmation retains the signed identity and watches every attempt. The callback runs before each replacement broadcast, allowing callers to report its hash and resolved fees even if a send has an uncertain outcome.

func (*Contracts) WaitReceipt

func (c *Contracts) WaitReceipt(ctx context.Context, hash ethcommon.Hash) (uint64, error)

WaitReceipt waits for one confirmed receipt and reports reverted transactions.

func (*Contracts) WeiPerUSD

func (c *Contracts) WeiPerUSD(ctx context.Context, feed ethcommon.Address, maxAge time.Duration) (*big.Rat, time.Time, error)

WeiPerUSD reads an operator-selected Chainlink-compatible ETH/USD feed. It returns the last instant at which that observation may price new sessions. Feed access follows Victor Elias's go-livepeer/eth/pricefeed.go (ef5d78922e08d8b815814df419d03e0561c1e974); canonical reads and freshness checks are implemented here.

type ContractsInspection

type ContractsInspection struct {
	BlockSnapshot
	Addresses map[string]common.Address `json:"addresses"`
}

type FeeInspection

type FeeInspection struct {
	BlockSnapshot
	BaseFeeWei      string  `json:"base_fee_per_gas_wei"`
	SuggestedTipWei *string `json:"suggested_priority_fee_per_gas_wei"`
	TipCapWei       string  `json:"max_priority_fee_per_gas_wei"`
	FeeCapWei       string  `json:"calculated_fee_cap_wei"`
	CeilingWei      *string `json:"fee_ceiling_wei"`
}

type FeeOptions

type FeeOptions struct {
	GasLimit    uint64
	PriorityFee *big.Int
}

FeeOptions applies to one transaction. A zero gas limit requests estimation.

type Inspection

type Inspection struct {
	BlockNumber string      `json:"block_number"`
	BlockHash   common.Hash `json:"block_hash"`
	// contains filtered or unexported fields
}

Inspection pins all state and Controller lookups to one canonical block hash. Pending nonces are deliberately read from the transaction pool.

func (*Inspection) Account

func (s *Inspection) Account(ctx context.Context, address common.Address) (AccountInspection, error)

func (*Inspection) Addresses

func (s *Inspection) Addresses(ctx context.Context) (ContractsInspection, error)

func (*Inspection) Call

func (s *Inspection) Call(ctx context.Context, name, method string, args ...any) ([]any, error)

func (*Inspection) Locks

func (s *Inspection) Locks(ctx context.Context, address common.Address, query LockQuery) (LocksInspection, error)

func (*Inspection) Orchestrator

func (s *Inspection) Orchestrator(ctx context.Context, address common.Address) (OrchestratorInspection, error)

func (*Inspection) Pool

func (s *Inspection) Pool(ctx context.Context, activeOnly bool) (PoolInspection, error)

func (*Inspection) Protocol

func (s *Inspection) Protocol(ctx context.Context) (ProtocolInspection, error)

func (*Inspection) Resolve

func (s *Inspection) Resolve(ctx context.Context, name string) (common.Address, error)

func (*Inspection) Round

func (s *Inspection) Round(ctx context.Context) (RoundInspection, error)

func (*Inspection) Snapshot

func (s *Inspection) Snapshot() BlockSnapshot

func (*Inspection) Stake

func (s *Inspection) Stake(ctx context.Context, address common.Address) (StakeInspection, error)

func (*Inspection) TicketBroker

func (s *Inspection) TicketBroker(ctx context.Context, address common.Address) (TicketBrokerInspection, error)

type Key

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

Key is a local Ethereum signer. The key material never crosses the JSON-RPC boundary and is not included in command output or errors.

func OpenAccount

func OpenAccount(dir, path string, password *string, passwordFile string, account *ethcommon.Address) (*Key, error)

OpenAccount discovers an account and verifies its metadata against the decrypted key.

func OpenKeystore

func OpenKeystore(keystorePath string, password *string, passwordPath string) (key *Key, err error)

OpenKeystore unlocks an encrypted geth account using password, or passwordPath if password is nil. Any supplied password file must be owner-only.

func OpenKeystoreFile

func OpenKeystoreFile(keystorePath, passwordPath string) (*Key, error)

OpenKeystoreFile unlocks one encrypted geth account file. Password files use exact bytes, including whitespace; neither input is included in diagnostics.

func (*Key) Address

func (k *Key) Address() ethcommon.Address

func (*Key) SignHash

func (k *Key) SignHash(hash []byte) ([]byte, error)

Hash signing follows Yondon Fu's go-livepeer/eth/accountmanager.go signHash (97a014cb692a736a853f7ebb396e9cbada5408a6).

func (*Key) SignMessage

func (k *Key) SignMessage(message []byte) ([]byte, error)

Ethereum message signing and the 27/28 convention follow Yondon Fu's go-livepeer/eth/accountmanager.go (3b52399fc7b9177460864207a68eb9f3d2f4ee57).

func (*Key) SignTx added in v1.0.6

func (k *Key) SignTx(tx *types.Transaction) (*types.Transaction, error)

SignTx adapts the local key to the ported go-livepeer transaction signer.

func (*Key) SignTxForChain added in v1.0.6

func (k *Key) SignTxForChain(tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)

SignTxForChain retains upstream accountManager's chain binding when an unsigned legacy replacement does not yet encode its original chain ID.

type LockInspection

type LockInspection struct {
	ID            string `json:"id"`
	Amount        string `json:"amount_base_units"`
	WithdrawRound string `json:"withdraw_round"`
	Withdrawable  bool   `json:"withdrawable"`
}

type LockQuery

type LockQuery struct {
	FromID               *big.Int
	Limit                uint64
	Withdrawable, Locked bool
}

type LocksInspection

type LocksInspection struct {
	BlockSnapshot
	Address    common.Address   `json:"address"`
	Locks      []LockInspection `json:"locks"`
	NextFromID *string          `json:"next_from_id"`
}

type NonceManager added in v1.0.6

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

NonceManager manages transaction nonces for multiple ETH addresses

func NewNonceManager added in v1.0.6

func NewNonceManager(remoteReader RemoteNonceReader) *NonceManager

NewNonceManager creates an instance of a NonceManager

func (*NonceManager) Lock added in v1.0.6

func (m *NonceManager) Lock(addr ethcommon.Address)

Lock locks the provided address. The caller should always call Lock before calling Next or Update

func (*NonceManager) Next added in v1.0.6

func (m *NonceManager) Next(addr ethcommon.Address) (uint64, error)

Next returns the next transaction nonce to be used for the provided address

func (*NonceManager) NextContext added in v1.0.6

func (m *NonceManager) NextContext(ctx context.Context, addr ethcommon.Address) (uint64, error)

NextContext adapts upstream Next to the service/RPC cancellation boundary.

func (*NonceManager) Restore added in v1.0.6

func (m *NonceManager) Restore(addr ethcommon.Address, next uint64)

Restore includes acknowledged durable sends when a redemption worker restarts. It cannot lower the upstream cursor when an older transaction is rebroadcast.

func (*NonceManager) Unlock added in v1.0.6

func (m *NonceManager) Unlock(addr ethcommon.Address)

Unlock unlocks the provided address. The caller should always call Unlock after finishing calls to Next or Update

func (*NonceManager) Update added in v1.0.6

func (m *NonceManager) Update(addr ethcommon.Address, lastNonce uint64)

Update uses the last nonce for the provided address to update the next transaction nonce

type ObserverStatus added in v1.0.7

type ObserverStatus struct {
	ObservedAt, ContactAt, HeadProgressAt, L1ProgressAt time.Time
	Healthy, RecipientActive                            bool
	RecipientTracked, RecipientFailed                   bool
	RecipientRejection                                  string
	PayerEntries, PayerReads, PayerFailures             int
}

ObserverStatus separates successful contact from accepted state and progress. A single provider cannot establish an absolute bound on protocol L1 lag.

type OrchestratorInspection

type OrchestratorInspection struct {
	BlockSnapshot
	Address         common.Address `json:"address"`
	Registered      bool           `json:"registered"`
	Active          bool           `json:"active"`
	DelegatedStake  string         `json:"delegated_stake_base_units"`
	RewardCut       string         `json:"reward_cut_percent"`
	FeeCut          string         `json:"fee_cut_percent"`
	ServiceURI      string         `json:"service_uri"`
	LastRewardRound string         `json:"last_reward_round"`
	RewardCaller    common.Address `json:"reward_caller"`
}

type PaymentChain

type PaymentChain struct {
	Contracts *Contracts
	Observer  *PaymentObserver // Nil for direct transaction/redemption reads.
}

PaymentChain adapts the retained Livepeer contracts to pm's narrow chain interface. Ethereum contract reads and redemption stay in eth.

func (PaymentChain) CheckRedeemerWallet added in v1.0.7

func (c PaymentChain) CheckRedeemerWallet(ctx context.Context, account common.Address) error

CheckRedeemerWallet is policy, not an atomic restriction in TicketBroker.

func (PaymentChain) FinalizedNonce added in v1.0.6

func (c PaymentChain) FinalizedNonce(ctx context.Context, address ethcommon.Address) (uint64, error)

FinalizedNonce pins account state to the same canonical finalized reference used for ticket-use settlement. A missing/malformed count is not evidence.

func (PaymentChain) FinalizedReceipt added in v1.0.7

func (c PaymentChain) FinalizedReceipt(ctx context.Context, hash ethcommon.Hash) (*types.Receipt, error)

FinalizedReceipt retains canonical inclusion evidence for durable collateral admission.

func (PaymentChain) InclusionReceipt added in v1.0.6

func (c PaymentChain) InclusionReceipt(ctx context.Context, hash ethcommon.Hash) (*types.Receipt, error)

InclusionReceipt retains node's canonical-block check without treating an unfinalized inclusion as settled. The ported manager only waits for inclusion.

func (PaymentChain) IsActive

func (c PaymentChain) IsActive(ctx context.Context, recipient ethcommon.Address) (bool, error)

func (PaymentChain) IsActiveAt

func (c PaymentChain) IsActiveAt(ctx context.Context, recipient ethcommon.Address, snapshot ChainSnapshot) (bool, error)

func (PaymentChain) PayerFunds added in v1.0.7

func (c PaymentChain) PayerFunds(ctx context.Context, sender, recipient ethcommon.Address) (SenderInfo, error)

func (PaymentChain) PrepareRedemption

func (c PaymentChain) PrepareRedemption(ctx context.Context, redeemer *Key, chainID *big.Int, t RedeemTicket) (SignedTransaction, error)

func (PaymentChain) Redeem

func (c PaymentChain) Redeem(ctx context.Context, redeemer *Key, chainID *big.Int, t RedeemTicket) (ethcommon.Hash, error)

func (PaymentChain) RedemptionSnapshot added in v1.0.7

func (c PaymentChain) RedemptionSnapshot(ctx context.Context, tag string) (ChainSnapshot, error)

RedemptionSnapshot pins eligibility and expiry to one execution-chain block. Block remains the protocol L1 clock, which is distinct on Arbitrum.

func (PaymentChain) RoundHashAt added in v1.0.7

func (c PaymentChain) RoundHashAt(ctx context.Context, round int64, s ChainSnapshot) (common.Hash, error)

func (PaymentChain) Snapshot

func (c PaymentChain) Snapshot(ctx context.Context) (ChainSnapshot, error)

func (PaymentChain) SubmitRedemption added in v1.0.6

func (c PaymentChain) SubmitRedemption(ctx context.Context, nonces *NonceManager, manager *TransactionManager, redeemer *Key, chainID *big.Int, t RedeemTicket, save func(SignedTransaction) error) error

SubmitRedemption ports go-livepeer/eth/backend.go's Next/send/Update sequence. Persistence happens before send, but only an acknowledged send advances Next.

func (PaymentChain) TicketUse added in v1.0.7

func (c PaymentChain) TicketUse(ctx context.Context, hash ethcommon.Hash, block string) (bool, ChainSnapshot, error)

TicketUse adapts go-livepeer/eth/client_ticketbroker.go's IsUsedTicket. It returns the pinned finalized identity alongside ticket-use evidence.

func (PaymentChain) TicketUseAt added in v1.0.7

func (c PaymentChain) TicketUseAt(ctx context.Context, hash common.Hash, s ChainSnapshot) (bool, error)

type PaymentObserver added in v1.0.7

type PaymentObserver struct {
	OnRefresh func(time.Duration, error) // Install before Run; called serially.
	// contains filtered or unexported fields
}

PaymentObserver publishes complete canonical observations. Gaps and reorgs rebuild state at the new hash instead of replaying uncertain event history.

func NewPaymentObserver added in v1.0.7

func NewPaymentObserver(chain PaymentChain, requireL1 bool, recipient common.Address) *PaymentObserver

func (*PaymentObserver) Run added in v1.0.7

func (o *PaymentObserver) Run(ctx context.Context)

Run has one service-owned caller. Every RPC inherits the service lifetime.

func (*PaymentObserver) Snapshot added in v1.0.7

func (o *PaymentObserver) Snapshot(ctx context.Context) (ChainSnapshot, error)

func (*PaymentObserver) Status added in v1.0.7

func (o *PaymentObserver) Status() ObserverStatus

type PoolInspection

type PoolInspection struct {
	BlockSnapshot
	Orchestrators []OrchestratorInspection `json:"orchestrators"`
}

type ProtocolInspection

type ProtocolInspection struct {
	BlockSnapshot
	Paused            bool   `json:"paused"`
	PoolLimit         string `json:"pool_limit"`
	RoundLength       string `json:"round_length"`
	RoundLockAmount   string `json:"round_lock_amount"`
	UnbondingPeriod   string `json:"unbonding_period"`
	Inflation         string `json:"inflation"`
	InflationChange   string `json:"inflation_change"`
	TargetBondingRate string `json:"target_bonding_rate"`
	Supply            string `json:"supply_base_units"`
	TotalBonded       string `json:"total_bonded_base_units"`
	ParticipationRate string `json:"participation_rate_percent"`
}

type RPC

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

RPC applies bounded HTTP transport and error redaction to geth's client.

func NewRPC

func NewRPC(endpoint *url.URL, transport http.RoundTripper) (*RPC, error)

NewRPC opens a bounded RPC client using the supplied transport. A nil transport uses the system HTTP transport, including normal TLS verification.

func OpenRPC

func OpenRPC(endpoint string) (*RPC, error)

func (*RPC) BalanceAt

func (r *RPC) BalanceAt(ctx context.Context, address ethcommon.Address, number *big.Int) (*big.Int, error)

func (*RPC) BlockNumber

func (r *RPC) BlockNumber(ctx context.Context) (uint64, error)

func (*RPC) ChainID

func (r *RPC) ChainID(ctx context.Context) (*big.Int, error)

ChainID uses ethclient's standard call and quantity decoding.

func (*RPC) CheckChainID

func (r *RPC) CheckChainID(ctx context.Context, expected *big.Int) error

CheckChainID validates the RPC chain ID, optionally pinning it to expected.

func (*RPC) Close

func (r *RPC) Close()

func (*RPC) CodeAt

func (r *RPC) CodeAt(ctx context.Context, address ethcommon.Address, number *big.Int) ([]byte, error)

func (*RPC) PendingNonceAt

func (r *RPC) PendingNonceAt(ctx context.Context, address ethcommon.Address) (uint64, error)

func (*RPC) SetObserver added in v1.0.7

func (r *RPC) SetObserver(observer func(RPCObservation))

SetObserver installs a hook before the client is used. Observations contain allowlisted methods and redacted errors, never RPC payloads or URLs.

func (*RPC) TransactionByHash added in v1.0.6

func (r *RPC) TransactionByHash(ctx context.Context, hash ethcommon.Hash) (*types.Transaction, bool, error)

func (*RPC) TransactionReceipt

func (r *RPC) TransactionReceipt(ctx context.Context, hash ethcommon.Hash) (*types.Receipt, error)

type RPCObservation added in v1.0.7

type RPCObservation struct {
	Method, Work, Contract, Function string
	Elapsed                          time.Duration
	Err                              error
}

RPCObservation contains fixed labels and redacted errors, never RPC payloads.

type RedeemTicket

type RedeemTicket struct {
	Recipient         ethcommon.Address
	Sender            ethcommon.Address
	FaceValue         *big.Int
	WinProb           *big.Int
	SenderNonce       uint32
	RecipientRandHash ethcommon.Hash
	AuxData           []byte
	Signature         []byte
	RecipientRand     *big.Int
}

The redemption tuple follows Yondon Fu's go-livepeer/eth/client_ticketbroker.go RedeemWinningTicket (ffcefd6341d14696e2718c1a42875428cd2cc953).

type RemoteNonceReader added in v1.0.6

type RemoteNonceReader interface {
	PendingNonceAt(ctx context.Context, addr ethcommon.Address) (uint64, error)
}

RemoteNonceReader is an interface that describes an object capable of reading transaction nonces for ETH address from a remote source

type RoundInspection

type RoundInspection struct {
	BlockSnapshot
	CurrentRound         string `json:"current_round"`
	LastInitializedRound string `json:"last_initialized_round"`
	Initialized          bool   `json:"initialized"`
	Locked               bool   `json:"locked"`
}

type SenderInfo

type SenderInfo struct {
	Snapshot                        ChainSnapshot
	Deposit, Reserve, WithdrawRound *big.Int
}

SenderInfo is a coherent view of a sender's collateral and the amount of reserve this particular recipient can claim in the initialized round. A zero recipient requests total remaining reserve, for sender readiness. Sender/reserve semantics follow go-livepeer/eth/client_ticketbroker.go, originally by Yondon Fu and Nico Vergauwen, with L1-round handling by Rafał Leszko (4b6ede31f040a084ff9e55bd798a0d6fffee1e1b).

type SignedTransaction

type SignedTransaction struct {
	Hash  ethcommon.Hash
	Raw   []byte
	Nonce uint64
	From  ethcommon.Address
}

type StakeInspection

type StakeInspection struct {
	BlockSnapshot
	Address         common.Address `json:"address"`
	Status          string         `json:"status"`
	BondedStake     string         `json:"bonded_stake_base_units"`
	PendingStake    string         `json:"pending_stake_base_units"`
	CollectedFees   string         `json:"collected_fees_wei"`
	PendingFees     string         `json:"pending_fees_wei"`
	Delegate        common.Address `json:"delegate"`
	DelegatedAmount string         `json:"delegated_amount_base_units"`
	StartRound      string         `json:"start_round"`
	LastClaimRound  string         `json:"last_claim_round"`
	NextLockID      string         `json:"next_lock_id"`
}

type TicketBrokerInspection

type TicketBrokerInspection struct {
	BlockSnapshot
	Address                common.Address `json:"address"`
	Deposit                string         `json:"deposit_wei"`
	Reserve                string         `json:"reserve_wei"`
	WithdrawRound          string         `json:"withdraw_round"`
	UnlockPeriod           string         `json:"unlock_period"`
	FundingStatus          string         `json:"funding_status"`
	ProjectedWithdrawRound *string        `json:"projected_withdraw_round"`
}

type TransactionManager added in v1.0.6

type TransactionManager struct {

	// Persistence adapters run before any replacement can reach the network.
	Restore           func(context.Context, *types.Transaction) (TransactionRecovery, error)
	BeforeReplacement func(context.Context, *types.Transaction, *types.Transaction) error
	Completed         func(context.Context, *transactionReceipt)
	// contains filtered or unexported fields
}

func NewTransactionManager added in v1.0.6

func NewTransactionManager(eth transactionSenderReader, gpm feeCeiling, signer transactionSigner, txTimeout time.Duration, maxReplacements int) *TransactionManager

func (*TransactionManager) Context added in v1.0.6

func (tm *TransactionManager) Context() context.Context

func (*TransactionManager) SendTransaction added in v1.0.6

func (tm *TransactionManager) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*TransactionManager) Start added in v1.0.6

func (tm *TransactionManager) Start()

func (*TransactionManager) Stop added in v1.0.6

func (tm *TransactionManager) Stop()

func (*TransactionManager) Track added in v1.0.6

func (tm *TransactionManager) Track(tx *types.Transaction)

Track resumes an identity already durably submitted, without broadcasting.

type TransactionPlan

type TransactionPlan struct {
	To        ethcommon.Address `json:"to"`
	From      ethcommon.Address `json:"from"`
	Data      string            `json:"data"`
	ValueWei  string            `json:"value_wei"`
	GasLimit  uint64            `json:"gas_limit"`
	FeeCapWei string            `json:"max_fee_per_gas_wei"`
	TipCapWei string            `json:"max_priority_fee_per_gas_wei"`
}

type TransactionReceipt added in v1.0.6

type TransactionReceipt = transactionReceipt

type TransactionRecovery added in v1.0.6

type TransactionRecovery struct {
	OriginHash   ethcommon.Hash
	Transaction  *types.Transaction
	Hashes       []ethcommon.Hash
	SentAt       time.Time
	Replacements int
}

TransactionRecovery is the persisted upstream inclusion/replacement cursor.

type WaitOptions

type WaitOptions struct {
	Timeout         time.Duration
	MaxReplacements uint64
}

WaitOptions controls CLI inclusion waiting. Payment finality and durable recovery do not use this API. Timeout applies to every attempt, including last.

Directories

Path Synopsis
Selected protocol types from go-livepeer bd645a09266833fb859053445d9ac85846330756.
Selected protocol types from go-livepeer bd645a09266833fb859053445d9ac85846330756.

Jump to

Keyboard shortcuts

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