state

package
v0.7.11 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2014 License: LGPL-2.1-or-later Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsGasLimitErr added in v0.7.10

func IsGasLimitErr(err error) bool

Types

type Account added in v0.7.10

type Account struct {
	Balance  string            `json:"balance"`
	Nonce    uint64            `json:"nonce"`
	Root     string            `json:"root"`
	CodeHash string            `json:"codeHash"`
	Storage  map[string]string `json:"storage"`
}

type Code added in v0.7.10

type Code []byte

func (Code) String added in v0.7.10

func (self Code) String() string

type GasLimitErr added in v0.7.10

type GasLimitErr struct {
	Message string
	Is, Max *big.Int
}

func GasLimitError added in v0.7.10

func GasLimitError(is, max *big.Int) *GasLimitErr

func (*GasLimitErr) Error added in v0.7.10

func (err *GasLimitErr) Error() string

type Log added in v0.7.10

type Log interface {
	ethutil.RlpEncodable

	Address() []byte
	Topics() [][]byte
	Data() []byte
}

type Logs added in v0.7.10

type Logs []Log

func (Logs) RlpData added in v0.7.10

func (self Logs) RlpData() interface{}

func (Logs) String added in v0.7.10

func (self Logs) String() (ret string)

type Manifest added in v0.7.10

type Manifest struct {
	Messages Messages
}

Object manifest

The object manifest is used to keep changes to the state so we can keep track of the changes that occurred during a state transitioning phase.

func NewManifest added in v0.7.10

func NewManifest() *Manifest

func (*Manifest) AddMessage added in v0.7.10

func (self *Manifest) AddMessage(msg *Message) *Message

func (*Manifest) Reset added in v0.7.10

func (m *Manifest) Reset()

type Message added in v0.7.10

type Message struct {
	To, From  []byte
	Input     []byte
	Output    []byte
	Path      int
	Origin    []byte
	Timestamp int64
	Coinbase  []byte
	Block     []byte
	Number    *big.Int
	Value     *big.Int

	ChangedAddresses [][]byte
}

func (*Message) AddStorageChange added in v0.7.10

func (self *Message) AddStorageChange(addr []byte)

func (*Message) String added in v0.7.10

func (self *Message) String() string

type Messages added in v0.7.10

type Messages []*Message

type StateDB added in v0.7.10

type StateDB struct {
	// The trie for this structure
	Trie *trie.Trie
	// contains filtered or unexported fields
}

StateDBs within the ethereum protocol are used to store anything within the merkle trie. StateDBs take care of caching and storing nested states. It's the general query interface to retrieve: * Contracts * Accounts

func New added in v0.7.10

func New(trie *trie.Trie) *StateDB

Create a new state from a given trie

func (*StateDB) AddBalance added in v0.7.10

func (self *StateDB) AddBalance(addr []byte, amount *big.Int)

func (*StateDB) AddLog added in v0.7.10

func (self *StateDB) AddLog(log Log)

func (*StateDB) Cmp added in v0.7.10

func (s *StateDB) Cmp(other *StateDB) bool

func (*StateDB) Copy added in v0.7.10

func (self *StateDB) Copy() *StateDB

func (*StateDB) CreateOutputForDiff added in v0.7.10

func (self *StateDB) CreateOutputForDiff()

Debug stuff

func (*StateDB) Delete added in v0.7.10

func (self *StateDB) Delete(addr []byte) bool

func (*StateDB) DeleteStateObject added in v0.7.10

func (self *StateDB) DeleteStateObject(stateObject *StateObject)

Delete the given state object and delete it from the state trie

func (*StateDB) Dump added in v0.7.10

func (self *StateDB) Dump() []byte

func (*StateDB) Empty added in v0.7.10

func (self *StateDB) Empty()

func (*StateDB) EmptyLogs added in v0.7.10

func (self *StateDB) EmptyLogs()

func (*StateDB) GetAccount added in v0.7.10

func (self *StateDB) GetAccount(addr []byte) *StateObject

Deprecated

func (*StateDB) GetBalance added in v0.7.10

func (self *StateDB) GetBalance(addr []byte) *big.Int

Retrieve the balance from the given address or 0 if object not found

