utils

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToQuorumNumbers

func BytesToQuorumNumbers(quorumNumbersBytes []byte) eigentypes.QuorumNums

func BytesToQuorumThresholdPercentages

func BytesToQuorumThresholdPercentages(quorumThresholdPercentagesBytes []byte) eigentypes.QuorumThresholdPercentages

func CalculateGasPriceBumpBasedOnRetry added in v0.11.0

func CalculateGasPriceBumpBasedOnRetry(currentGasPrice *big.Int, baseBumpPercentage uint, retryAttemptPercentage uint, bumpPercentageLimit uint, retryCount int) *big.Int

Simple algorithm to calculate the gasPrice bump based on: the currentGasPrice, a base bump percentage, a retry percentage, and the retry count. Formula: currentGasPrice + (currentGasPrice * (baseBumpPercentage + retryCount * incrementalRetryPercentage) / 100)

func ConvertToBN254G1Point

func ConvertToBN254G1Point(input *bls.G1Point) servicemanager.BN254G1Point

BN254.sol is a library, so bindings for G1 Points and G2 Points are only generated in every contract that imports that library. Thus the output here will need to be type casted if G1Point is needed to interface with another contract (eg: BLSPublicKeyCompendium.sol)

func ConvertToBN254G2Point

func ConvertToBN254G2Point(input *bls.G2Point) servicemanager.BN254G2Point

func GetGasPriceRetryable added in v0.11.0

func GetGasPriceRetryable(client eth.InstrumentedClient, fallbackClient eth.InstrumentedClient, config *retry.RetryParams) (*big.Int, error)

GetGasPriceRetryable Get the gas price from the client with retry logic. - All errors are considered Transient Errors - Retry times: 1 sec, 2 sec, 4 sec

func ReadFile added in v0.12.0

func ReadFile(path string) ([]byte, error)

func ReadJsonConfig added in v0.12.0

func ReadJsonConfig(path string, o interface{}) error

func ReadYamlConfig added in v0.12.0

func ReadYamlConfig(path string, o interface{}) error

func WaitForTransactionReceiptRetryable added in v0.11.0

func WaitForTransactionReceiptRetryable(client eth.InstrumentedClient, fallbackClient eth.InstrumentedClient, txHash gethcommon.Hash, config *retry.RetryParams) (*types.Receipt, error)

WaitForTransactionReceiptRetryable repeatedly attempts to fetch the transaction receipt for a given transaction hash. If the receipt is not found, the function will retry with exponential backoff until the specified `waitTimeout` duration is reached. If the receipt is still unavailable after `waitTimeout`, it will return an error.

Note: The `time.Second * 2` is set as the max interval in the retry mechanism because we can't reliably measure the specific time the tx will be included in a block. Setting a higher value will imply doing less retries across the waitTimeout, and so we might lose the receipt All errors are considered Transient Errors - Retry times: 0.5s, 1s, 2s, 2s, 2s, ... until it reaches waitTimeout

func WeiToEth added in v0.11.0

func WeiToEth(wei *big.Int) float64

Types

This section is empty.

Jump to

Keyboard shortcuts

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