utils

package
v1.14.11 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: GPL-3.0 Imports: 7 Imported by: 26

Documentation

Index

Constants

View Source
const (
	BasicDataLeafKey = 0
	CodeHashLeafKey  = 1

	BasicDataVersionOffset  = 0
	BasicDataCodeSizeOffset = 5
	BasicDataNonceOffset    = 8
	BasicDataBalanceOffset  = 16
)

Variables

This section is empty.

Functions

func BasicDataKey added in v1.14.9

func BasicDataKey(address []byte) []byte

BasicDataKey returns the verkle tree key of the basic data field for the specified account.

func BasicDataKeyWithEvaluatedAddress added in v1.14.9

func BasicDataKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte

BasicDataKeyWithEvaluatedAddress returns the verkle tree key of the basic data field for the specified account. The difference between BasicDataKey is the address evaluation is already computed to minimize the computational overhead.

func CodeChunkKey

func CodeChunkKey(address []byte, chunk *uint256.Int) []byte

CodeChunkKey returns the verkle tree key of the code chunk for the specified account.

func CodeChunkKeyWithEvaluatedAddress

func CodeChunkKeyWithEvaluatedAddress(addressPoint *verkle.Point, chunk *uint256.Int) []byte

CodeChunkKeyWithEvaluatedAddress returns the verkle tree key of the code chunk for the specified account. The difference between CodeChunkKey is the address evaluation is already computed to minimize the computational overhead.

func CodeHashKey added in v1.14.9

func CodeHashKey(address []byte) []byte

CodeHashKey returns the verkle tree key of the code hash field for the specified account.

func CodeHashKeyWithEvaluatedAddress added in v1.14.9

func CodeHashKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte

CodeHashKeyWithEvaluatedAddress returns the verkle tree key of the code hash for the specified account. The difference between CodeHashKey is the address evaluation is already computed to minimize the computational overhead.

func GetTreeKey

func GetTreeKey(address []byte, treeIndex *uint256.Int, subIndex byte) []byte

GetTreeKey performs both the work of the spec's get_tree_key function, and that of pedersen_hash: it builds the polynomial in pedersen_hash without having to create a mostly zero-filled buffer and "type cast" it to a 128-long 16-byte array. Since at most the first 5 coefficients of the polynomial will be non-zero, these 5 coefficients are created directly.

func GetTreeKeyWithEvaluatedAddress

func GetTreeKeyWithEvaluatedAddress(evaluated *verkle.Point, treeIndex *uint256.Int, subIndex byte) []byte

GetTreeKeyWithEvaluatedAddress is basically identical to GetTreeKey, the only difference is a part of polynomial is already evaluated.

Specifically, poly = [2+256*64, address_le_low, address_le_high] is already evaluated.

func StorageIndex added in v1.14.4

func StorageIndex(bytes []byte) (*uint256.Int, byte)

func StorageSlotKey

func StorageSlotKey(address []byte, storageKey []byte) []byte

StorageSlotKey returns the verkle tree key of the storage slot for the specified account.

func StorageSlotKeyWithEvaluatedAddress

func StorageSlotKeyWithEvaluatedAddress(evaluated *verkle.Point, storageKey []byte) []byte

StorageSlotKeyWithEvaluatedAddress returns the verkle tree key of the storage slot for the specified account. The difference between StorageSlotKey is the address evaluation is already computed to minimize the computational overhead.

Types

type PointCache

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

PointCache is the LRU cache for storing evaluated address commitment.

func NewPointCache

func NewPointCache(maxItems int) *PointCache

NewPointCache returns the cache with specified size.

func (*PointCache) Get

func (c *PointCache) Get(addr []byte) *verkle.Point

Get returns the cached commitment for the specified address, or computing it on the flight.

func (*PointCache) GetStem

func (c *PointCache) GetStem(addr []byte) []byte

GetStem returns the first 31 bytes of the tree key as the tree stem. It only works for the account metadata whose treeIndex is 0.

Jump to

Keyboard shortcuts

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