state

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2015 License: LGPL-2.1-or-later Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsGasLimitErr

func IsGasLimitErr(err error) bool

Types

type Account

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

type Code []byte

func (Code) String

func (self Code) String() string

type GasLimitErr

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

func GasLimitError

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

func (*GasLimitErr) Error

func (err *GasLimitErr) Error() string

type Log

type Log interface {
	ethutil.RlpEncodable

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

type Logs

type Logs []Log

func (Logs) RlpData

func (self Logs) RlpData() interface{}

func (Logs) String

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

type StateDB

type StateDB struct {
	// 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

func New(root []byte, db ethutil.Database) *StateDB

Create a new state from a given trie

func (*StateDB) AddBalance

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

func (*StateDB) AddLog

func (self *StateDB) AddLog(log Log)

func (*StateDB) Cmp

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

func (*StateDB) Copy

func (self *StateDB) Copy() *StateDB

func (*StateDB) CreateOutputForDiff

func (self *StateDB) CreateOutputForDiff()

Debug stuff

func (*StateDB) Delete

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

func (*StateDB) DeleteStateObject

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

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

func (*StateDB) Dump

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

func (*StateDB) Empty

func (self *StateDB) Empty()

func (*StateDB) EmptyLogs

func (self *StateDB) EmptyLogs()

func (*StateDB) GetAccount

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

Deprecated

func (*StateDB) GetBalance

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

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

func (*StateDB) GetCode

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

func (*StateDB) GetNonce

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

func (*StateDB) GetOrNewStateObject

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

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

func (*StateDB) GetState

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

func (*StateDB) GetStateObject

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

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

func (*StateDB) Logs

func (self *StateDB) Logs() Logs

func (*StateDB) NewStateObject

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

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

func (*StateDB) Refund

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

func (*StateDB) Refunds

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

func (*StateDB) Reset

func (s *StateDB) Reset()

Resets the trie and all siblings

func (*StateDB) Root

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

func (*StateDB) Set

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

func (*StateDB) SetCode

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

func (*StateDB) SetNonce

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

func (*StateDB) SetState

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

func (*StateDB) SetStateObject

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

func (*StateDB) Sync

func (s *StateDB) Sync()

Syncs the trie and all siblings

func (*StateDB) Update

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

func (*StateDB) UpdateStateObject

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

Update the given state object and apply it to state trie

type StateLog

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

func NewLog

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

func NewLogFromValue

func NewLogFromValue(decoder *ethutil.Value) *StateLog

func (*StateLog) Address

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

func (*StateLog) Data

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

func (*StateLog) RlpData

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

func (*StateLog) String

func (self *StateLog) String() string

func (*StateLog) Topics

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

type StateObject

type StateObject struct {

	// Contract related attributes
	State *StateDB
	// contains filtered or unexported fields
}

func NewStateObject

func NewStateObject(addr []byte, db ethutil.Database) *StateObject

func NewStateObjectFromBytes

func NewStateObjectFromBytes(address, data []byte, db ethutil.Database) *StateObject

func (*StateObject) AddAmount

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

func (*StateObject) AddBalance

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

func (*StateObject) Address

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

Returns the address of the contract/account

func (*StateObject) Balance

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

func (*StateObject) BuyGas

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

func (*StateObject) Code

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

func (*StateObject) CodeHash

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

func (*StateObject) ConvertGas

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

func (*StateObject) Copy

func (self *StateObject) Copy() *StateObject

func (*StateObject) CreateOutputForDiff

func (self *StateObject) CreateOutputForDiff()

Debug stuff

func (*StateObject) GetInstr

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

func (*StateObject) GetState

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

func (*StateObject) GetStorage

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

func (*StateObject) Init

func (c *StateObject) Init() Code

Returns the initialization Code

func (*StateObject) MarkForDeletion

func (self *StateObject) MarkForDeletion()

func (*StateObject) N

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

func (*StateObject) Nonce

func (self *StateObject) Nonce() uint64

func (*StateObject) RefundGas

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

func (*StateObject) Reset

func (self *StateObject) Reset()

func (*StateObject) ReturnGas

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

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

func (*StateObject) RlpEncode

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

State object encoding methods

func (*StateObject) Root

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

func (*StateObject) Set

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

func (*StateObject) SetBalance

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

func (*StateObject) SetCode

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

func (*StateObject) SetGasPool

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

func (*StateObject) SetInitCode added in v0.8.4

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

func (*StateObject) SetNonce added in v0.8.4

func (self *StateObject) SetNonce(nonce uint64)

func (*StateObject) SetState

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

func (*StateObject) SetStorage

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

func (*StateObject) Storage

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

func (*StateObject) SubAmount

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

func (*StateObject) SubBalance

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

func (*StateObject) Sync

func (self *StateObject) Sync()

func (*StateObject) Trie added in v0.8.4

func (self *StateObject) Trie() *trie.Trie

type Storage

type Storage map[string]*ethutil.Value

func (Storage) Copy

func (self Storage) Copy() Storage

type StorageState

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

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