Documentation ¶
Index ¶
- Variables
- func DecodeNameRegEntry(entryBytes []byte) *core_types.NameRegEntry
- func ExecTx(blockCache *BlockCache, tx txs.Tx, runCall bool, evc events.Fireable, ...) (err error)
- func HasPermission(state AccountGetter, acc *acm.Account, perm ptypes.PermFlag, ...) bool
- func NameRegDecoder(r io.Reader, n *int, err *error) interface{}
- func NameRegEncoder(o interface{}, w io.Writer, n *int, err *error)
- func NewContractAddress(caller []byte, nonce int) []byte
- type AccountGetter
- type BlockCache
- func (cache *BlockCache) GetAccount(addr []byte) *acm.Account
- func (cache *BlockCache) GetNameRegEntry(name string) *core_types.NameRegEntry
- func (cache *BlockCache) GetStorage(addr Word256, key Word256) (value Word256)
- func (cache *BlockCache) RemoveAccount(addr []byte)
- func (cache *BlockCache) RemoveNameRegEntry(name string)
- func (cache *BlockCache) SetStorage(addr Word256, key Word256, value Word256)
- func (cache *BlockCache) State() *State
- func (cache *BlockCache) Sync()
- func (cache *BlockCache) UpdateAccount(acc *acm.Account)
- func (cache *BlockCache) UpdateNameRegEntry(entry *core_types.NameRegEntry)
- type InvalidTxError
- type State
- func (s *State) Copy() *State
- func (s *State) GetAccount(address []byte) *acm.Account
- func (s *State) GetAccounts() merkle.Tree
- func (s *State) GetGasLimit() int64
- func (s *State) GetGenesisDoc() (*genesis.GenesisDoc, error)
- func (s *State) GetNameRegEntry(name string) *core_types.NameRegEntry
- func (s *State) GetNames() merkle.Tree
- func (s *State) Hash() []byte
- func (s *State) LoadStorage(hash []byte) (storage merkle.Tree)
- func (s *State) RemoveAccount(address []byte) bool
- func (s *State) RemoveNameRegEntry(name string) bool
- func (s *State) Save()
- func (s *State) SetAccounts(accounts merkle.Tree)
- func (s *State) SetDB(db dbm.DB)
- func (s *State) SetFireable(evc events.Fireable)
- func (s *State) SetNameReg(nameReg merkle.Tree)
- func (s *State) UpdateAccount(account *acm.Account) bool
- func (s *State) UpdateNameRegEntry(entry *core_types.NameRegEntry) bool
- type TxCache
- func (cache *TxCache) CreateAccount(creator *vm.Account) *vm.Account
- func (cache *TxCache) GetAccount(addr Word256) *vm.Account
- func (cache *TxCache) GetStorage(addr Word256, key Word256) Word256
- func (cache *TxCache) RemoveAccount(acc *vm.Account)
- func (cache *TxCache) SetStorage(addr Word256, key Word256, value Word256)
- func (cache *TxCache) Sync()
- func (cache *TxCache) UpdateAccount(acc *vm.Account)
- type VMAccountState
Constants ¶
This section is empty.
Variables ¶
var NameRegCodec = wire.Codec{ Encode: NameRegEncoder, Decode: NameRegDecoder, }
Functions ¶
func DecodeNameRegEntry ¶
func DecodeNameRegEntry(entryBytes []byte) *core_types.NameRegEntry
func ExecTx ¶
func ExecTx(blockCache *BlockCache, tx txs.Tx, runCall bool, evc events.Fireable, logger logging_types.InfoTraceLogger) (err error)
If the tx is invalid, an error will be returned. Unlike ExecBlock(), state will not be altered.
func HasPermission ¶
func HasPermission(state AccountGetter, acc *acm.Account, perm ptypes.PermFlag, logger logging_types.InfoTraceLogger) bool
Get permission on an account or fall back to global value
func NewContractAddress ¶
Convenience function to return address of new contract
Types ¶
type AccountGetter ¶
type BlockCache ¶
type BlockCache struct {
// contains filtered or unexported fields
}
The blockcache helps prevent unnecessary IAVLTree updates and garbage generation.
func NewBlockCache ¶
func NewBlockCache(backend *State) *BlockCache
func (*BlockCache) GetAccount ¶
func (cache *BlockCache) GetAccount(addr []byte) *acm.Account
func (*BlockCache) GetNameRegEntry ¶
func (cache *BlockCache) GetNameRegEntry(name string) *core_types.NameRegEntry
func (*BlockCache) GetStorage ¶
func (cache *BlockCache) GetStorage(addr Word256, key Word256) (value Word256)
func (*BlockCache) RemoveAccount ¶
func (cache *BlockCache) RemoveAccount(addr []byte)
func (*BlockCache) RemoveNameRegEntry ¶
func (cache *BlockCache) RemoveNameRegEntry(name string)
func (*BlockCache) SetStorage ¶
func (cache *BlockCache) SetStorage(addr Word256, key Word256, value Word256)
NOTE: Set value to zero to removed from the trie.
func (*BlockCache) State ¶
func (cache *BlockCache) State() *State
func (*BlockCache) Sync ¶
func (cache *BlockCache) Sync()
CONTRACT the updates are in deterministic order.
func (*BlockCache) UpdateAccount ¶
func (cache *BlockCache) UpdateAccount(acc *acm.Account)
func (*BlockCache) UpdateNameRegEntry ¶
func (cache *BlockCache) UpdateNameRegEntry(entry *core_types.NameRegEntry)
type InvalidTxError ¶
func (InvalidTxError) Error ¶
func (txErr InvalidTxError) Error() string
type State ¶
type State struct { DB dbm.DB ChainID string LastBlockHeight int LastBlockHash []byte LastBlockParts types.PartSetHeader LastBlockTime time.Time // contains filtered or unexported fields }
NOTE: not goroutine-safe.
func MakeGenesisState ¶
func MakeGenesisState(db dbm.DB, genDoc *genesis.GenesisDoc) *State
func (*State) Copy ¶
CONTRACT: Copy() is a cheap way to take a snapshot, as if State were copied by value.
func (*State) GetAccount ¶
Returns nil if account does not exist with given address. Implements Statelike
func (*State) GetAccounts ¶
func (s *State) GetAccounts() merkle.Tree
The returned Account is a copy, so mutating it has no side effects.
func (*State) GetGasLimit ¶
func (*State) GetGenesisDoc ¶
func (s *State) GetGenesisDoc() (*genesis.GenesisDoc, error)
func (*State) GetNameRegEntry ¶
func (s *State) GetNameRegEntry(name string) *core_types.NameRegEntry
func (*State) LoadStorage ¶
func (*State) RemoveAccount ¶
Implements Statelike
func (*State) RemoveNameRegEntry ¶
func (*State) SetFireable ¶
func (s *State) SetFireable(evc events.Fireable)
Implements events.Eventable. Typically uses events.EventCache
func (*State) UpdateAccount ¶
The account is copied before setting, so mutating it afterwards has no side effects. Implements Statelike
func (*State) UpdateNameRegEntry ¶
func (s *State) UpdateNameRegEntry(entry *core_types.NameRegEntry) bool
type TxCache ¶
type TxCache struct {
// contains filtered or unexported fields
}
func NewTxCache ¶
func NewTxCache(backend *BlockCache) *TxCache
func (*TxCache) CreateAccount ¶
func (cache *TxCache) CreateAccount(creator *vm.Account) *vm.Account
Creates a 20 byte address and bumps the creator's nonce.
func (*TxCache) GetAccount ¶
func (cache *TxCache) GetAccount(addr Word256) *vm.Account
func (*TxCache) GetStorage ¶
func (cache *TxCache) GetStorage(addr Word256, key Word256) Word256
func (*TxCache) RemoveAccount ¶
func (cache *TxCache) RemoveAccount(acc *vm.Account)
func (*TxCache) SetStorage ¶
func (cache *TxCache) SetStorage(addr Word256, key Word256, value Word256)
NOTE: Set value to zero to removed from the trie.
func (*TxCache) Sync ¶
func (cache *TxCache) Sync()
These updates do not have to be in deterministic order, the backend is responsible for ordering updates.
func (*TxCache) UpdateAccount ¶
func (cache *TxCache) UpdateAccount(acc *vm.Account)
type VMAccountState ¶
type VMAccountState interface { GetAccount(addr Word256) *vm.Account UpdateAccount(acc *vm.Account) RemoveAccount(acc *vm.Account) CreateAccount(creator *vm.Account) *vm.Account }