Documentation ¶
Index ¶
- Constants
- func BasicDataKey(address []byte) []byte
- func BasicDataKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte
- func CodeChunkKey(address []byte, chunk *uint256.Int) []byte
- func CodeChunkKeyWithEvaluatedAddress(addressPoint *verkle.Point, chunk *uint256.Int) []byte
- func CodeHashKey(address []byte) []byte
- func CodeHashKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte
- func GetTreeKey(address []byte, treeIndex *uint256.Int, subIndex byte) []byte
- func GetTreeKeyWithEvaluatedAddress(evaluated *verkle.Point, treeIndex *uint256.Int, subIndex byte) []byte
- func StorageIndex(storageKey []byte) (*uint256.Int, byte)
- func StorageSlotKey(address []byte, storageKey []byte) []byte
- func StorageSlotKeyWithEvaluatedAddress(evaluated *verkle.Point, storageKey []byte) []byte
- type PointCache
Constants ¶
const ( BasicDataLeafKey = 0 CodeHashLeafKey = 1 BasicDataVersionOffset = 0 BasicDataCodeSizeOffset = 5 BasicDataNonceOffset = 8 BasicDataBalanceOffset = 16 )
Variables ¶
This section is empty.
Functions ¶
func BasicDataKey ¶
BasicDataKey returns the verkle tree key of the basic data field for the specified account.
func BasicDataKeyWithEvaluatedAddress ¶
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 ¶
CodeChunkKey returns the verkle tree key of the code chunk for the specified account.
func CodeChunkKeyWithEvaluatedAddress ¶
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 ¶
CodeHashKey returns the verkle tree key of the code hash field for the specified account.
func CodeHashKeyWithEvaluatedAddress ¶
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 ¶
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 StorageSlotKey ¶
StorageSlotKey returns the verkle tree key of the storage slot for the specified account.
func StorageSlotKeyWithEvaluatedAddress ¶
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.