utils

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: GPL-3.0, LGPL-3.0 Imports: 11 Imported by: 3 modules, 3 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigNumEqual added in v0.2.8

func BigNumEqual(x, y *big.Int) bool

BigNumEqual returns true if x and y are equivalent ie. both nil or both contain the same value.

func BytesToHashSlice added in v0.5.0

func BytesToHashSlice(b []byte) []common.Hash

BytesToHashSlice packs [b] into a slice of hash values with zero padding to the right if the length of b is not a multiple of 32.

func HashSliceToBytes added in v0.5.0

func HashSliceToBytes(hashes []common.Hash) []byte

HashSliceToBytes serializes a []common.Hash into a tightly packed byte array.

func IncrOne added in v0.3.0

func IncrOne(bytes []byte)

IncrOne increments bytes value by one

func IsBlockForked added in v0.5.3

func IsBlockForked(s, head *big.Int) bool

IsBlockForked returns whether a fork scheduled at block s is active at the given head block. Note: [s] and [head] can be either a block number or a block timestamp.

func IsForkTransition

func IsForkTransition(fork *uint64, parent *uint64, current uint64) bool

IsForkTransition returns true if [fork] activates during the transition from [parent] to [current]. Taking [parent] as a pointer allows for us to pass nil when checking forks that activate during genesis. Note: this works for both block number and timestamp activated forks.

func IsTimestampForked added in v0.5.3

func IsTimestampForked(s *uint64, head uint64) bool

IsTimestampForked returns whether a fork scheduled at timestamp s is active at the given head timestamp. Whilst this method is the same as isBlockForked, they are explicitly separate for clearer reading.

func NewUint64 added in v0.5.3

func NewUint64(val uint64) *uint64

func TimeToNewUint64 added in v0.5.3

func TimeToNewUint64(time time.Time) *uint64

func Uint64PtrEqual added in v0.5.3

func Uint64PtrEqual(x, y *uint64) bool

Uint64PtrEqual returns true if x and y pointers are equivalent ie. both nil or both contain the same value.

func Uint64ToTime added in v0.5.3

func Uint64ToTime(val *uint64) time.Time

Types

type AddressRange added in v0.4.10

type AddressRange struct {
	Start common.Address
	End   common.Address
}

AddressRange represents a continuous range of addresses

func (*AddressRange) Contains added in v0.4.10

func (a *AddressRange) Contains(addr common.Address) bool

Contains returns true iff [addr] is contained within the (inclusive) range of addresses defined by [a].

type MeteredCache added in v0.4.1

type MeteredCache struct {
	*fastcache.Cache
	// contains filtered or unexported fields
}

MeteredCache wraps *fastcache.Cache and periodically pulls stats from it.

func NewMeteredCache added in v0.4.1

func NewMeteredCache(size int, journal string, namespace string, updateFrequency uint64) *MeteredCache

NewMeteredCache returns a new MeteredCache that will update stats to the provided namespace once per each [updateFrequency] operations. Note: if [updateFrequency] is passed as 0, it will be treated as 1.

func (*MeteredCache) Del added in v0.4.1

func (mc *MeteredCache) Del(k []byte)

func (*MeteredCache) Get added in v0.4.1

func (mc *MeteredCache) Get(dst, k []byte) []byte

func (*MeteredCache) GetBig added in v0.4.1

func (mc *MeteredCache) GetBig(dst, k []byte) []byte

func (*MeteredCache) Has added in v0.4.1

func (mc *MeteredCache) Has(k []byte) bool

func (*MeteredCache) HasGet added in v0.4.1

func (mc *MeteredCache) HasGet(dst, k []byte) ([]byte, bool)

func (*MeteredCache) Set added in v0.4.1

func (mc *MeteredCache) Set(k, v []byte)

func (*MeteredCache) SetBig added in v0.4.1

func (mc *MeteredCache) SetBig(k, v []byte)

Jump to

Keyboard shortcuts

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