Documentation ¶
Index ¶
- Constants
- func BalanceKey(address []byte) []byte
- func BalanceKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte
- func CodeChunkKey(address []byte, chunk *uint256.Int) []byte
- func CodeChunkKeyWithEvaluatedAddress(addressPoint *verkle.Point, chunk *uint256.Int) []byte
- func CodeKeccakKey(address []byte) []byte
- func CodeKeccakKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte
- func CodeSizeKey(address []byte) []byte
- func CodeSizeKeyWithEvaluatedAddress(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 NonceKey(address []byte) []byte
- func NonceKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte
- func StorageSlotKey(address []byte, storageKey []byte) []byte
- func StorageSlotKeyWithEvaluatedAddress(evaluated *verkle.Point, storageKey []byte) []byte
- func VersionKey(address []byte) []byte
- func VersionKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte
- type PointCache
Constants ¶
const ( // The spec of verkle key encoding can be found here. // https://notes.ethereum.org/@vbuterin/verkle_tree_eip#Tree-embedding VersionLeafKey = 0 BalanceLeafKey = 1 NonceLeafKey = 2 CodeKeccakLeafKey = 3 CodeSizeLeafKey = 4 )
Variables ¶
This section is empty.
Functions ¶
func BalanceKey ¶
BalanceKey returns the verkle tree key of the balance field for the specified account.
func BalanceKeyWithEvaluatedAddress ¶
func BalanceKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte
BalanceKeyWithEvaluatedAddress returns the verkle tree key of the balance field for the specified account. The difference between BalanceKey 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 CodeKeccakKey ¶
CodeKeccakKey returns the verkle tree key of the code keccak field for the specified account.
func CodeKeccakKeyWithEvaluatedAddress ¶
func CodeKeccakKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte
CodeKeccakKeyWithEvaluatedAddress returns the verkle tree key of the code keccak for the specified account. The difference between CodeKeccakKey is the address evaluation is already computed to minimize the computational overhead.
func CodeSizeKey ¶
CodeSizeKey returns the verkle tree key of the code size field for the specified account.
func CodeSizeKeyWithEvaluatedAddress ¶
func CodeSizeKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte
CodeSizeKeyWithEvaluatedAddress returns the verkle tree key of the code size for the specified account. The difference between CodeSizeKey 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 NonceKeyWithEvaluatedAddress ¶
func NonceKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte
NonceKeyWithEvaluatedAddress returns the verkle tree key of the nonce field for the specified account. The difference between NonceKey is the address evaluation is already computed to minimize the computational overhead.
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.
func VersionKey ¶
VersionKey returns the verkle tree key of the version field for the specified account.
func VersionKeyWithEvaluatedAddress ¶
func VersionKeyWithEvaluatedAddress(evaluated *verkle.Point) []byte
VersionKeyWithEvaluatedAddress returns the verkle tree key of the version field for the specified account. The difference between VersionKey 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.