Documentation ¶
Index ¶
- Variables
- func DefaultEthNodeConfig(dataDir string) ethNode.Config
- func Init(cfg Config, ntw network.Network, trcCfg stdtracer.Config) error
- type Config
- type Database
- func (db *Database) APIs() []rpc.API
- func (db *Database) Config() *eth.Config
- func (db *Database) Ethereum() *eth.Ethereum
- func (db *Database) ExecuteTx(tx *ethTypes.Transaction) error
- func (db *Database) GasLimit() uint64
- func (db *Database) GetBlockStateHeader() ethTypes.Header
- func (db *Database) Persist(receiver common.Address) (ethTypes.Block, error)
- func (db *Database) Protocols() []p2p.Protocol
- func (db *Database) ResetBlockState(receiver common.Address) error
- func (db *Database) Start(_ *p2p.Server) error
- func (db *Database) Stop() error
- func (db *Database) UpdateBlockState(tmHeader tmtAbciTypes.Header)
- type EthDBTracer
- type EthState
- func (es *EthState) ExecuteTx(tx *ethTypes.Transaction) error
- func (es *EthState) GasLimit() *core.GasPool
- func (es *EthState) Pending() (*ethTypes.Block, *state.StateDB)
- func (es *EthState) Persist(receiver common.Address) (ethTypes.Block, error)
- func (es *EthState) ResetBlockState(receiver common.Address) error
- func (es *EthState) UpdateBlockState(config params.ChainConfig, blockTime uint64, numTx uint64)
- type GethConfig
- type Node
- type NullBlockValidator
- type Tracer
Constants ¶
This section is empty.
Variables ¶
var ( DataDirPath = "database" NodeName = "lightchain" // IMPORTANT: Following three values needs to correspond to the internal values used by go-ethereum KeystorePath = "keystore" ChainDbPath = "chaindata" // it needs to match to the value passed at go-ethereum/eth/backend.go:CreateDB() GenesisPath = "genesis.json" GethIpcFile = "geth.ipc" )
Functions ¶
func DefaultEthNodeConfig ¶
DefaultEthNodeConfig returns the default configuration for a go-ethereum ethereum
Types ¶
type Config ¶
type Config struct { DataDir string GethCfg GethConfig // contains filtered or unexported fields }
func (Config) ChainDbDir ¶ added in v0.10.0
func (Config) GethIpcPath ¶ added in v0.10.0
func (Config) KeystoreDir ¶ added in v0.12.0
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database handles the chain database and VM.
func NewDatabase ¶
func (*Database) APIs ¶
APIs returns the collection of Ethereum RPC services.
Overwrites go-ethereum/eth/backend.go::APIs().
Some of the API methods must be re-implemented to support Ethereum web3 features due to dependency on Tendermint, e.g Syncing().
func (*Database) ExecuteTx ¶ added in v0.10.0
func (db *Database) ExecuteTx(tx *ethTypes.Transaction) error
ExecuteTx appends a transaction to the current block.
func (*Database) GetBlockStateHeader ¶ added in v1.3.0
func (*Database) Persist ¶ added in v0.10.0
Persist finalises the current block and writes it to disk.
Returns the persisted Block.
func (*Database) ResetBlockState ¶ added in v0.10.0
ResetBlockState resets the in-memory block's processing state.
func (*Database) UpdateBlockState ¶ added in v0.10.0
func (db *Database) UpdateBlockState(tmHeader tmtAbciTypes.Header)
UpdateBlockState uses the tendermint header to update the eth header.
type EthDBTracer ¶ added in v0.12.0
func (EthDBTracer) AssertPersistedGenesisBlock ¶ added in v0.12.0
func (t EthDBTracer) AssertPersistedGenesisBlock(genesis core.Genesis)
func (EthDBTracer) AssertPostTxSimulationState ¶ added in v0.12.0
func (t EthDBTracer) AssertPostTxSimulationState(from common.Address, tx *types.Transaction)
type EthState ¶
type EthState struct {
// contains filtered or unexported fields
}
---------------------------------------------------------------------- EthState manages concurrent access to the intermediate blockState object The eth tx pool fires TxPreEvent in a go-routine, and the miner subscribes to this in another go-routine and processes the tx onto an intermediate ethState. We used to use `unsafe` to overwrite the miner, but this didn't work because it didn't affect the already launched go-routines. So instead we introduce the Pending API in a small persist in go-eth so we don't even start the miner there, and instead manage the intermediate ethState from here. In the same persist we also fire the TxPreEvent synchronously so the order is preserved, instead of using a go-routine.
TODO: Rewrite this description, it doesn't make sense and this "EthState" Struct is even more suspicious.
func NewEthState ¶
func (*EthState) ExecuteTx ¶ added in v0.10.0
func (es *EthState) ExecuteTx(tx *ethTypes.Transaction) error
Executes TX against the eth blockchain state.
The changes happen only inside of the Eth state, not disk!
func (*EthState) Pending ¶
Implements: miner.Pending API (our custom patch to go-eth).
Return a new block and a copy of the ethState from the latest blockState.
func (*EthState) Persist ¶ added in v0.10.0
Persist the application state to disk.
Persist is called after all TXs are executed against the application state. Triggered by ABCI::Commit(), to persist changes introduced in latest block.
Returns the persisted Block.
func (*EthState) ResetBlockState ¶ added in v0.10.0
func (*EthState) UpdateBlockState ¶ added in v0.10.0
func (es *EthState) UpdateBlockState(config params.ChainConfig, blockTime uint64, numTx uint64)
type GethConfig ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is the main object.
type NullBlockValidator ¶ added in v0.10.0
type NullBlockValidator struct{}
Dummy block validator ignoring PoW, uncles and so on.
func (NullBlockValidator) ValidateBody ¶ added in v0.10.0
func (NullBlockValidator) ValidateBody(*ethTypes.Block) error
ValidateBody does not validate anything.
type Tracer ¶ added in v0.12.0
type Tracer interface { // AssertPersistedGenesisBlock validates if the GenesisBlock was properly saved in disk. // // Verifies whenever it's possible to re-construct the eth state from disk and // asserts accounts balances, nonces, gas settings as defined in Genesis config. AssertPersistedGenesisBlock(genesis core.Genesis) // AssertPostTxSimulationState validates if the state saved in disk after TX simulation is correct. AssertPostTxSimulationState(from common.Address, tx *types.Transaction) }
Tracer is used to trace and assert behaviour of lightchain `database` pkg.