utils

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const SecondsPerSlot uint64 = 12

Variables

View Source
var BuildRelease string
View Source
var BuildTime string
View Source
var BuildVersion string

Functions

func EtherToWei

func EtherToWei(val *uint256.Int) *uint256.Int

func GetBuildVersion

func GetBuildVersion() string

func ReadFileLinesTrimmed

func ReadFileLinesTrimmed(fname string) ([]string, error)

func ReadableAmount added in v1.1.4

func ReadableAmount(amount *uint256.Int) string

func RecoverPanic added in v1.1.3

func RecoverPanic(logger *logrus.Entry, routineName string) bool

func RunTransactionScenario added in v1.1.3

func RunTransactionScenario(ctx context.Context, options TransactionScenarioOptions) error

RunTransactionScenario executes a controlled transaction scenario with rate limiting and concurrency management. It processes transactions according to the specified options until either context cancellation or reaching TotalCount (if > 0).

Features: - Rate-limited execution based on Throughput - Optional dynamic throughput increases - Concurrency control via MaxPending - Sequential logging via transaction chaining

Returns an error only if the scenario cannot be started. Transaction failures should be handled within ProcessNextTxFn.

func WeiToEther

func WeiToEther(val *uint256.Int) *uint256.Int

Types

type ABICallDataBuilder added in v1.1.4

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

func NewABICallDataBuilder added in v1.1.4

func NewABICallDataBuilder(callABI, callFnName, callFnSig, callArgs string) (*ABICallDataBuilder, error)

func (*ABICallDataBuilder) BuildCallData added in v1.1.4

func (b *ABICallDataBuilder) BuildCallData(txIdx uint64) ([]byte, error)

type FlexibleJsonUInt64 added in v1.1.2

type FlexibleJsonUInt64 uint64

func (*FlexibleJsonUInt64) UnmarshalJSON added in v1.1.2

func (f *FlexibleJsonUInt64) UnmarshalJSON(b []byte) error

func (*FlexibleJsonUInt64) UnmarshalYAML added in v1.1.2

func (f *FlexibleJsonUInt64) UnmarshalYAML(unmarshal func(interface{}) error) error

type TransactionScenarioOptions added in v1.1.3

type TransactionScenarioOptions struct {
	TotalCount                  uint64
	Throughput                  uint64
	MaxPending                  uint64
	ThroughputIncrementInterval uint64

	// Logger for scenario execution information
	Logger *logrus.Entry

	// ProcessNextTxFn handles transaction execution with the given index
	// It should return:
	// - A callback function to log transaction results (can be nil)
	// - An error if transaction creation failed
	// - The onComplete callback must be called when transaction processing is complete
	ProcessNextTxFn func(ctx context.Context, txIdx uint64, onComplete func()) (func(), error)
}

TransactionScenarioOptions configures how the transaction scenario is executed.

Jump to

Keyboard shortcuts

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