Documentation ¶
Index ¶
- Variables
- func GetDefaultSigner() types.Signer
- func GetSigner(cfg *Config) types.Signer
- type BlockView
- type Config
- type Emulator
- type Option
- func WithBlockNumber(blockNumber *big.Int) Option
- func WithBlockTime(time uint64) Option
- func WithCoinbase(coinbase common.Address) Option
- func WithDirectCallBaseGasUsage(gas uint64) Option
- func WithGasLimit(gasLimit uint64) Option
- func WithGasPrice(gasPrice *big.Int) Option
- func WithGetBlockHashFunction(getHash vm.GetHashFunc) Option
- func WithMainnetChainID() Option
- func WithOrigin(origin common.Address) Option
- func WithTestnetChainID() Option
- type ReadOnlyBlockView
Constants ¶
This section is empty.
Variables ¶
var ( FlowEVMTestnetChainID = big.NewInt(666) FlowEVMMainnetChainID = big.NewInt(777) BlockLevelGasLimit = uint64(math.MaxUint64) )
var DefaultChainConfig = ¶ms.ChainConfig{ ChainID: FlowEVMTestnetChainID, HomesteadBlock: big.NewInt(0), DAOForkBlock: big.NewInt(0), DAOForkSupport: false, EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), BerlinBlock: big.NewInt(0), LondonBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), ShanghaiTime: &zero, CancunTime: &zero, PragueTime: &zero, }
DefaultChainConfig is the default chain config which considers majority of EVM upgrades (e.g. Shanghai update) already been applied this has done through setting the height of these changes to zero nad setting the time for some other changes to zero For the future changes of EVM, we need to update the EVM go mod version and set a proper height for the specific release based on the Flow EVM heights so it could gets activated at a desired time.
Functions ¶
func GetDefaultSigner ¶
GetDefaultSigner returns a signer which is compatible with the default config
Types ¶
type BlockView ¶
type BlockView struct {
// contains filtered or unexported fields
}
BlockView allows mutation of the evm state as part of a block
TODO: allow multiple calls per block view TODO: add block level commit (separation of trie commit to storage)
func (*BlockView) DirectCall ¶
DirectCall executes a direct call
func (*BlockView) RunTransaction ¶
RunTransaction runs an evm transaction
type Config ¶
type Config struct { // Chain Config ChainConfig *params.ChainConfig // EVM config EVMConfig vm.Config // block context BlockContext *vm.BlockContext // transaction context TxContext *vm.TxContext // base unit of gas for direct calls DirectCallBaseGasUsage uint64 }
Config sets the required parameters
type Emulator ¶
type Emulator struct {
// contains filtered or unexported fields
}
Emulator handles operations against evm runtime
func NewEmulator ¶
NewEmulator constructs a new EVM Emulator
func (*Emulator) NewBlockView ¶
NewBlockView constructs a new block view (mutable)
func (*Emulator) NewReadOnlyBlockView ¶
func (em *Emulator) NewReadOnlyBlockView(ctx types.BlockContext) (types.ReadOnlyBlockView, error)
NewReadOnlyBlockView constructs a new readonly block view
type Option ¶
func WithBlockNumber ¶
WithBlockNumber sets the block height in the block context
func WithBlockTime ¶
WithBlockTime sets the block time in the block context
func WithCoinbase ¶
WithCoinbase sets the coinbase of the block where the fees are collected in
func WithDirectCallBaseGasUsage ¶
WithDirectCallBaseGasUsage sets the base direct call gas usage
func WithGasLimit ¶
WithGasLimit sets the gas limit of the transaction
func WithGasPrice ¶
WithGasPrice sets the gas price for the transaction (usually the one sets by the sender)
func WithGetBlockHashFunction ¶
func WithGetBlockHashFunction(getHash vm.GetHashFunc) Option
WithGetBlockHashFunction sets the functionality to look up block hash by height
func WithMainnetChainID ¶
func WithMainnetChainID() Option
WithMainnetChainID sets the chain ID to flow evm mainnet
func WithOrigin ¶
WithOrigin sets the origin of the transaction (signer)
func WithTestnetChainID ¶
func WithTestnetChainID() Option
WithMainnetChainID sets the chain ID to flow evm testnet
type ReadOnlyBlockView ¶
type ReadOnlyBlockView struct {
// contains filtered or unexported fields
}
ReadOnlyBlockView provides a read only view of a block could be used multiple times for queries