Documentation ¶
Index ¶
- Constants
- func NewPersistentSlabStorage(baseStorage atree.BaseStorage) (*atree.PersistentSlabStorage, error)
- type Account
- type BaseView
- func (v *BaseView) AddressInAccessList(gethCommon.Address) bool
- func (v *BaseView) Commit() error
- func (v *BaseView) CreateAccount(addr gethCommon.Address, balance *big.Int, nonce uint64, code []byte, ...) error
- func (v *BaseView) DeleteAccount(addr gethCommon.Address) error
- func (v *BaseView) Exist(addr gethCommon.Address) (bool, error)
- func (v *BaseView) GetBalance(addr gethCommon.Address) (*big.Int, error)
- func (v *BaseView) GetCode(addr gethCommon.Address) ([]byte, error)
- func (v *BaseView) GetCodeHash(addr gethCommon.Address) (gethCommon.Hash, error)
- func (v *BaseView) GetCodeSize(addr gethCommon.Address) (int, error)
- func (v *BaseView) GetNonce(addr gethCommon.Address) (uint64, error)
- func (v *BaseView) GetRefund() uint64
- func (v *BaseView) GetState(sk types.SlotAddress) (gethCommon.Hash, error)
- func (v *BaseView) GetTransientState(types.SlotAddress) gethCommon.Hash
- func (v *BaseView) HasSelfDestructed(gethCommon.Address) (bool, *big.Int)
- func (v *BaseView) IsCreated(gethCommon.Address) bool
- func (v *BaseView) SlotInAccessList(types.SlotAddress) (addressOk bool, slotOk bool)
- func (v *BaseView) UpdateAccount(addr gethCommon.Address, balance *big.Int, nonce uint64, code []byte, ...) error
- func (v *BaseView) UpdateSlot(sk types.SlotAddress, value gethCommon.Hash) error
- type ByteStringValue
- func (v ByteStringValue) ByteSize() uint32
- func (v ByteStringValue) Bytes() []byte
- func (v ByteStringValue) ChildStorables() []atree.Storable
- func (v ByteStringValue) Encode(enc *atree.Encoder) error
- func (v ByteStringValue) Storable(storage atree.SlabStorage, address atree.Address, maxInlineSize uint64) (atree.Storable, error)
- func (v ByteStringValue) StoredValue(_ atree.SlabStorage) (atree.Value, error)
- func (v ByteStringValue) String() string
- type Collection
- type CollectionProvider
- type DeltaView
- func (d *DeltaView) AddAddressToAccessList(addr gethCommon.Address) bool
- func (d *DeltaView) AddBalance(addr gethCommon.Address, amount *big.Int) error
- func (d *DeltaView) AddLog(log *gethTypes.Log)
- func (d *DeltaView) AddPreimage(hash gethCommon.Hash, preimage []byte)
- func (d *DeltaView) AddRefund(amount uint64) error
- func (d *DeltaView) AddSlotToAccessList(sk types.SlotAddress) (addrAdded bool, slotAdded bool)
- func (d *DeltaView) AddressInAccessList(addr gethCommon.Address) bool
- func (d *DeltaView) CreateAccount(addr gethCommon.Address) error
- func (d *DeltaView) DirtyAddresses() map[gethCommon.Address]struct{}
- func (d *DeltaView) DirtySlots() map[types.SlotAddress]struct{}
- func (d *DeltaView) Exist(addr gethCommon.Address) (bool, error)
- func (d *DeltaView) GetBalance(addr gethCommon.Address) (*big.Int, error)
- func (d *DeltaView) GetCode(addr gethCommon.Address) ([]byte, error)
- func (d *DeltaView) GetCodeHash(addr gethCommon.Address) (gethCommon.Hash, error)
- func (d *DeltaView) GetCodeSize(addr gethCommon.Address) (int, error)
- func (d *DeltaView) GetNonce(addr gethCommon.Address) (uint64, error)
- func (d *DeltaView) GetRefund() uint64
- func (d *DeltaView) GetState(sk types.SlotAddress) (gethCommon.Hash, error)
- func (d *DeltaView) GetTransientState(sk types.SlotAddress) gethCommon.Hash
- func (d *DeltaView) HasSelfDestructed(addr gethCommon.Address) (bool, *big.Int)
- func (d *DeltaView) IsCreated(addr gethCommon.Address) bool
- func (d *DeltaView) Logs() []*gethTypes.Log
- func (d *DeltaView) NewChildView() *DeltaView
- func (d *DeltaView) Preimages() map[gethCommon.Hash][]byte
- func (d *DeltaView) SelfDestruct(addr gethCommon.Address) error
- func (d *DeltaView) SetCode(addr gethCommon.Address, code []byte) error
- func (d *DeltaView) SetNonce(addr gethCommon.Address, nonce uint64) error
- func (d *DeltaView) SetState(sk types.SlotAddress, value gethCommon.Hash) error
- func (d *DeltaView) SetTransientState(sk types.SlotAddress, value gethCommon.Hash)
- func (d *DeltaView) SlotInAccessList(sk types.SlotAddress) (addressOk bool, slotOk bool)
- func (d *DeltaView) SubBalance(addr gethCommon.Address, amount *big.Int) error
- func (d *DeltaView) SubRefund(amount uint64) error
- type StateDB
- func (db *StateDB) AddAddressToAccessList(addr gethCommon.Address)
- func (db *StateDB) AddBalance(addr gethCommon.Address, amount *big.Int)
- func (db *StateDB) AddLog(log *gethTypes.Log)
- func (db *StateDB) AddPreimage(hash gethCommon.Hash, data []byte)
- func (db *StateDB) AddRefund(amount uint64)
- func (db *StateDB) AddSlotToAccessList(addr gethCommon.Address, key gethCommon.Hash)
- func (db *StateDB) AddressInAccessList(addr gethCommon.Address) bool
- func (db *StateDB) Commit() error
- func (db *StateDB) CreateAccount(addr gethCommon.Address)
- func (db *StateDB) Empty(addr gethCommon.Address) bool
- func (s *StateDB) Error() error
- func (db *StateDB) Exist(addr gethCommon.Address) bool
- func (db *StateDB) GetBalance(addr gethCommon.Address) *big.Int
- func (db *StateDB) GetCode(addr gethCommon.Address) []byte
- func (db *StateDB) GetCodeHash(addr gethCommon.Address) gethCommon.Hash
- func (db *StateDB) GetCodeSize(addr gethCommon.Address) int
- func (db *StateDB) GetCommittedState(addr gethCommon.Address, key gethCommon.Hash) gethCommon.Hash
- func (db *StateDB) GetNonce(addr gethCommon.Address) uint64
- func (db *StateDB) GetRefund() uint64
- func (db *StateDB) GetState(addr gethCommon.Address, key gethCommon.Hash) gethCommon.Hash
- func (db *StateDB) GetTransientState(addr gethCommon.Address, key gethCommon.Hash) gethCommon.Hash
- func (db *StateDB) HasSelfDestructed(addr gethCommon.Address) bool
- func (db *StateDB) IsCreated(addr gethCommon.Address) bool
- func (db *StateDB) Logs(blockHash gethCommon.Hash, blockNumber uint64, txHash gethCommon.Hash, ...) []*gethTypes.Log
- func (db *StateDB) Preimages() map[gethCommon.Hash][]byte
- func (db *StateDB) Prepare(rules gethParams.Rules, sender, coinbase gethCommon.Address, ...)
- func (db *StateDB) RevertToSnapshot(index int)
- func (db *StateDB) SelfDestruct(addr gethCommon.Address)
- func (db *StateDB) Selfdestruct6780(addr gethCommon.Address)
- func (db *StateDB) SetCode(addr gethCommon.Address, code []byte)
- func (db *StateDB) SetNonce(addr gethCommon.Address, nonce uint64)
- func (db *StateDB) SetState(addr gethCommon.Address, key gethCommon.Hash, value gethCommon.Hash)
- func (db *StateDB) SetTransientState(addr gethCommon.Address, key, value gethCommon.Hash)
- func (db *StateDB) SlotInAccessList(addr gethCommon.Address, key gethCommon.Hash) (addressOk bool, slotOk bool)
- func (db *StateDB) Snapshot() int
- func (db *StateDB) SubBalance(addr gethCommon.Address, amount *big.Int)
- func (db *StateDB) SubRefund(amount uint64)
Constants ¶
const ( // AccountsStorageIDKey is the path where we store the collection ID for accounts AccountsStorageIDKey = "AccountsStorageIDKey" // CodesStorageIDKey is the path where we store the collection ID for codes CodesStorageIDKey = "CodesStorageIDKey" )
Variables ¶
This section is empty.
Functions ¶
func NewPersistentSlabStorage ¶
func NewPersistentSlabStorage(baseStorage atree.BaseStorage) (*atree.PersistentSlabStorage, error)
Types ¶
type Account ¶
type Account struct { // address Address gethCommon.Address // balance of the address Balance *big.Int // nonce of the address Nonce uint64 // hash of the code // if no code the gethTypes.EmptyCodeHash is stored CodeHash gethCommon.Hash // the id of the collection holds storage slots for this account // this value is nil for EOA accounts CollectionID []byte }
Account holds the metadata of an address and provides (de)serialization functionality
Note that code and storage slots of an address is not part of this data structure
func DecodeAccount ¶
DecodeAccount constructs a new account from the encoded data
func NewAccount ¶
func NewAccount( address gethCommon.Address, balance *big.Int, nonce uint64, codeHash gethCommon.Hash, collectionID []byte, ) *Account
NewAccount constructs a new account
type BaseView ¶
type BaseView struct {
// contains filtered or unexported fields
}
BaseView implements a types.BaseView it acts as the base layer of state queries for the stateDB it stores accounts, codes and storage slots.
under the hood it uses a set of collections, one for account's meta data, one for codes and one for each of account storage space.
func NewBaseView ¶
NewBaseView constructs a new base view
func (*BaseView) AddressInAccessList ¶
func (v *BaseView) AddressInAccessList(gethCommon.Address) bool
AddressInAccessList checks if an address is in the access list
access list control is not a functionality of the base view it always returns false
func (*BaseView) CreateAccount ¶
func (v *BaseView) CreateAccount( addr gethCommon.Address, balance *big.Int, nonce uint64, code []byte, codeHash gethCommon.Hash, ) error
CreateAccount creates a new account
func (*BaseView) DeleteAccount ¶
func (v *BaseView) DeleteAccount(addr gethCommon.Address) error
DeleteAccount deletes an account's meta data, code, and storage slots associated with that address
func (*BaseView) Exist ¶
func (v *BaseView) Exist(addr gethCommon.Address) (bool, error)
Exist returns true if the address exist in the state
func (*BaseView) GetBalance ¶
GetBalance returns the balance of an address
for non-existent accounts it returns a balance of zero
func (*BaseView) GetCode ¶
func (v *BaseView) GetCode(addr gethCommon.Address) ([]byte, error)
GetCode returns the code of an address
for non-existent accounts or accounts without a code (e.g. EOAs) it returns nil
func (*BaseView) GetCodeHash ¶
func (v *BaseView) GetCodeHash(addr gethCommon.Address) (gethCommon.Hash, error)
GetCodeHash returns the code hash of an address
for non-existent accounts or accounts without a code (e.g. EOAs) it returns default empty hash value (gethTypes.EmptyCodeHash)
func (*BaseView) GetCodeSize ¶
func (v *BaseView) GetCodeSize(addr gethCommon.Address) (int, error)
GetCodeSize returns the code size of an address
for non-existent accounts or accounts without a code (e.g. EOAs) it returns zero
func (*BaseView) GetNonce ¶
func (v *BaseView) GetNonce(addr gethCommon.Address) (uint64, error)
GetNonce returns the nonce of an address
for non-existent accounts it returns zero
func (*BaseView) GetRefund ¶
GetRefund returns the total amount of (gas) refund
this method returns the value of zero
func (*BaseView) GetState ¶
func (v *BaseView) GetState(sk types.SlotAddress) (gethCommon.Hash, error)
GetState returns values for a slot in the main storage
for non-existent slots it returns the default empty hash value (gethTypes.EmptyCodeHash)
func (*BaseView) GetTransientState ¶
func (v *BaseView) GetTransientState(types.SlotAddress) gethCommon.Hash
GetTransientState returns values for an slot transient storage
transient storage is not a functionality for the base view so it always returns the default value for non-existent slots
func (*BaseView) HasSelfDestructed ¶
HasSelfDestructed returns true if an address is flagged for destruction at the end of transaction
func (*BaseView) IsCreated ¶
func (v *BaseView) IsCreated(gethCommon.Address) bool
IsCreated returns true if the address has been created in the context of this transaction
func (*BaseView) SlotInAccessList ¶
func (v *BaseView) SlotInAccessList(types.SlotAddress) (addressOk bool, slotOk bool)
SlotInAccessList checks if a slot is in the access list
access list control is not a functionality of the base view it always returns false
func (*BaseView) UpdateAccount ¶
func (v *BaseView) UpdateAccount( addr gethCommon.Address, balance *big.Int, nonce uint64, code []byte, codeHash gethCommon.Hash, ) error
UpdateAccount updates an account's meta data
func (*BaseView) UpdateSlot ¶
func (v *BaseView) UpdateSlot(sk types.SlotAddress, value gethCommon.Hash) error
UpdateSlot updates the value for a slot
type ByteStringValue ¶
type ByteStringValue struct {
// contains filtered or unexported fields
}
func NewByteStringValue ¶
func NewByteStringValue(data []byte) ByteStringValue
func (ByteStringValue) ByteSize ¶
func (v ByteStringValue) ByteSize() uint32
func (ByteStringValue) Bytes ¶
func (v ByteStringValue) Bytes() []byte
func (ByteStringValue) ChildStorables ¶
func (v ByteStringValue) ChildStorables() []atree.Storable
func (ByteStringValue) Storable ¶
func (v ByteStringValue) Storable(storage atree.SlabStorage, address atree.Address, maxInlineSize uint64) (atree.Storable, error)
func (ByteStringValue) StoredValue ¶
func (v ByteStringValue) StoredValue(_ atree.SlabStorage) (atree.Value, error)
func (ByteStringValue) String ¶
func (v ByteStringValue) String() string
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection provides a persistent and compact way of storing key/value pairs each collection has a unique collectionID that can be used to fetch the collection
TODO(ramtin): we might not need any extra hashing on the atree side and optimize this to just use the key given the keys are hashed ?
func (*Collection) CollectionID ¶
func (c *Collection) CollectionID() []byte
CollectionID returns the unique id for the collection
func (*Collection) Destroy ¶
func (c *Collection) Destroy() ([][]byte, error)
Destroy destroys the whole collection
func (*Collection) Get ¶
func (c *Collection) Get(key []byte) ([]byte, error)
Get gets the value for the given key
if key doesn't exist it returns nil (no error)
func (*Collection) Remove ¶
func (c *Collection) Remove(key []byte) error
Remove removes a key from the collection
if the key doesn't exist it return no error
func (*Collection) Set ¶
func (c *Collection) Set(key, value []byte) error
Set sets the value for the given key
if a value already stored at the given key it replaces the value
type CollectionProvider ¶
type CollectionProvider struct {
// contains filtered or unexported fields
}
CollectionProvider provides access to collections
func NewCollectionProvider ¶
func NewCollectionProvider( rootAddr atree.Address, ledger atree.Ledger, ) (*CollectionProvider, error)
NewCollectionProvider constructs a new CollectionProvider
func (*CollectionProvider) CollectionByID ¶
func (cp *CollectionProvider) CollectionByID(collectionID []byte) (*Collection, error)
CollectionByID returns the collection by collection ID
if no collection is found with that collection id, it return error Warning: this method should only used only once for each collection and the returned pointer should be kept for the future. calling twice for the same collection might result in odd-behaviours currently collection provider doesn't do any internal caching to protect aginast these cases
func (*CollectionProvider) Commit ¶
func (cp *CollectionProvider) Commit() error
Commit commits all changes to the collections with changes
func (*CollectionProvider) NewCollection ¶
func (cp *CollectionProvider) NewCollection() (*Collection, error)
NewCollection constructs a new collection
type DeltaView ¶
type DeltaView struct {
// contains filtered or unexported fields
}
DeltaView captures the changes to the state during the execution
for most of the read calls it checks its change logs and if no record is found it would redirect the call to the parent view.
func NewDeltaView ¶
func NewDeltaView(parent types.ReadOnlyView) *DeltaView
NewDeltaView constructs a new delta view
func (*DeltaView) AddAddressToAccessList ¶
func (d *DeltaView) AddAddressToAccessList(addr gethCommon.Address) bool
AddAddressToAccessList adds an address to the access list
func (*DeltaView) AddBalance ¶
AddBalance adds the amount to the current balance of the given address
func (*DeltaView) AddPreimage ¶
func (d *DeltaView) AddPreimage(hash gethCommon.Hash, preimage []byte)
AddPreimage adds a preimage
func (*DeltaView) AddSlotToAccessList ¶
func (d *DeltaView) AddSlotToAccessList(sk types.SlotAddress) (addrAdded bool, slotAdded bool)
AddSlotToAccessList adds a slot to the access list it also adds the address to the address list
func (*DeltaView) AddressInAccessList ¶
func (d *DeltaView) AddressInAccessList(addr gethCommon.Address) bool
AddressInAccessList checks if the address is in the access list
func (*DeltaView) CreateAccount ¶
func (d *DeltaView) CreateAccount(addr gethCommon.Address) error
CreateAccount creates a new account for the given address
if address already extists (even if destructed), carry over the balance and reset the data from the orginal account.
func (*DeltaView) DirtyAddresses ¶
func (d *DeltaView) DirtyAddresses() map[gethCommon.Address]struct{}
DirtyAddresses returns a set of addresses that has been updated in this view
func (*DeltaView) DirtySlots ¶
func (d *DeltaView) DirtySlots() map[types.SlotAddress]struct{}
DirtySlots returns a set of slots that has been updated in this view
func (*DeltaView) Exist ¶
func (d *DeltaView) Exist(addr gethCommon.Address) (bool, error)
Exist returns true if address exists
it also returns true for both newly created accounts or accounts that has been flagged for deletion
func (*DeltaView) GetBalance ¶
GetBalance returns the balance of the given address
func (*DeltaView) GetCode ¶
func (d *DeltaView) GetCode(addr gethCommon.Address) ([]byte, error)
GetCode returns the code of the given address
func (*DeltaView) GetCodeHash ¶
func (d *DeltaView) GetCodeHash(addr gethCommon.Address) (gethCommon.Hash, error)
GetCodeHash returns the code hash of the given address
func (*DeltaView) GetCodeSize ¶
func (d *DeltaView) GetCodeSize(addr gethCommon.Address) (int, error)
GetCodeSize returns the code size of the given address
func (*DeltaView) GetNonce ¶
func (d *DeltaView) GetNonce(addr gethCommon.Address) (uint64, error)
GetNonce returns the nonce of the given address
func (*DeltaView) GetState ¶
func (d *DeltaView) GetState(sk types.SlotAddress) (gethCommon.Hash, error)
GetState returns the value of the slot of the main state
func (*DeltaView) GetTransientState ¶
func (d *DeltaView) GetTransientState(sk types.SlotAddress) gethCommon.Hash
GetTransientState returns the value of the slot of the transient state
func (*DeltaView) HasSelfDestructed ¶
HasSelfDestructed returns true if address has been flagged for destruction it also returns the balance of the address before the destruction call
func (*DeltaView) IsCreated ¶
func (d *DeltaView) IsCreated(addr gethCommon.Address) bool
IsCreated returns true if address has been created in this tx
func (*DeltaView) NewChildView ¶
NewChildView constructs a new delta view having the current view as parent
func (*DeltaView) Preimages ¶
func (d *DeltaView) Preimages() map[gethCommon.Hash][]byte
Preimages returns a map of preimages
func (*DeltaView) SelfDestruct ¶
func (d *DeltaView) SelfDestruct(addr gethCommon.Address) error
SelfDestruct sets a flag to destruct the account at the end of transaction
if an account has been created in this transaction, it would return an error
func (*DeltaView) SetCode ¶
func (d *DeltaView) SetCode(addr gethCommon.Address, code []byte) error
SetCode sets the code for the given address
func (*DeltaView) SetNonce ¶
func (d *DeltaView) SetNonce(addr gethCommon.Address, nonce uint64) error
SetNonce sets the nonce for the given address
func (*DeltaView) SetState ¶
func (d *DeltaView) SetState(sk types.SlotAddress, value gethCommon.Hash) error
SetState adds sets a value for the given slot of the main storage
func (*DeltaView) SetTransientState ¶
func (d *DeltaView) SetTransientState(sk types.SlotAddress, value gethCommon.Hash)
SetTransientState adds sets a value for the given slot of the transient storage
func (*DeltaView) SlotInAccessList ¶
func (d *DeltaView) SlotInAccessList(sk types.SlotAddress) (addressOk bool, slotOk bool)
SlotInAccessList checks if the slot is in the access list
func (*DeltaView) SubBalance ¶
SubBalance subtracts the amount from the current balance of the given address
type StateDB ¶
type StateDB struct {
// contains filtered or unexported fields
}
StateDB implements a types.StateDB interface
stateDB interface defined by the Geth doesn't support returning errors when state calls are happening, and requires stateDB to cache the error and return it at a later time (when commit is called). Only the first error is expected to be returned. Warning: current implementation of the StateDB is considered to be used for a single EVM transaction execution and is not thread safe. yet the current design supports addition of concurrency in the future if needed
func NewStateDB ¶
NewStateDB constructs a new StateDB
func (*StateDB) AddAddressToAccessList ¶
func (db *StateDB) AddAddressToAccessList(addr gethCommon.Address)
AddAddressToAccessList adds the given address to the access list.
func (*StateDB) AddBalance ¶
func (db *StateDB) AddBalance(addr gethCommon.Address, amount *big.Int)
AddBalance adds the amount from the balance of the given address
func (*StateDB) AddPreimage ¶
func (db *StateDB) AddPreimage(hash gethCommon.Hash, data []byte)
AddPreimage adds a preimage to the collection of preimages
func (*StateDB) AddSlotToAccessList ¶
func (db *StateDB) AddSlotToAccessList(addr gethCommon.Address, key gethCommon.Hash)
AddSlotToAccessList adds the given (address,slot) to the access list.
func (*StateDB) AddressInAccessList ¶
func (db *StateDB) AddressInAccessList(addr gethCommon.Address) bool
AddressInAccessList checks if an address is in the access list
func (*StateDB) CreateAccount ¶
func (db *StateDB) CreateAccount(addr gethCommon.Address)
CreateAccount creates a new account for the given address it sets the nonce to zero
func (*StateDB) Empty ¶
func (db *StateDB) Empty(addr gethCommon.Address) bool
Empty returns whether the given account is empty.
Empty is defined according to EIP161 (balance = nonce = code = 0).
func (*StateDB) Exist ¶
func (db *StateDB) Exist(addr gethCommon.Address) bool
Exist returns true if the given address exists in state.
this should also return true for self destructed accounts during the transaction execution.
func (*StateDB) GetBalance ¶
func (db *StateDB) GetBalance(addr gethCommon.Address) *big.Int
GetBalance returns the balance of the given address
func (*StateDB) GetCode ¶
func (db *StateDB) GetCode(addr gethCommon.Address) []byte
GetCode returns the code for the given address
func (*StateDB) GetCodeHash ¶
func (db *StateDB) GetCodeHash(addr gethCommon.Address) gethCommon.Hash
GetCodeHash returns the code hash of the given address
func (*StateDB) GetCodeSize ¶
func (db *StateDB) GetCodeSize(addr gethCommon.Address) int
GetCodeSize returns the size of the code for the given address
func (*StateDB) GetCommittedState ¶
func (db *StateDB) GetCommittedState(addr gethCommon.Address, key gethCommon.Hash) gethCommon.Hash
GetCommittedState returns the value for the given storage slot considering only the commited state and not changes in the scope of current transaction.
func (*StateDB) GetNonce ¶
func (db *StateDB) GetNonce(addr gethCommon.Address) uint64
GetNonce returns the nonce of the given address
func (*StateDB) GetState ¶
func (db *StateDB) GetState(addr gethCommon.Address, key gethCommon.Hash) gethCommon.Hash
GetState returns the value for the given storage slot
func (*StateDB) GetTransientState ¶
func (db *StateDB) GetTransientState(addr gethCommon.Address, key gethCommon.Hash) gethCommon.Hash
GetTransientState returns the value for the given key of the transient storage
func (*StateDB) HasSelfDestructed ¶
func (db *StateDB) HasSelfDestructed(addr gethCommon.Address) bool
HasSelfDestructed returns true if address is flaged with self destruct.
func (*StateDB) IsCreated ¶
func (db *StateDB) IsCreated(addr gethCommon.Address) bool
IsCreated returns true if address is recently created (context of a transaction)
func (*StateDB) Logs ¶
func (db *StateDB) Logs( blockHash gethCommon.Hash, blockNumber uint64, txHash gethCommon.Hash, txIndex uint, ) []*gethTypes.Log
Logs returns the list of logs it also update each log with the block and tx info
func (*StateDB) Preimages ¶
func (db *StateDB) Preimages() map[gethCommon.Hash][]byte
Preimages returns a set of preimages
func (*StateDB) Prepare ¶
func (db *StateDB) Prepare(rules gethParams.Rules, sender, coinbase gethCommon.Address, dest *gethCommon.Address, precompiles []gethCommon.Address, txAccesses gethTypes.AccessList)
Prepare is a highlevel logic that sadly is considered to be part of the stateDB interface and not on the layers above. based on parameters that are passed it updates accesslists
func (*StateDB) RevertToSnapshot ¶
RevertToSnapshot reverts the changes until we reach the given snaptshot
func (*StateDB) SelfDestruct ¶
func (db *StateDB) SelfDestruct(addr gethCommon.Address)
SelfDestruct flags the address for deletion.
while this address exists for the rest of transaction, the balance of this account is return zero after the SelfDestruct call.
func (*StateDB) Selfdestruct6780 ¶
func (db *StateDB) Selfdestruct6780(addr gethCommon.Address)
Selfdestruct6780 would only follow the self destruct steps if account is created
func (*StateDB) SetCode ¶
func (db *StateDB) SetCode(addr gethCommon.Address, code []byte)
SetCode sets the code for the given address
func (*StateDB) SetNonce ¶
func (db *StateDB) SetNonce(addr gethCommon.Address, nonce uint64)
SetNonce sets the nonce value for the given address
func (*StateDB) SetState ¶
func (db *StateDB) SetState(addr gethCommon.Address, key gethCommon.Hash, value gethCommon.Hash)
SetState sets a value for the given storage slot
func (*StateDB) SetTransientState ¶
func (db *StateDB) SetTransientState(addr gethCommon.Address, key, value gethCommon.Hash)
SetTransientState sets a value for the given key of the transient storage
func (*StateDB) SlotInAccessList ¶
func (db *StateDB) SlotInAccessList(addr gethCommon.Address, key gethCommon.Hash) (addressOk bool, slotOk bool)
SlotInAccessList checks if the given (address,slot) is in the access list
func (*StateDB) Snapshot ¶
Snapshot takes an snapshot of the state and returns an int that can be used later for revert calls.
func (*StateDB) SubBalance ¶
func (db *StateDB) SubBalance(addr gethCommon.Address, amount *big.Int)
SubBalance substitutes the amount from the balance of the given address