func (*StateDB) GetCode added in v0.7.10

func (self *StateDB) GetCode(addr []byte) []byte

func (*StateDB) GetNonce added in v0.7.10

func (self *StateDB) GetNonce(addr []byte) uint64

func (*StateDB) GetOrNewStateObject added in v0.7.10

func (self *StateDB) GetOrNewStateObject(addr []byte) *StateObject

Retrieve a state object or create a new state object if nil

func (*StateDB) GetState added in v0.7.10

func (self *StateDB) GetState(a, b []byte) []byte

func (*StateDB) GetStateObject added in v0.7.10

func (self *StateDB) GetStateObject(addr []byte) *StateObject

Retrieve a state object given my the address. Nil if not found

func (*StateDB) Logs added in v0.7.10

func (self *StateDB) Logs() Logs

func (*StateDB) Manifest added in v0.7.10

func (self *StateDB) Manifest() *Manifest

func (*StateDB) NewStateObject added in v0.7.10

func (self *StateDB) NewStateObject(addr []byte) *StateObject

Create a state object whether it exist in the trie or not

func (*StateDB) Refund added in v0.7.10

func (self *StateDB) Refund(addr []byte, gas *big.Int)

func (*StateDB) Refunds added in v0.7.10

func (self *StateDB) Refunds() map[string]*big.Int

func (*StateDB) Reset added in v0.7.10

func (s *StateDB) Reset()

Resets the trie and all siblings

func (*StateDB) Root added in v0.7.10

func (s *StateDB) Root() []byte

func (*StateDB) Set added in v0.7.10

func (self *StateDB) Set(state *StateDB)

func (*StateDB) SetCode added in v0.7.10

func (self *StateDB) SetCode(addr, code []byte)

func (*StateDB) SetNonce added in v0.7.10

func (self *StateDB) SetNonce(addr []byte, nonce uint64)

func (*StateDB) SetState added in v0.7.10

func (self *StateDB) SetState(addr, key []byte, value interface{})

func (*StateDB) SetStateObject added in v0.7.10

func (self *StateDB) SetStateObject(object *StateObject)

func (*StateDB) Sync added in v0.7.10

func (s *StateDB) Sync()

Syncs the trie and all siblings

func (*StateDB) Update added in v0.7.10

func (self *StateDB) Update(gasUsed *big.Int)

func (*StateDB) UpdateStateObject added in v0.7.10

func (self *StateDB) UpdateStateObject(stateObject *StateObject)

Update the given state object and apply it to state trie

type StateLog added in v0.7.10

type StateLog struct {
	// contains filtered or unexported fields
}

func NewLog added in v0.7.10

func NewLog(address []byte, topics [][]byte, data []byte) *StateLog

func NewLogFromValue added in v0.7.10

func NewLogFromValue(decoder *ethutil.Value) *StateLog

func (*StateLog) Address added in v0.7.10

func (self *StateLog) Address() []byte

func (*StateLog) Data added in v0.7.10

func (self *StateLog) Data() []byte

func (*StateLog) RlpData added in v0.7.10

func (self *StateLog) RlpData() interface{}

func (*StateLog) String added in v0.7.10

func (self *StateLog) String() string

func (*StateLog) Topics added in v0.7.10

func (self *StateLog) Topics() [][]byte

type StateObject added in v0.7.10

type StateObject struct {
	Nonce uint64
	// Contract related attributes
	State    *StateDB
	Code     Code
	InitCode Code
	// contains filtered or unexported fields
}

func NewContract added in v0.7.10

func NewContract(address []byte, balance *big.Int, root []byte) *StateObject

func NewStateObject added in v0.7.10

func NewStateObject(addr []byte) *StateObject

func NewStateObjectFromBytes added in v0.7.10

func NewStateObjectFromBytes(address, data []byte) *StateObject

func (*StateObject) AddAmount added in v0.7.10

func (c *StateObject) AddAmount(amount *big.Int)

func (*StateObject) AddBalance added in v0.7.10

func (c *StateObject) AddBalance(amount *big.Int)

func (*StateObject) Address added in v0.7.10

func (c *StateObject) Address() []byte

Returns the address of the contract/account

func (*StateObject) Balance added in v0.7.10

