Documentation ¶
Index ¶
- Variables
- func ConvertBigIntToUint256(b *big.Int) *uint256.Int
- func ConvertHashToYuHash(hash common.Hash) (yu_common.Hash, error)
- func LoadChainConfig(db ethdb.Database, genesis *Genesis) (*params.ChainConfig, error)
- func ObjToJson(obj interface{}) string
- func SetupGenesisBlock(ethState *EthState, genesis *Genesis) (*params.ChainConfig, common.Hash, error)
- func SetupGenesisBlockWithOverride(ethState *EthState, genesis *Genesis, overrides *ChainOverrides) (*params.ChainConfig, common.Hash, error)
- type AccountInfo
- type CallRequest
- type CallResponse
- type ChainOverrides
- type CreateRequest
- type EthState
- func (s *EthState) AddBalance(addr common.Address, amount *uint256.Int, reason tracing.BalanceChangeReason)
- func (s *EthState) Commit(blockNum uint64) (common.Hash, error)
- func (s *EthState) GenesisCommit() (common.Hash, error)
- func (s *EthState) GetNonce(addr common.Address) uint64
- func (s *EthState) Prepare(rules params.Rules, sender, coinbase common.Address, dst *common.Address, ...)
- func (s *EthState) SetNonce(addr common.Address, nonce uint64)
- func (s *EthState) SetStateDB(d *state.StateDB)
- func (s *EthState) StateAt(root common.Hash) (*state.StateDB, error)
- func (s *EthState) StateDB() *state.StateDB
- func (s *EthState) SubBalance(addr common.Address, amount *uint256.Int, reason tracing.BalanceChangeReason)
- type Genesis
- type GenesisAccountdeprecated
- type GenesisAllocdeprecated
- type GenesisMismatchError
- type GethConfig
- type ReceiptRequest
- type ReceiptResponse
- type ReceiptsRequest
- type ReceiptsResponse
- type RevertError
- type Solidity
- func (s *Solidity) Call(ctx *context.ReadContext)
- func (s *Solidity) CheckTxn(txn *yu_types.SignedTxn) error
- func (s *Solidity) Commit(block *yu_types.Block)
- func (s *Solidity) EndBlock(block *yu_types.Block)
- func (s *Solidity) ExecuteTxn(ctx *context.WriteContext) (err error)
- func (s *Solidity) FinaliseStateDB(deleteEmptyObjects bool)
- func (s *Solidity) FinalizeBlock(block *yu_types.Block)
- func (s *Solidity) GetCopiedStateDB() *state.StateDB
- func (s *Solidity) GetEthDB() ethdb.Database
- func (s *Solidity) GetEthReceipt(hash common.Hash) (*types.Receipt, error)
- func (s *Solidity) GetReceipt(ctx *context.ReadContext)
- func (s *Solidity) GetReceipts(ctx *context.ReadContext)
- func (s *Solidity) InitChain(genesisBlock *yu_types.Block)
- func (s *Solidity) PreHandleTxn(txn *yu_types.SignedTxn) error
- func (s *Solidity) SetStateDB(d *state.StateDB)
- func (s *Solidity) StartBlock(block *yu_types.Block)
- func (s *Solidity) StateAt(root common.Hash) (*state.StateDB, error)
- func (s *Solidity) StateDB() *state.StateDB
- type TempTransactionArgs
- type TxIndexingError
- type TxRequest
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAlreadyKnown is returned if the transaction is already contained // within the pool. ErrAlreadyKnown = errors.New("already known") ErrNotFoundReceipt = errors.New("receipt not found") )
From geth/core/txpool/errors
Functions ¶
func LoadChainConfig ¶
LoadChainConfig loads the stored chain config if it is already present in database, otherwise, return the config in the provided genesis specification.
func SetupGenesisBlock ¶
func SetupGenesisBlock(ethState *EthState, genesis *Genesis) (*params.ChainConfig, common.Hash, error)
SetupGenesisBlock writes or updates the genesis block in db. The block that will be used is:
genesis == nil genesis != nil +------------------------------------------ db has no genesis | main-net default | genesis db has genesis | from DB | genesis (if compatible)
The stored chain configuration will be updated if it is compatible (i.e. does not specify a fork block below the local head block). In case of a conflict, the error is a *params.ConfigCompatError and the new, unwritten config is returned.
The returned chain configuration is never nil.
func SetupGenesisBlockWithOverride ¶
func SetupGenesisBlockWithOverride(ethState *EthState, genesis *Genesis, overrides *ChainOverrides) (*params.ChainConfig, common.Hash, error)
Types ¶
type AccountInfo ¶
type CallRequest ¶
type CallResponse ¶
type ChainOverrides ¶
ChainOverrides contains the changes to chain config.
type CreateRequest ¶
type EthState ¶
type EthState struct {
// contains filtered or unexported fields
}
func NewEthState ¶
func (*EthState) AddBalance ¶
func (*EthState) SetStateDB ¶
func (*EthState) SubBalance ¶
type Genesis ¶
type Genesis struct { Config *params.ChainConfig `json:"config"` Nonce uint64 `json:"nonce"` Timestamp uint64 `json:"timestamp"` ExtraData []byte `json:"extraData"` GasLimit uint64 `json:"gasLimit" gencodec:"required"` Difficulty *big.Int `json:"difficulty" gencodec:"required"` Mixhash common.Hash `json:"mixHash"` Coinbase common.Address `json:"coinbase"` Alloc types.GenesisAlloc `json:"alloc" gencodec:"required"` // These fields are used for consensus tests. Please don't use them // in actual genesis blocks. Number uint64 `json:"number"` GasUsed uint64 `json:"gasUsed"` ParentHash common.Hash `json:"parentHash"` BaseFee *big.Int `json:"baseFeePerGas"` // EIP-1559 ExcessBlobGas *uint64 `json:"excessBlobGas"` // EIP-4844 BlobGasUsed *uint64 `json:"blobGasUsed"` // EIP-4844 }
Genesis specifies the header fields, state of a genesis block. It also defines hard fork switch-over blocks through the chain configuration.
func DefaultGenesisBlock ¶
func DefaultGenesisBlock() *Genesis
DefaultGenesisBlock returns the Ethereum main net genesis block.
func DefaultGoerliGenesisBlock ¶
func DefaultGoerliGenesisBlock() *Genesis
DefaultGoerliGenesisBlock returns the Görli network genesis block.
func DefaultHoleskyGenesisBlock ¶
func DefaultHoleskyGenesisBlock() *Genesis
DefaultHoleskyGenesisBlock returns the Holesky network genesis block.
func DefaultSepoliaGenesisBlock ¶
func DefaultSepoliaGenesisBlock() *Genesis
DefaultSepoliaGenesisBlock returns the Sepolia network genesis block.
func DeveloperGenesisBlock ¶
DeveloperGenesisBlock returns the 'geth --dev' genesis block.
func (*Genesis) Commit ¶
Commit writes the block and state of a genesis specification to the database. The block is committed as the canonical head block.
func (*Genesis) IsVerkle ¶
IsVerkle indicates whether the state is already stored in a verkle tree at genesis time.
func (*Genesis) MustCommit ¶
MustCommit writes the genesis block and state to db, panicking on error. The block is committed as the canonical head block.
type GenesisAccount
deprecated
type GenesisAlloc
deprecated
type GenesisAlloc = types.GenesisAlloc
Deprecated: use types.GenesisAlloc instead.
type GenesisMismatchError ¶
GenesisMismatchError is raised when trying to overwrite an existing genesis block with an incompatible one.
func (*GenesisMismatchError) Error ¶
func (e *GenesisMismatchError) Error() string
type GethConfig ¶
type GethConfig struct { ChainConfig *params.ChainConfig // BlockContext provides the EVM with auxiliary information. Once provided // it shouldn't be modified. GetHashFn func(n uint64) common.Hash Coinbase common.Address GasLimit uint64 BlockNumber *big.Int Time uint64 Difficulty *big.Int BaseFee *big.Int BlobBaseFee *big.Int Random *common.Hash // TxContext provides the EVM with information about a transaction. // All fields can change between transactions. Origin common.Address GasPrice *big.Int BlobHashes []common.Hash BlobFeeCap *big.Int // StateDB gives access to the underlying state State *state.StateDB // Unknown Value *big.Int Debug bool EVMConfig vm.Config // Global config EnableEthRPC bool `toml:"enable_eth_rpc"` EthHost string `toml:"eth_host"` EthPort string `toml:"eth_port"` // EventsWatcher configs EnableBridge bool `toml:"enable_bridge"` L1ClientAddress string `toml:"l1_client_address"` L2ClientAddress string `toml:"l2_client_address"` ParentLayerContractAddress string `toml:"parentlayer_contract_address"` ChildLayerContractAddress string `toml:"childlayer_contract_address"` L2BlockCollectionDepth *big.Int `toml:"l2_block_collection_depth"` BridgeHost string `toml:"bridge_host"` BridgePort string `toml:"bridge_port"` BridgeDBConfig *database.Config `toml:"bridge_db_config"` }
func LoadEvmConfig ¶
func LoadEvmConfig(fpath string) *GethConfig
func (*GethConfig) Copy ¶
func (gc *GethConfig) Copy() *GethConfig
type ReceiptRequest ¶
type ReceiptResponse ¶
type ReceiptsRequest ¶
type ReceiptsResponse ¶
type RevertError ¶
type RevertError struct {
// contains filtered or unexported fields
}
RevertError is an API error that encompasses an EVM revert with JSON error code and a binary data blob.
func NewRevertError ¶
func NewRevertError(revert []byte) *RevertError
NewRevertError creates a RevertError instance with the provided revert data.
func (*RevertError) ErrorCode ¶
func (e *RevertError) ErrorCode() int
ErrorCode returns the JSON error code for a revert. See: https://github.com/ethereum/wiki/wiki/JSON-RPC-Error-Codes-Improvement-Proposal
func (*RevertError) ErrorData ¶
func (e *RevertError) ErrorData() interface{}
ErrorData returns the hex encoded revert reason.
type Solidity ¶
func NewSolidity ¶
func NewSolidity(gethConfig *GethConfig) *Solidity
func (*Solidity) Call ¶
func (s *Solidity) Call(ctx *context.ReadContext)
Call executes the code given by the contract's address. It will return the EVM's return value or an error if it failed.
func (*Solidity) ExecuteTxn ¶
func (s *Solidity) ExecuteTxn(ctx *context.WriteContext) (err error)
ExecuteTxn executes the code using the input as call data during the execution. It returns the EVM's return value, the new state and an error if it failed.
Execute sets up an in-memory, temporary, environment for the execution of the given code. It makes sure that it's restored to its original state afterwards.
func (*Solidity) FinaliseStateDB ¶
func (*Solidity) FinalizeBlock ¶
func (*Solidity) GetCopiedStateDB ¶
func (*Solidity) GetEthReceipt ¶
func (*Solidity) GetReceipt ¶
func (s *Solidity) GetReceipt(ctx *context.ReadContext)
func (*Solidity) GetReceipts ¶
func (s *Solidity) GetReceipts(ctx *context.ReadContext)
func (*Solidity) SetStateDB ¶
func (*Solidity) StartBlock ¶
type TempTransactionArgs ¶
type TempTransactionArgs struct { From *common.Address `json:"from"` To *common.Address `json:"to"` Gas *hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` Value *hexutil.Big `json:"value"` Nonce *hexutil.Uint64 `json:"nonce"` // We accept "data" and "input" for backwards-compatibility reasons. // "input" is the newer name and should be preferred by clients. // Issue detail: https://github.com/ethereum/go-ethereum/issues/15628 Data *hexutil.Bytes `json:"data"` Input *hexutil.Bytes `json:"input"` // Introduced by AccessListTxType transaction. AccessList *types.AccessList `json:"accessList,omitempty"` ChainID *hexutil.Big `json:"chainId,omitempty"` // For BlobTxType BlobFeeCap *hexutil.Big `json:"maxFeePerBlobGas"` BlobHashes []common.Hash `json:"blobVersionedHashes,omitempty"` // For BlobTxType transactions with blob sidecar Blobs []kzg4844.Blob `json:"blobs"` Commitments []kzg4844.Commitment `json:"commitments"` Proofs []kzg4844.Proof `json:"proofs"` // contains filtered or unexported fields }
TransactionArgs represents the arguments to construct a new transaction or a message call.
func (*TempTransactionArgs) ToTransaction ¶
func (args *TempTransactionArgs) ToTransaction(v, r, s *big.Int) *types.Transaction
ToTransaction converts the arguments to a transaction. This assumes that setDefaults has been called.
type TxIndexingError ¶
type TxIndexingError struct{}
TxIndexingError is an API error that indicates the transaction indexing is not fully finished yet with JSON error code and a binary data blob.
func NewTxIndexingError ¶
func NewTxIndexingError() *TxIndexingError
NewTxIndexingError creates a TxIndexingError instance.
func (*TxIndexingError) Error ¶
func (e *TxIndexingError) Error() string
Error implement error interface, returning the error message.
func (*TxIndexingError) ErrorCode ¶
func (e *TxIndexingError) ErrorCode() int
ErrorCode returns the JSON error code for a revert. See: https://github.com/ethereum/wiki/wiki/JSON-RPC-Error-Codes-Improvement-Proposal
func (*TxIndexingError) ErrorData ¶
func (e *TxIndexingError) ErrorData() interface{}
ErrorData returns the hex encoded revert reason.
type TxRequest ¶
type TxRequest struct { Input []byte `json:"input"` Address *common.Address `json:"address"` Origin common.Address `json:"origin"` GasLimit uint64 `json:"gasLimit"` GasPrice *big.Int `json:"gasPrice"` Value *big.Int `json:"value"` Hash common.Hash `json:"hash"` Nonce uint64 `json:"nonce"` V *big.Int `json:"v"` R *big.Int `json:"r"` S *big.Int `json:"s"` OriginArgs []byte `json:"originArgs"` IsInternalCall bool `json:"is_internal_call"` }