Documentation ¶
Index ¶
- Constants
- Variables
- type VMAccountsDB
- func (vadb *VMAccountsDB) AccountExists(address []byte) (bool, error)
- func (vadb *VMAccountsDB) AddTempAccount(address []byte, balance *big.Int, nonce uint64)
- func (vadb *VMAccountsDB) CleanTempAccounts()
- func (vadb *VMAccountsDB) GetBalance(address []byte) (*big.Int, error)
- func (vadb *VMAccountsDB) GetBlockhash(offset *big.Int) ([]byte, error)
- func (vadb *VMAccountsDB) GetCode(address []byte) ([]byte, error)
- func (vadb *VMAccountsDB) GetNonce(address []byte) (uint64, error)
- func (vadb *VMAccountsDB) GetStorageData(accountAddress []byte, index []byte) ([]byte, error)
- func (vadb *VMAccountsDB) IsCodeEmpty(address []byte) (bool, error)
- func (vadb *VMAccountsDB) IsInterfaceNil() bool
- func (vadb *VMAccountsDB) NewAddress(creatorAddress []byte, creatorNonce uint64, vmType []byte) ([]byte, error)
- func (vadb *VMAccountsDB) TempAccount(address []byte) state.AccountHandler
- type VMCryptoHook
- func (vmch *VMCryptoHook) Bn128add(p1 vmcommon.Bn128Point, p2 vmcommon.Bn128Point) (vmcommon.Bn128Point, error)
- func (vmch *VMCryptoHook) Bn128ate(l1 []vmcommon.Bn128Point, l2 []vmcommon.Bn128G2Point) (bool, error)
- func (vmch *VMCryptoHook) Bn128g2valid(p vmcommon.Bn128G2Point) (bool, error)
- func (vmch *VMCryptoHook) Bn128mul(k *big.Int, p vmcommon.Bn128Point) (vmcommon.Bn128Point, error)
- func (vmch *VMCryptoHook) Bn128valid(p vmcommon.Bn128Point) (bool, error)
- func (vmch *VMCryptoHook) EcdsaRecover(hash string, v *big.Int, r string, s string) (string, error)
- func (vmch *VMCryptoHook) Keccak256(str string) (string, error)
- func (vmch *VMCryptoHook) Ripemd160(str string) (string, error)
- func (vmch *VMCryptoHook) Sha256(str string) (string, error)
Constants ¶
const NumInitCharactersForScAddress = 10
NumInitCharactersForScAddress numbers of characters for smart contract address identifier
const ShardIdentiferLen = 2
ShardIdentiferLen number of characters for shard identifier in an address
const VMTypeLen = 2
VMTypeLen number of characters with VMType identifier in an address, these are the last 2 characters from the initial identifier
Variables ¶
var ErrAddressIsInUnknownShard = errors.New("address is in unknown shard")
ErrAddressIsInUnknownShard signals that an addresses computed shard id is unknown
var ErrAddressLengthNotCorrect = errors.New("address length is not correct")
ErrAddressLengthNotCorrect signals that an account does not have the correct address
var ErrEmptyCode = errors.New("empty code in provided smart contract holding account")
ErrEmptyCode signals that an account does not contain code
var ErrNotImplemented = errors.New("not implemented")
ErrNotImplemented signals that a functionality can not be used as it is not implemented
var ErrVMTypeLengthIsNotCorrect = errors.New("vm type length is not correct")
ErrVMTypeLengthIsNotCorrect signals that the vm type length is not correct
Functions ¶
This section is empty.
Types ¶
type VMAccountsDB ¶ added in v1.0.3
type VMAccountsDB struct {
// contains filtered or unexported fields
}
VMAccountsDB is a wrapper over AccountsAdapter that satisfy vmcommon.BlockchainHook interface
func NewVMAccountsDB ¶ added in v1.0.3
func NewVMAccountsDB( accounts state.AccountsAdapter, addrConv state.AddressConverter, ) (*VMAccountsDB, error)
NewVMAccountsDB creates a new VMAccountsDB instance
func (*VMAccountsDB) AccountExists ¶ added in v1.0.3
func (vadb *VMAccountsDB) AccountExists(address []byte) (bool, error)
AccountExists checks if an account exists in provided AccountAdapter
func (*VMAccountsDB) AddTempAccount ¶ added in v1.0.3
func (vadb *VMAccountsDB) AddTempAccount(address []byte, balance *big.Int, nonce uint64)
AddTempAccount will add a temporary account in temporary store
func (*VMAccountsDB) CleanTempAccounts ¶ added in v1.0.3
func (vadb *VMAccountsDB) CleanTempAccounts()
CleanTempAccounts cleans the map holding the temporary accounts
func (*VMAccountsDB) GetBalance ¶ added in v1.0.3
func (vadb *VMAccountsDB) GetBalance(address []byte) (*big.Int, error)
GetBalance returns the balance of a shard account
func (*VMAccountsDB) GetBlockhash ¶ added in v1.0.3
func (vadb *VMAccountsDB) GetBlockhash(offset *big.Int) ([]byte, error)
GetBlockhash is deprecated
func (*VMAccountsDB) GetCode ¶ added in v1.0.3
func (vadb *VMAccountsDB) GetCode(address []byte) ([]byte, error)
GetCode retrieves the account's code
func (*VMAccountsDB) GetNonce ¶ added in v1.0.3
func (vadb *VMAccountsDB) GetNonce(address []byte) (uint64, error)
GetNonce returns the nonce of a shard account
func (*VMAccountsDB) GetStorageData ¶ added in v1.0.3
func (vadb *VMAccountsDB) GetStorageData(accountAddress []byte, index []byte) ([]byte, error)
GetStorageData returns the storage value of a variable held in account's data trie
func (*VMAccountsDB) IsCodeEmpty ¶ added in v1.0.3
func (vadb *VMAccountsDB) IsCodeEmpty(address []byte) (bool, error)
IsCodeEmpty returns if the code is empty
func (*VMAccountsDB) IsInterfaceNil ¶ added in v1.0.16
func (vadb *VMAccountsDB) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*VMAccountsDB) NewAddress ¶ added in v1.0.16
func (vadb *VMAccountsDB) NewAddress(creatorAddress []byte, creatorNonce uint64, vmType []byte) ([]byte, error)
NewAddress is a hook which creates a new smart contract address from the creators address and nonce The address is created by applied keccak256 on the appended value off creator address and nonce Prefix mask is applied for first 8 bytes 0, and for bytes 9-10 - VM type Suffix mask is applied - last 2 bytes are for the shard ID - mask is applied as suffix mask
func (*VMAccountsDB) TempAccount ¶ added in v1.0.3
func (vadb *VMAccountsDB) TempAccount(address []byte) state.AccountHandler
TempAccount can retrieve a temporary account from provided address
type VMCryptoHook ¶
type VMCryptoHook struct { }
VMCryptoHook is a wrapper used in vm implementation
func NewVMCryptoHook ¶
func NewVMCryptoHook() *VMCryptoHook
NewVMCryptoHook creates a new instance of a vm crypto hook
func (*VMCryptoHook) Bn128add ¶ added in v1.0.3
func (vmch *VMCryptoHook) Bn128add(p1 vmcommon.Bn128Point, p2 vmcommon.Bn128Point) (vmcommon.Bn128Point, error)
Bn128add is deprecated and should be removed as soon as the vmcommon interface has been updated TODO remove this when the vmcommon interface has been updated
func (*VMCryptoHook) Bn128ate ¶ added in v1.0.3
func (vmch *VMCryptoHook) Bn128ate(l1 []vmcommon.Bn128Point, l2 []vmcommon.Bn128G2Point) (bool, error)
Bn128ate is deprecated and should be removed as soon as the vmcommon interface has been updated TODO remove this when the vmcommon interface has been updated
func (*VMCryptoHook) Bn128g2valid ¶ added in v1.0.3
func (vmch *VMCryptoHook) Bn128g2valid(p vmcommon.Bn128G2Point) (bool, error)
Bn128g2valid is deprecated and should be removed as soon as the vmcommon interface has been updated TODO remove this when the vmcommon interface has been updated
func (*VMCryptoHook) Bn128mul ¶ added in v1.0.3
func (vmch *VMCryptoHook) Bn128mul(k *big.Int, p vmcommon.Bn128Point) (vmcommon.Bn128Point, error)
Bn128mul is deprecated and should be removed as soon as the vmcommon interface has been updated TODO remove this when the vmcommon interface has been updated
func (*VMCryptoHook) Bn128valid ¶ added in v1.0.3
func (vmch *VMCryptoHook) Bn128valid(p vmcommon.Bn128Point) (bool, error)
Bn128valid is deprecated and should be removed as soon as the vmcommon interface has been updated TODO remove this when the vmcommon interface has been updated
func (*VMCryptoHook) EcdsaRecover ¶ added in v1.0.3
EcdsaRecover is deprecated and should be removed as soon as the vmcommon interface has been updated TODO remove this when the vmcommon interface has been updated
func (*VMCryptoHook) Keccak256 ¶
func (vmch *VMCryptoHook) Keccak256(str string) (string, error)
Keccak256 returns a keccak 256 hash of the input string. Should return in hex format.