func (self *StateObject) Balance() *big.Int

func (*StateObject) BuyGas added in v0.7.10

func (self *StateObject) BuyGas(gas, price *big.Int) error

func (*StateObject) CodeHash added in v0.7.10

func (c *StateObject) CodeHash() ethutil.Bytes

func (*StateObject) ConvertGas added in v0.7.10

func (c *StateObject) ConvertGas(gas, price *big.Int) error

func (*StateObject) Copy added in v0.7.10

func (self *StateObject) Copy() *StateObject

func (*StateObject) CreateOutputForDiff added in v0.7.10

func (self *StateObject) CreateOutputForDiff()

Debug stuff

func (*StateObject) EachStorage added in v0.7.10

func (self *StateObject) EachStorage(cb trie.EachCallback)

Iterate over each storage address and yield callback

func (*StateObject) GetAddr added in v0.7.10

func (c *StateObject) GetAddr(addr []byte) *ethutil.Value

func (*StateObject) GetInstr added in v0.7.10

func (c *StateObject) GetInstr(pc *big.Int) *ethutil.Value

func (*StateObject) GetState added in v0.7.10

func (self *StateObject) GetState(k []byte) *ethutil.Value

func (*StateObject) GetStorage added in v0.7.10

func (self *StateObject) GetStorage(key *big.Int) *ethutil.Value

func (*StateObject) Init added in v0.7.10

func (c *StateObject) Init() Code

Returns the initialization Code

func (*StateObject) MarkForDeletion added in v0.7.10

func (self *StateObject) MarkForDeletion()

func (*StateObject) N added in v0.7.10

func (c *StateObject) N() *big.Int

func (*StateObject) RefundGas added in v0.7.10

func (self *StateObject) RefundGas(gas, price *big.Int)

func (*StateObject) Reset added in v0.7.10

func (self *StateObject) Reset()

func (*StateObject) ReturnGas added in v0.7.10

func (c *StateObject) ReturnGas(gas, price *big.Int)

Return the gas back to the origin. Used by the Virtual machine or Closures

func (*StateObject) RlpDecode added in v0.7.10

func (c *StateObject) RlpDecode(data []byte)

func (*StateObject) RlpEncode added in v0.7.10

func (c *StateObject) RlpEncode() []byte

State object encoding methods

func (*StateObject) Root added in v0.7.10

func (self *StateObject) Root() []byte

func (*StateObject) Set added in v0.7.10

func (self *StateObject) Set(stateObject *StateObject)

func (*StateObject) SetAddr added in v0.7.10

func (c *StateObject) SetAddr(addr []byte, value interface{})

func (*StateObject) SetBalance added in v0.7.10

func (c *StateObject) SetBalance(amount *big.Int)

func (*StateObject) SetCode added in v0.7.10

func (self *StateObject) SetCode(code []byte)

func (*StateObject) SetGasPool added in v0.7.10

func (self *StateObject) SetGasPool(gasLimit *big.Int)

func (*StateObject) SetState added in v0.7.10

func (self *StateObject) SetState(k []byte, value *ethutil.Value)

func (*StateObject) SetStorage added in v0.7.10

func (self *StateObject) SetStorage(key *big.Int, value *ethutil.Value)

func (*StateObject) Storage added in v0.7.10

func (self *StateObject) Storage() map[string]*ethutil.Value

func (*StateObject) SubAmount added in v0.7.10

func (c *StateObject) SubAmount(amount *big.Int)

func (*StateObject) SubBalance added in v0.7.10

func (c *StateObject) SubBalance(amount *big.Int)

func (*StateObject) Sync added in v0.7.10

func (self *StateObject) Sync()

type Storage added in v0.7.10

type Storage map[string]*ethutil.Value

func (Storage) Copy added in v0.7.10

func (self Storage) Copy() Storage

type StorageState added in v0.7.10

type StorageState struct {
	StateAddress []byte
	Address      []byte
	Value        *big.Int
}

Storage change object. Used by the manifest for notifying changes to the sub channels.

type World added in v0.7.10

type World struct {
	Root     string             `json:"root"`
	Accounts map[string]Account `json:"accounts"`
}

Jump to

Keyboard shortcuts

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