Documentation ¶
Index ¶
- Constants
- func HasPermission(accountGetter state.AccountGetter, acc acm.Account, perm ptypes.PermFlag, ...) bool
- func NameRegDecode(r io.Reader, n *int, err *error) interface{}
- func NameRegEncode(o interface{}, w io.Writer, n *int, err *error)
- func VMOptions(vmOptions ...func(*evm.VM)) func(*executor)
- type Accounts
- func (accs *Accounts) SequentialSigningAccount(address acm.Address) *SequentialSigningAccount
- func (accs *Accounts) SequentialSigningAccountFromPrivateKey(privateKeyBytes []byte) (*SequentialSigningAccount, error)
- func (accs *Accounts) SigningAccount(address acm.Address, signer acm.Signer) (*SigningAccount, error)
- type BatchCommitter
- type BatchExecutor
- type Call
- type ExecutionConfig
- type ExecutionOption
- type InvalidTxError
- type NameRegCache
- func (cache *NameRegCache) Backend() NameRegGetter
- func (cache *NameRegCache) Flush(state NameRegWriter) error
- func (cache *NameRegCache) GetNameRegEntry(name string) (*NameRegEntry, error)
- func (cache *NameRegCache) RemoveNameRegEntry(name string) error
- func (cache *NameRegCache) Reset(backend NameRegGetter)
- func (cache *NameRegCache) Sync(state NameRegWriter) error
- func (cache *NameRegCache) UpdateNameRegEntry(entry *NameRegEntry) error
- type NameRegEntry
- type NameRegGetter
- type NameRegIterable
- type NameRegUpdater
- type NameRegWriter
- type SequentialSigningAccount
- type SigningAccount
- type State
- func (s *State) Copy(db dbm.DB) *State
- func (s *State) GetAccount(address acm.Address) (acm.Account, error)
- func (s *State) GetNameRegEntry(name string) (*NameRegEntry, error)
- func (s *State) GetStorage(address acm.Address, key binary.Word256) (binary.Word256, error)
- func (s *State) Hash() []byte
- func (s *State) IterateAccounts(consumer func(acm.Account) (stop bool)) (stopped bool, err error)
- func (s *State) IterateNameRegEntries(consumer func(*NameRegEntry) (stop bool)) (stopped bool, err error)
- func (s *State) IterateStorage(address acm.Address, consumer func(key, value binary.Word256) (stop bool)) (stopped bool, err error)
- func (s *State) RemoveAccount(address acm.Address) error
- func (s *State) RemoveNameRegEntry(name string) error
- func (s *State) Save() error
- func (s *State) SetStorage(address acm.Address, key, value binary.Word256) error
- func (s *State) UpdateAccount(account acm.Account) error
- func (s *State) UpdateNameRegEntry(entry *NameRegEntry) error
- type Transactor
- func (trans *Transactor) BroadcastTx(tx txs.Tx) (*txs.Receipt, error)
- func (trans *Transactor) BroadcastTxAsync(tx txs.Tx, callback func(res *abci_types.Response)) error
- func (trans *Transactor) Call(reader state.Reader, fromAddress, toAddress acm.Address, data []byte) (call *Call, err error)
- func (trans *Transactor) CallCode(reader state.Reader, fromAddress acm.Address, code, data []byte) (*Call, error)
- func (trans *Transactor) Send(sequentialSigningAccount *SequentialSigningAccount, toAddress acm.Address, ...) (*txs.Receipt, error)
- func (trans *Transactor) SendAndHold(sequentialSigningAccount *SequentialSigningAccount, toAddress acm.Address, ...) (*txs.Receipt, error)
- func (trans *Transactor) SignTx(tx txs.Tx, signingAccounts []acm.AddressableSigner) (txs.Tx, error)
- func (trans *Transactor) Transact(sequentialSigningAccount *SequentialSigningAccount, address *acm.Address, ...) (*txs.Receipt, error)
- func (trans *Transactor) TransactAndHold(sequentialSigningAccount *SequentialSigningAccount, address *acm.Address, ...) (*evm_events.EventDataCall, error)
- func (trans *Transactor) TransactNameReg(sequentialSigningAccount *SequentialSigningAccount, name, data string, ...) (*txs.Receipt, error)
- type UnlockFunc
- type VMOption
Constants ¶
const BlockingTimeoutSeconds = 30
const GasLimit = uint64(1000000)
TODO: make configurable
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Accounts ¶
type Accounts struct { burrow_sync.RingMutex state.Reader // contains filtered or unexported fields }
Accounts pairs an underlying state.Reader with a KeyClient to provide a signing variant of an account it also maintains a lock over addresses to provide a linearisation of signing events using SequentialSigningAccount
func NewAccounts ¶
func (*Accounts) SequentialSigningAccount ¶
func (accs *Accounts) SequentialSigningAccount(address acm.Address) *SequentialSigningAccount
func (*Accounts) SequentialSigningAccountFromPrivateKey ¶
func (accs *Accounts) SequentialSigningAccountFromPrivateKey(privateKeyBytes []byte) (*SequentialSigningAccount, error)
func (*Accounts) SigningAccount ¶
type BatchCommitter ¶
type BatchCommitter interface { BatchExecutor // Commit execution results to underlying State and provide opportunity // to mutate state before it is saved Commit() (stateHash []byte, err error) }
Executes transactions
func NewBatchCommitter ¶
func NewBatchCommitter(backend *State, chainID string, tip bcm.Tip, publisher event.Publisher, logger *logging.Logger, options ...ExecutionOption) BatchCommitter
type BatchExecutor ¶
type BatchExecutor interface { // Provides access to write lock for a BatchExecutor so reads can be prevented for the duration of a commit sync.Locker state.Reader // Execute transaction against block cache (i.e. block buffer) Execute(tx txs.Tx) error // Reset executor to underlying State Reset() error }
func NewBatchChecker ¶
func NewBatchChecker(backend *State, chainID string, tip bcm.Tip, logger *logging.Logger, options ...ExecutionOption) BatchExecutor
Wraps a cache of what is variously known as the 'check cache' and 'mempool'
type ExecutionConfig ¶
type ExecutionConfig struct {
VMOptions []VMOption `json:",omitempty" toml:",omitempty"`
}
func DefaultExecutionConfig ¶
func DefaultExecutionConfig() *ExecutionConfig
func (*ExecutionConfig) ExecutionOptions ¶
func (ec *ExecutionConfig) ExecutionOptions() ([]ExecutionOption, error)
type ExecutionOption ¶
type ExecutionOption func(*executor)
type InvalidTxError ¶
func (InvalidTxError) Error ¶
func (txErr InvalidTxError) Error() string
type NameRegCache ¶
The NameRegCache helps prevent unnecessary IAVLTree updates and garbage generation.
func NewNameRegCache ¶
func NewNameRegCache(backend NameRegGetter) *NameRegCache
Returns a NameRegCache that wraps an underlying NameRegCacheGetter to use on a cache miss, can write to an output NameRegWriter via Sync. Not goroutine safe, use syncStateCache if you need concurrent access
func (*NameRegCache) Backend ¶
func (cache *NameRegCache) Backend() NameRegGetter
func (*NameRegCache) Flush ¶
func (cache *NameRegCache) Flush(state NameRegWriter) error
Syncs the NameRegCache and Resets it to use NameRegWriter as the backend NameRegGetter
func (*NameRegCache) GetNameRegEntry ¶
func (cache *NameRegCache) GetNameRegEntry(name string) (*NameRegEntry, error)
func (*NameRegCache) RemoveNameRegEntry ¶
func (cache *NameRegCache) RemoveNameRegEntry(name string) error
func (*NameRegCache) Reset ¶
func (cache *NameRegCache) Reset(backend NameRegGetter)
Resets the cache to empty initialising the backing map to the same size as the previous iteration.
func (*NameRegCache) Sync ¶
func (cache *NameRegCache) Sync(state NameRegWriter) error
Writes whatever is in the cache to the output NameRegWriter state. Does not flush the cache, to do that call Reset() after Sync or use Flusth if your wish to use the output state as your next backend
func (*NameRegCache) UpdateNameRegEntry ¶
func (cache *NameRegCache) UpdateNameRegEntry(entry *NameRegEntry) error
type NameRegEntry ¶
type NameRegEntry struct { // registered name for the entry Name string // address that created the entry Owner account.Address // data to store under this name Data string // block at which this entry expires Expires uint64 }
NameReg provides a global key value store based on Name, Data pairs that are subject to expiry and ownership by an account.
func DecodeNameRegEntry ¶
func DecodeNameRegEntry(entryBytes []byte) *NameRegEntry
type NameRegGetter ¶
type NameRegGetter interface {
GetNameRegEntry(name string) (*NameRegEntry, error)
}
type NameRegIterable ¶
type NameRegIterable interface { NameRegGetter IterateNameRegEntries(consumer func(*NameRegEntry) (stop bool)) (stopped bool, err error) }
type NameRegUpdater ¶
type NameRegUpdater interface { // Updates the name entry creating it if it does not exist UpdateNameRegEntry(entry *NameRegEntry) error // Remove the name entry RemoveNameRegEntry(name string) error }
type NameRegWriter ¶
type NameRegWriter interface { NameRegGetter NameRegUpdater }
type SequentialSigningAccount ¶
type SequentialSigningAccount struct {
// contains filtered or unexported fields
}
func (*SequentialSigningAccount) Lock ¶
func (ssa *SequentialSigningAccount) Lock() (*SigningAccount, UnlockFunc, error)
type State ¶
func LoadState ¶
Tries to load the execution state from DB, returns nil with no error if no state found
func MakeGenesisState ¶
Make genesis state from GenesisDoc and save to DB
func (*State) GetAccount ¶
Returns nil if account does not exist with given address.
func (*State) GetNameRegEntry ¶
func (s *State) GetNameRegEntry(name string) (*NameRegEntry, error)
func (*State) GetStorage ¶
func (*State) IterateAccounts ¶
func (*State) IterateNameRegEntries ¶
func (s *State) IterateNameRegEntries(consumer func(*NameRegEntry) (stop bool)) (stopped bool, err error)
func (*State) IterateStorage ¶
func (*State) RemoveNameRegEntry ¶
func (*State) SetStorage ¶
func (*State) UpdateNameRegEntry ¶
func (s *State) UpdateNameRegEntry(entry *NameRegEntry) error
type Transactor ¶
type Transactor struct {
// contains filtered or unexported fields
}
Transactor is the controller/middleware for the v0 RPC
func NewTransactor ¶
func NewTransactor(tip blockchain.Tip, eventEmitter event.Emitter, broadcastTxAsync func(tx txs.Tx, callback func(res *abci_types.Response)) error, logger *logging.Logger) *Transactor
func (*Transactor) BroadcastTx ¶
Broadcast a transaction and waits for a response from the mempool. Transactions to BroadcastTx will block during various mempool operations (managed by Tendermint) including mempool Reap, Commit, and recheckTx.
func (*Transactor) BroadcastTxAsync ¶
func (trans *Transactor) BroadcastTxAsync(tx txs.Tx, callback func(res *abci_types.Response)) error
func (*Transactor) Call ¶
func (trans *Transactor) Call(reader state.Reader, fromAddress, toAddress acm.Address, data []byte) (call *Call, err error)
Run a contract's code on an isolated and unpersisted state Cannot be used to create new contracts
func (*Transactor) CallCode ¶
func (trans *Transactor) CallCode(reader state.Reader, fromAddress acm.Address, code, data []byte) (*Call, error)
Run the given code on an isolated and unpersisted state Cannot be used to create new contracts.
func (*Transactor) Send ¶
func (trans *Transactor) Send(sequentialSigningAccount *SequentialSigningAccount, toAddress acm.Address, amount uint64) (*txs.Receipt, error)
func (*Transactor) SendAndHold ¶
func (trans *Transactor) SendAndHold(sequentialSigningAccount *SequentialSigningAccount, toAddress acm.Address, amount uint64) (*txs.Receipt, error)
func (*Transactor) SignTx ¶
func (trans *Transactor) SignTx(tx txs.Tx, signingAccounts []acm.AddressableSigner) (txs.Tx, error)
Sign a transaction
func (*Transactor) Transact ¶
func (trans *Transactor) Transact(sequentialSigningAccount *SequentialSigningAccount, address *acm.Address, data []byte, gasLimit, fee uint64) (*txs.Receipt, error)
Orders calls to BroadcastTx using lock (waits for response from core before releasing)
func (*Transactor) TransactAndHold ¶
func (trans *Transactor) TransactAndHold(sequentialSigningAccount *SequentialSigningAccount, address *acm.Address, data []byte, gasLimit, fee uint64) (*evm_events.EventDataCall, error)
func (*Transactor) TransactNameReg ¶
func (trans *Transactor) TransactNameReg(sequentialSigningAccount *SequentialSigningAccount, name, data string, amount, fee uint64) (*txs.Receipt, error)
type UnlockFunc ¶
type UnlockFunc func()