Documentation
¶
Index ¶
- Constants
- func IsAccountLimit(err error) bool
- func IsAlreadyKnown(err error) bool
- func IsAlreadyReserved(err error) bool
- func IsAuthorityReserved(err error) bool
- func IsBlobFeeCapTooLow(err error) bool
- func IsBlobLimitExceeded(err error) bool
- func IsBlobSidecarConvFailed(err error) bool
- func IsBlobTxCreate(err error) bool
- func IsEIP155Required(err error) bool
- func IsEmptyAuthList(err error) bool
- func IsFeeCapTooLow(err error) bool
- func IsFeeCapVeryHigh(err error) bool
- func IsFloorDataGas(err error) bool
- func IsFutureReplacePending(err error) bool
- func IsGasLimit(err error) bool
- func IsGasLimitReached(err error) bool
- func IsGasLimitTooHigh(err error) bool
- func IsGasPriceTooLow(err error) bool
- func IsGasUintOverflow(err error) bool
- func IsInflightLimit(err error) bool
- func IsInsufficientFunds(err error) bool
- func IsInsufficientFundsForTransfer(err error) bool
- func IsIntrinsicGas(err error) bool
- func IsInvalidSender(err error) bool
- func IsInvalidSig(err error) bool
- func IsKZGVerificationError(err error) bool
- func IsMaxInitCodeSize(err error) bool
- func IsMissingBlobHashes(err error) bool
- func IsNegativeValue(err error) bool
- func IsNonRetryable(err error) bool
- func IsNonceMax(err error) bool
- func IsNonceTooHigh(err error) bool
- func IsNonceTooLow(err error) bool
- func IsOutOfOrderTxDelegated(err error) bool
- func IsOversizedData(err error) bool
- func IsPoolFull(err error) bool
- func IsReplaceUnderpriced(err error) bool
- func IsSenderNoEOA(err error) bool
- func IsSetCodeTxCreate(err error) bool
- func IsTipAboveFeeCap(err error) bool
- func IsTipVeryHigh(err error) bool
- func IsTooManyBlobs(err error) bool
- func IsTxFeeTooHigh(err error) bool
- func IsTxTypeNotSupported(err error) bool
- func IsUint256Overflow(err error) bool
- func IsUnderpriced(err error) bool
- func IsUnexpectedProtection(err error) bool
- func NewNonRetryableError(err error) error
- func RpcDial(ctx context.Context, rpcH *GlobalRpc, rpcType RPCKind) (*ethclient.Client, func(), string, error)
- func RpcExec[T any](ctx context.Context, rpcH *GlobalRpc, attempts int, wait time.Duration, ...) (T, error)
- func RpcQuery[T any](ctx context.Context, rpcH *GlobalRpc, attempts int, wait time.Duration, ...) (T, error)
- type GlobalRpc
- type NonRetryableError
- type NonceProvider
- type Option
- type RPCKind
- type Receipt
- type RpcConfig
- type RpcErrKind
- type RpcError
- type TxErrKind
- type TxError
Constants ¶
View Source
const ( EXPIRY_SEC = "10" // rpc locks expire after this amount of time REDIS_KEY_CURR_IDX = "glbl_rpc:idx" REDIS_KEY_URLS = "glbl_rpc:urls" REDIS_KEY_LOCK = "glbl_rpc:lock" REDIS_SET_URL_LOCK = "glbl_rpc:urls_lock" )
View Source
const LUA_ACQUIRE = `` /* 370-byte string literal not displayed */
View Source
const LUA_NONCE_NEXT = `` /* 144-byte string literal not displayed */
View Source
const LUA_RELEASE = `
if redis.call("GET", KEYS[1]) == ARGV[1] then
return redis.call("DEL", KEYS[1])
end
return 0
`
View Source
const LUA_RENEW = `
if redis.call("GET", KEYS[1]) == ARGV[1] then
return redis.call("EXPIRE", KEYS[1], ARGV[2])
end
return 0
`
View Source
const REDIS_KEY_NONCE = "glbl_rpc:nonce:"
Variables ¶
This section is empty.
Functions ¶
func IsAccountLimit ¶ added in v0.3.0
func IsAlreadyKnown ¶ added in v0.3.0
func IsAlreadyReserved ¶ added in v0.3.0
func IsAuthorityReserved ¶ added in v0.3.0
func IsBlobFeeCapTooLow ¶ added in v0.3.0
func IsBlobLimitExceeded ¶ added in v0.3.0
func IsBlobSidecarConvFailed ¶ added in v0.3.0
func IsBlobTxCreate ¶ added in v0.3.0
func IsEIP155Required ¶ added in v0.3.0
func IsEmptyAuthList ¶ added in v0.3.0
func IsFeeCapTooLow ¶ added in v0.3.0
func IsFeeCapVeryHigh ¶ added in v0.3.0
func IsFloorDataGas ¶ added in v0.3.0
func IsFutureReplacePending ¶ added in v0.3.0
func IsGasLimit ¶ added in v0.3.0
func IsGasLimitReached ¶ added in v0.3.0
func IsGasLimitTooHigh ¶ added in v0.3.0
func IsGasPriceTooLow ¶ added in v0.3.0
func IsGasUintOverflow ¶ added in v0.3.0
func IsInflightLimit ¶ added in v0.3.0
func IsInsufficientFunds ¶ added in v0.3.0
func IsInsufficientFundsForTransfer ¶ added in v0.3.0
func IsIntrinsicGas ¶ added in v0.3.0
func IsInvalidSender ¶ added in v0.3.0
func IsInvalidSig ¶ added in v0.3.0
func IsKZGVerificationError ¶ added in v0.3.0
func IsMaxInitCodeSize ¶ added in v0.3.0
func IsMissingBlobHashes ¶ added in v0.3.0
func IsNegativeValue ¶ added in v0.3.0
func IsNonRetryable ¶
IsNonRetryable reports whether err (or any error in its chain) is a NonRetryableError.
func IsNonceMax ¶ added in v0.3.0
func IsNonceTooHigh ¶ added in v0.3.0
func IsNonceTooLow ¶ added in v0.3.0
func IsOutOfOrderTxDelegated ¶ added in v0.3.0
func IsOversizedData ¶ added in v0.3.0
func IsPoolFull ¶ added in v0.3.0
func IsReplaceUnderpriced ¶ added in v0.3.0
func IsSenderNoEOA ¶ added in v0.3.0
func IsSetCodeTxCreate ¶ added in v0.3.0
func IsTipAboveFeeCap ¶ added in v0.3.0
func IsTipVeryHigh ¶ added in v0.3.0
func IsTooManyBlobs ¶ added in v0.3.0
func IsTxFeeTooHigh ¶ added in v0.3.0
func IsTxTypeNotSupported ¶ added in v0.3.0
func IsUint256Overflow ¶ added in v0.3.0
func IsUnderpriced ¶ added in v0.3.0
func IsUnexpectedProtection ¶ added in v0.3.0
func NewNonRetryableError ¶
NewNonRetryableError wraps err so that RpcQuery will not retry.
func RpcExec ¶ added in v0.3.0
func RpcExec[T any]( ctx context.Context, rpcH *GlobalRpc, attempts int, wait time.Duration, call func(ctx context.Context, rpc *ethclient.Client, attempt int, prevErr error) (T, error), ) (T, error)
RpcExec retries a write operation across RPC nodes. The callback's prevErr is either a *TxError (classified tx rejection), a *RpcError (infrastructure), or a plain error (unclassified). On the first attempt prevErr is nil.
Types ¶
type GlobalRpc ¶
type GlobalRpc struct {
Config RpcConfig
// contains filtered or unexported fields
}
func NewGlobalRpc ¶
func (*GlobalRpc) GetAndLockRpc ¶
func (*GlobalRpc) NewNonceTracker ¶ added in v0.1.1
func (gr *GlobalRpc) NewNonceTracker(address common.Address) NonceProvider
func (*GlobalRpc) ReturnLock ¶
type NonRetryableError ¶
type NonRetryableError struct {
Err error
}
NonRetryableError wraps an error to signal that RpcQuery should not retry. Use NewNonRetryableError to wrap errors that indicate a previous attempt already had a side effect (e.g. a transaction was submitted).
func (*NonRetryableError) Error ¶
func (e *NonRetryableError) Error() string
func (*NonRetryableError) Unwrap ¶
func (e *NonRetryableError) Unwrap() error
type NonceProvider ¶ added in v0.1.1
type RpcErrKind ¶ added in v0.3.0
type RpcErrKind int
const ( RpcErrUnknown RpcErrKind = iota RpcErrLock // couldn't acquire RPC lock RpcErrDial // couldn't connect to RPC node RpcErrConnection // connection dropped during call )
func (RpcErrKind) String ¶ added in v0.3.0
func (k RpcErrKind) String() string
type RpcError ¶ added in v0.3.0
type RpcError struct {
Kind RpcErrKind
Err error
}
type TxErrKind ¶ added in v0.3.0
type TxErrKind int
The error are based on and extracted from the go-ethereum v1.17.1 error definitions
const ( TxErrUnknown TxErrKind = iota // unrecognized error // nonce errors (https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/error.go) TxErrNonceTooLow // "nonce too low" TxErrNonceTooHigh // "nonce too high" (blob pool nonce gap) TxErrNonceMax // "nonce has max value" (EIP-2681) // pool errors (https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/txpool/errors.go) TxErrAlreadyKnown // "already known" TxErrUnderpriced // "transaction underpriced" (fee too low to enter pool) TxErrReplaceUnderpriced // "replacement transaction underpriced" TxErrAccountLimit // "account limit exceeded" TxErrPoolFull // "txpool is full" (legacypool) TxErrAlreadyReserved // "address already reserved" (blob/non-blob conflict) TxErrInflightLimit // "in-flight transaction limit reached for delegated accounts" // gas errors (https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/error.go) TxErrIntrinsicGas // "intrinsic gas too low" TxErrFloorDataGas // "insufficient gas for floor data gas cost" TxErrGasLimitReached // "gas limit reached" (block gas pool exhausted) TxErrGasLimitTooHigh // "transaction gas limit too high" TxErrGasUintOverflow // "gas uint64 overflow" TxErrGasLimit // "exceeds block gas limit" // fee errors (https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/error.go, https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/types/transaction.go) TxErrFeeCapTooLow // "max fee per gas less than block base fee" or "fee cap less than base fee" TxErrTipAboveFeeCap // "max priority fee per gas higher than max fee per gas" TxErrTipVeryHigh // "max priority fee per gas higher than 2^256-1" TxErrFeeCapVeryHigh // "max fee per gas higher than 2^256-1" TxErrGasPriceTooLow // "transaction gas price below minimum" // fund errors (https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/error.go) TxErrInsufficientFunds // "insufficient funds for gas * price + value" TxErrInsufficientFundsForTransfer // "insufficient funds for transfer" // sender/type errors (https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/error.go, https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/types/transaction.go) TxErrTxTypeNotSupported // "transaction type not supported" TxErrSenderNoEOA // "sender not an eoa" TxErrInvalidSender // "invalid sender" TxErrInvalidSig // "invalid transaction v, r, s values" // size/data errors (https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/error.go, https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/txpool/errors.go) TxErrMaxInitCodeSize // "max initcode size exceeded" TxErrOversizedData // "oversized data" TxErrNegativeValue // "negative value" // EIP-4844 blob errors (https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/error.go, https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/txpool/errors.go) TxErrBlobFeeCapTooLow // "max fee per blob gas less than block blob gas fee" TxErrMissingBlobHashes // "blob transaction missing blob hashes" TxErrTooManyBlobs // "blob transaction has too many blobs" TxErrBlobTxCreate // "blob transaction of type create" TxErrBlobLimitExceeded // "transaction blob limit exceeded" // EIP-7702 errors (https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/error.go) TxErrEmptyAuthList // "EIP-7702 transaction with empty auth list" TxErrSetCodeTxCreate // "EIP-7702 transaction cannot be used to create contract" // legacypool/ethapi errors (https://github.com/ethereum/go-ethereum/blob/v1.17.1/core/txpool/legacypool/legacypool.go, https://github.com/ethereum/go-ethereum/blob/v1.17.1/internal/ethapi/api.go) TxErrFutureReplacePending // "future transaction tries to replace pending" TxErrOutOfOrderTxDelegated // "gapped-nonce tx from delegated accounts" TxErrAuthorityReserved // "authority already reserved" TxErrEIP155Required // "only replay-protected (EIP-155) transactions allowed over RPC" TxErrTxFeeTooHigh // "tx fee exceeds the configured cap" TxErrKZGVerificationError // "KZG verification error" TxErrBlobSidecarConvFailed // "blob sidecar conversion failed" TxErrUint256Overflow // "bigint overflow, too large for uint256" TxErrUnexpectedProtection // "transaction type does not supported EIP-155 protected signatures" )
func ClassifyTxErr ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.