types

package
v0.0.0-...-d7cfa30 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAccountStorageKey

func GetAccountStorageKey(addr common.Address, version uint64) string

GetAccountStorageKey gets the storage key for a given address and version.

func MarshalAccountValue

func MarshalAccountValue(v AccountValue, bs []byte) (n int)

MarshalAccountValue implements the mus.Marshaller interface.

func MarshalAddress

func MarshalAddress(v common.Address, bs []byte) (n int)

MarshalAddress implements the mus.Marshaller interface.

func MarshalBytes

func MarshalBytes(v []byte, bs []byte) (n int)

MarshalBytes implements the mus.Marshaller interface.

func MarshalHash

func MarshalHash(v common.Hash, bs []byte) (n int)

MarshalHash implements the mus.Marshaller interface.

func MarshalLayerLog

func MarshalLayerLog(v LayerLog, bs []byte) (n int)

MarshalLayerLog implements the mus.Marshaller interface.

func MarshalStorage

func MarshalStorage(v map[common.Hash]common.Hash, bs []byte) (n int)

MarshalStorage implements the mus.Marshaller interface.

func MarshalUint256

func MarshalUint256(v *uint256.Int, bs []byte) (n int)

MarshalUint256 implements the mus.Marshaller interface.

func SizeAccountValue

func SizeAccountValue(v AccountValue) (size int)

SizeAccountValue implements the mus.Sizer interface.

func SizeAddress

func SizeAddress(v common.Address) (size int)

SizeAddress implements the mus.Sizer interface.

func SizeBytes

func SizeBytes(v []byte) (size int)

SizeBytes implements the mus.Sizer interface.

func SizeHash

func SizeHash(v common.Hash) (size int)

SizeHash implements the mus.Sizer interface.

func SizeLayerLog

func SizeLayerLog(v LayerLog) (size int)

SizeLayerLog implements the mus.Sizer interface.

func SizeStorage

func SizeStorage(v map[common.Hash]common.Hash) (size int)

SizeStorage implements the mus.Sizer interface.

func SizeUint256

func SizeUint256(v *uint256.Int) (size int)

SizeUint256 implements the mus.Sizer interface.

func SplitAccountStorageKey

func SplitAccountStorageKey(key string) (common.Address, uint64)

SplitAccountStorageKey splits the storage key to get the address and version. This is unsafe, must be called on valid key string.

func UnmarshalAddress

func UnmarshalAddress(bs []byte) (v common.Address, n int, err error)

UnmarshalAddress implements the mus.Unmarshaller interface.

func UnmarshalBytes

func UnmarshalBytes(bs []byte) (v []byte, n int, err error)

UnmarshalBytes implements the mus.Unmarshaller interface.

func UnmarshalHash

func UnmarshalHash(bs []byte) (v common.Hash, n int, err error)

UnmarshalHash implements the mus.Unmarshaller interface.

func UnmarshalStorage

func UnmarshalStorage(bs []byte) (v map[common.Hash]common.Hash, n int, err error)

UnmarshalStorage implements the mus.Unmarshaller interface.

func UnmarshalUint256

func UnmarshalUint256(bs []byte) (v *uint256.Int, n int, err error)

UnmarshalUint256 implements the mus.Unmarshaller interface.

Types

type AccountValue

type AccountValue struct {
	// The nonce of the account
	Nonce uint64

	// The balance of the account
	Balance *uint256.Int

	// The code hash of this account
	CodeHash common.Hash

	// Flag indicating if this account's storage trie is empty
	DirtyStorage bool

	// Version of the account
	Version uint64
}

AccountValue is used to represent the state of an account.

func UnmarshalAccountValue

func UnmarshalAccountValue(bs []byte) (v AccountValue, n int, err error)

UnmarshalAccountValue implements the mus.Unmarshaller interface.

type LayerLog

type LayerLog struct {
	// Block number of this layer
	BlockNumber uint64

	// Root hash of this layer
	RootHash common.Hash

	// Updated accounts in this layer
	// A map from addr -> acct value
	UpdatedAccounts map[common.Address]AccountValue

	// Updated code (added/deleted) count in this layer
	// A map from codeHash -> change in count.
	UpdatedCodeCount map[common.Hash]int64

	// Seen code in this layer
	// A map from codeHash -> code
	CodePreimage map[common.Hash][]byte

	// Updated storage in this layer
	// A map from "addr.Hex()-version" -> key -> value
	UpdatedStorage map[string]map[common.Hash]common.Hash
}

LayerLog is used to represent the state existed in a state layer.

func LayerLogFromGenesis

func LayerLogFromGenesis(genesis *core.Genesis, genesisRoot common.Hash) *LayerLog

Creates layerlog for the genesis block.

func UnmarshalLayerLog

func UnmarshalLayerLog(bs []byte) (v LayerLog, n int, err error)

UnmarshalLayerLog implements the mus.Unmarshaller interface.

Jump to

Keyboard shortcuts

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