Documentation ¶
Index ¶
- Constants
- func GetChainIDFromBlockChainDBState(kv kv.KVStore) uint16
- func GetNonce(s kv.KVStoreReader, addr common.Address) uint64
- func Init(store kv.KVStore, chainID uint16, gasLimits GasLimits, timestamp uint64, ...)
- func NewBlockchainDBSubrealm(store kv.KVStore) kv.KVStore
- type BlockchainDB
- func (bc *BlockchainDB) AddTransaction(tx *types.Transaction, receipt *types.Receipt)
- func (bc *BlockchainDB) GetBlockByHash(hash common.Hash) *types.Block
- func (bc *BlockchainDB) GetBlockByNumber(blockNumber uint64) *types.Block
- func (bc *BlockchainDB) GetBlockHashByBlockNumber(blockNumber uint64) common.Hash
- func (bc *BlockchainDB) GetBlockNumberByBlockHash(hash common.Hash) (uint64, bool)
- func (bc *BlockchainDB) GetBlockNumberByTxHash(txHash common.Hash) (uint64, bool)
- func (bc *BlockchainDB) GetChainID() uint16
- func (bc *BlockchainDB) GetCurrentBlock() *types.Block
- func (bc *BlockchainDB) GetHeaderByBlockNumber(blockNumber uint64) *types.Header
- func (bc *BlockchainDB) GetHeaderByHash(hash common.Hash) *types.Header
- func (bc *BlockchainDB) GetLatestPendingReceipt() *types.Receipt
- func (bc *BlockchainDB) GetNumber() uint64
- func (bc *BlockchainDB) GetPendingBlockNumber() uint64
- func (bc *BlockchainDB) GetPendingHeader(timestamp uint64) *types.Header
- func (bc *BlockchainDB) GetReceiptByBlockNumberAndIndex(blockNumber uint64, txIndex uint32) *types.Receipt
- func (bc *BlockchainDB) GetReceiptByTxHash(txHash common.Hash) *types.Receipt
- func (bc *BlockchainDB) GetReceiptsByBlockNumber(blockNumber uint64) []*types.Receipt
- func (bc *BlockchainDB) GetTimestampByBlockNumber(blockNumber uint64) uint64
- func (bc *BlockchainDB) GetTransactionByBlockNumberAndIndex(blockNumber uint64, i uint32) *types.Transaction
- func (bc *BlockchainDB) GetTransactionByHash(txHash common.Hash) (tx *types.Transaction, blockHash common.Hash, blockNumber, index uint64, ...)
- func (bc *BlockchainDB) GetTransactionsByBlockNumber(blockNumber uint64) []*types.Transaction
- func (bc *BlockchainDB) GetTxIndexInBlockByTxHash(txHash common.Hash) uint32
- func (bc *BlockchainDB) Init(chainID uint16, timestamp uint64)
- func (bc *BlockchainDB) Initialized() bool
- func (bc *BlockchainDB) MintBlock(timestamp uint64)
- func (bc *BlockchainDB) SetChainID(chainID uint16)
- type BufferedStateDB
- type EVMEmulator
- func (e *EVMEmulator) BlockGasLimit() uint64
- func (e *EVMEmulator) BlockchainDB() *BlockchainDB
- func (e *EVMEmulator) CallContract(call ethereum.CallMsg, gasBurnEnable func(bool)) (*core.ExecutionResult, error)
- func (e *EVMEmulator) CallGasLimit() uint64
- func (e *EVMEmulator) ChainContext() core.ChainContext
- func (e *EVMEmulator) MintBlock()
- func (e *EVMEmulator) SendTransaction(tx *types.Transaction, gasBurnEnable func(bool), ...) (receipt *types.Receipt, result *core.ExecutionResult, iscGasErr error, ...)
- func (e *EVMEmulator) Signer() types.Signer
- func (e *EVMEmulator) StateDB() *StateDB
- type GasLimits
- type L2Balance
- type StateDB
- func (s *StateDB) AddAddressToAccessList(addr common.Address)
- func (s *StateDB) AddBalance(addr common.Address, amount *big.Int)
- func (s *StateDB) AddLog(log *types.Log)
- func (s *StateDB) AddPreimage(common.Hash, []byte)
- func (s *StateDB) AddRefund(n uint64)
- func (s *StateDB) AddSlotToAccessList(addr common.Address, slot common.Hash)
- func (s *StateDB) AddressInAccessList(addr common.Address) bool
- func (s *StateDB) Buffered() *BufferedStateDB
- func (s *StateDB) CreateAccount(addr common.Address)
- func (s *StateDB) Empty(addr common.Address) bool
- func (s *StateDB) Exist(addr common.Address) bool
- func (s *StateDB) ForEachStorage(common.Address, func(common.Hash, common.Hash) bool) error
- func (s *StateDB) GetBalance(addr common.Address) *big.Int
- func (s *StateDB) GetCode(addr common.Address) []byte
- func (s *StateDB) GetCodeHash(addr common.Address) common.Hash
- func (s *StateDB) GetCodeSize(addr common.Address) int
- func (s *StateDB) GetCommittedState(addr common.Address, key common.Hash) common.Hash
- func (s *StateDB) GetLogs(_ common.Hash) []*types.Log
- func (s *StateDB) GetNonce(addr common.Address) uint64
- func (s *StateDB) GetRefund() uint64
- func (s *StateDB) GetState(addr common.Address, key common.Hash) common.Hash
- func (*StateDB) GetTransientState(addr common.Address, key common.Hash) common.Hash
- func (s *StateDB) HasSuicided(addr common.Address) bool
- func (s *StateDB) Prepare(rules params.Rules, sender common.Address, coinbase common.Address, ...)
- func (s *StateDB) PrepareAccessList(sender common.Address, dest *common.Address, precompiles []common.Address, ...)
- func (s *StateDB) RevertToSnapshot(int)
- func (s *StateDB) SetCode(addr common.Address, code []byte)
- func (s *StateDB) SetNonce(addr common.Address, n uint64)
- func (s *StateDB) SetState(addr common.Address, key, value common.Hash)
- func (*StateDB) SetTransientState(addr common.Address, key common.Hash, value common.Hash)
- func (s *StateDB) SlotInAccessList(addr common.Address, slot common.Hash) (addressOk, slotOk bool)
- func (s *StateDB) Snapshot() int
- func (s *StateDB) SubBalance(addr common.Address, amount *big.Int)
- func (s *StateDB) SubRefund(n uint64)
- func (s *StateDB) Suicide(addr common.Address) bool
Constants ¶
const ( KeyStateDB = "s" KeyBlockchainDB = "b" )
const (
BlockKeepAll = -1
)
Variables ¶
This section is empty.
Functions ¶
func GetChainIDFromBlockChainDBState ¶ added in v1.0.3
Types ¶
type BlockchainDB ¶
type BlockchainDB struct {
// contains filtered or unexported fields
}
BlockchainDB contains logic for storing a fake blockchain (more like a list of blocks), intended for satisfying EVM tools that depend on the concept of a block.
func NewBlockchainDB ¶
func NewBlockchainDB(store kv.KVStore, blockGasLimit uint64, blockKeepAmount int32) *BlockchainDB
func (*BlockchainDB) AddTransaction ¶
func (bc *BlockchainDB) AddTransaction(tx *types.Transaction, receipt *types.Receipt)
func (*BlockchainDB) GetBlockByHash ¶
func (bc *BlockchainDB) GetBlockByHash(hash common.Hash) *types.Block
func (*BlockchainDB) GetBlockByNumber ¶
func (bc *BlockchainDB) GetBlockByNumber(blockNumber uint64) *types.Block
func (*BlockchainDB) GetBlockHashByBlockNumber ¶
func (bc *BlockchainDB) GetBlockHashByBlockNumber(blockNumber uint64) common.Hash
func (*BlockchainDB) GetBlockNumberByBlockHash ¶
func (bc *BlockchainDB) GetBlockNumberByBlockHash(hash common.Hash) (uint64, bool)
func (*BlockchainDB) GetBlockNumberByTxHash ¶
func (bc *BlockchainDB) GetBlockNumberByTxHash(txHash common.Hash) (uint64, bool)
func (*BlockchainDB) GetChainID ¶
func (bc *BlockchainDB) GetChainID() uint16
func (*BlockchainDB) GetCurrentBlock ¶
func (bc *BlockchainDB) GetCurrentBlock() *types.Block
func (*BlockchainDB) GetHeaderByBlockNumber ¶
func (bc *BlockchainDB) GetHeaderByBlockNumber(blockNumber uint64) *types.Header
func (*BlockchainDB) GetHeaderByHash ¶
func (bc *BlockchainDB) GetHeaderByHash(hash common.Hash) *types.Header
func (*BlockchainDB) GetLatestPendingReceipt ¶
func (bc *BlockchainDB) GetLatestPendingReceipt() *types.Receipt
func (*BlockchainDB) GetNumber ¶
func (bc *BlockchainDB) GetNumber() uint64
func (*BlockchainDB) GetPendingBlockNumber ¶
func (bc *BlockchainDB) GetPendingBlockNumber() uint64
func (*BlockchainDB) GetPendingHeader ¶
func (bc *BlockchainDB) GetPendingHeader(timestamp uint64) *types.Header
func (*BlockchainDB) GetReceiptByBlockNumberAndIndex ¶
func (bc *BlockchainDB) GetReceiptByBlockNumberAndIndex(blockNumber uint64, txIndex uint32) *types.Receipt
func (*BlockchainDB) GetReceiptByTxHash ¶
func (bc *BlockchainDB) GetReceiptByTxHash(txHash common.Hash) *types.Receipt
func (*BlockchainDB) GetReceiptsByBlockNumber ¶
func (bc *BlockchainDB) GetReceiptsByBlockNumber(blockNumber uint64) []*types.Receipt
func (*BlockchainDB) GetTimestampByBlockNumber ¶
func (bc *BlockchainDB) GetTimestampByBlockNumber(blockNumber uint64) uint64
func (*BlockchainDB) GetTransactionByBlockNumberAndIndex ¶
func (bc *BlockchainDB) GetTransactionByBlockNumberAndIndex(blockNumber uint64, i uint32) *types.Transaction
func (*BlockchainDB) GetTransactionByHash ¶
func (bc *BlockchainDB) GetTransactionByHash(txHash common.Hash) (tx *types.Transaction, blockHash common.Hash, blockNumber, index uint64, err error)
func (*BlockchainDB) GetTransactionsByBlockNumber ¶
func (bc *BlockchainDB) GetTransactionsByBlockNumber(blockNumber uint64) []*types.Transaction
func (*BlockchainDB) GetTxIndexInBlockByTxHash ¶ added in v1.0.3
func (bc *BlockchainDB) GetTxIndexInBlockByTxHash(txHash common.Hash) uint32
func (*BlockchainDB) Init ¶
func (bc *BlockchainDB) Init(chainID uint16, timestamp uint64)
func (*BlockchainDB) Initialized ¶
func (bc *BlockchainDB) Initialized() bool
func (*BlockchainDB) MintBlock ¶
func (bc *BlockchainDB) MintBlock(timestamp uint64)
func (*BlockchainDB) SetChainID ¶
func (bc *BlockchainDB) SetChainID(chainID uint16)
type BufferedStateDB ¶
type BufferedStateDB struct {
// contains filtered or unexported fields
}
BufferedStateDB is a wrapper for StateDB that writes all mutations into an in-memory buffer, leaving the original state unmodified until the mutations are applied manually with Commit().
func NewBufferedStateDB ¶
func NewBufferedStateDB(base *StateDB) *BufferedStateDB
func (*BufferedStateDB) Commit ¶
func (b *BufferedStateDB) Commit()
func (*BufferedStateDB) StateDB ¶
func (b *BufferedStateDB) StateDB() *StateDB
type EVMEmulator ¶
type EVMEmulator struct {
// contains filtered or unexported fields
}
func NewEVMEmulator ¶
func (*EVMEmulator) BlockGasLimit ¶ added in v1.0.3
func (e *EVMEmulator) BlockGasLimit() uint64
func (*EVMEmulator) BlockchainDB ¶
func (e *EVMEmulator) BlockchainDB() *BlockchainDB
func (*EVMEmulator) CallContract ¶
func (e *EVMEmulator) CallContract(call ethereum.CallMsg, gasBurnEnable func(bool)) (*core.ExecutionResult, error)
CallContract executes a contract call, without committing changes to the state
func (*EVMEmulator) CallGasLimit ¶ added in v1.0.3
func (e *EVMEmulator) CallGasLimit() uint64
func (*EVMEmulator) ChainContext ¶
func (e *EVMEmulator) ChainContext() core.ChainContext
func (*EVMEmulator) MintBlock ¶
func (e *EVMEmulator) MintBlock()
func (*EVMEmulator) SendTransaction ¶
func (e *EVMEmulator) SendTransaction( tx *types.Transaction, gasBurnEnable func(bool), chargeISCGas func(*core.ExecutionResult) (uint64, error), tracer tracers.Tracer, ) (receipt *types.Receipt, result *core.ExecutionResult, iscGasErr error, err error)
func (*EVMEmulator) Signer ¶
func (e *EVMEmulator) Signer() types.Signer
func (*EVMEmulator) StateDB ¶
func (e *EVMEmulator) StateDB() *StateDB
type StateDB ¶
type StateDB struct {
// contains filtered or unexported fields
}
StateDB implements vm.StateDB with a kv.KVStore as backend. The Ethereum account balance is tied to the L1 balance.
func (*StateDB) AddAddressToAccessList ¶
AddAddressToAccessList adds the given address to the access list. This operation is safe to perform even if the feature/fork is not active yet
func (*StateDB) AddSlotToAccessList ¶
AddSlotToAccessList adds the given (address,slot) to the access list. This operation is safe to perform even if the feature/fork is not active yet
func (*StateDB) AddressInAccessList ¶
func (*StateDB) Buffered ¶
func (s *StateDB) Buffered() *BufferedStateDB
func (*StateDB) CreateAccount ¶
func (*StateDB) Empty ¶
Empty returns whether the given account is empty. Empty is defined according to EIP161 (balance = nonce = code = 0).
func (*StateDB) Exist ¶
Exist reports whether the given account exists in state. Notably this should also return true for suicided accounts.
func (*StateDB) ForEachStorage ¶
func (*StateDB) GetCommittedState ¶
func (*StateDB) GetTransientState ¶ added in v1.0.3
GetTransientState implements vm.StateDB
func (*StateDB) Prepare ¶ added in v1.0.3
func (s *StateDB) Prepare(rules params.Rules, sender common.Address, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses types.AccessList)
Prepare implements vm.StateDB
func (*StateDB) PrepareAccessList ¶
func (*StateDB) RevertToSnapshot ¶
func (*StateDB) SetTransientState ¶ added in v1.0.3
SetTransientState implements vm.StateDB