Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Missing EIP-4399 RANDOM opcode info #1512

Closed
fedekunze opened this issue Nov 30, 2022 · 2 comments
Closed

Missing EIP-4399 RANDOM opcode info #1512

fedekunze opened this issue Nov 30, 2022 · 2 comments

Comments

@fedekunze
Copy link
Contributor

fedekunze commented Nov 30, 2022

The EVM is currently missing the Random field on the vm.BlockContext that provides information for the RANDOM opcode as defined in EIP-4399

// NewEVM generates a go-ethereum VM from the provided Message fields and the chain parameters
// (ChainConfig and module Params). It additionally sets the validator operator address as the
// coinbase address to make it available for the COINBASE opcode, even though there is no
// beneficiary of the coinbase transaction (since we're not mining).
func (k *Keeper) NewEVM(
	ctx sdk.Context,
	msg core.Message,
	cfg *types.EVMConfig,
	tracer vm.EVMLogger,
	stateDB vm.StateDB,
) evm.EVM {
	blockCtx := vm.BlockContext{
		CanTransfer: core.CanTransfer,
		Transfer:    core.Transfer,
		GetHash:     k.GetHashFn(ctx),
		Coinbase:    cfg.CoinBase,
		GasLimit:    ethermint.BlockGasLimit(ctx),
		BlockNumber: big.NewInt(ctx.BlockHeight()),
		Time:        big.NewInt(ctx.BlockHeader().Time.Unix()),
		Difficulty:  big.NewInt(0), // unused. Only required in PoW context
		BaseFee:     cfg.BaseFee,
		Random:      nil,		 // <--- missing 
	}

	txCtx := core.NewEVMTxContext(msg)
	if tracer == nil {
		tracer = k.Tracer(ctx, msg, cfg.ChainConfig)
	}
	vmConfig := k.VMConfig(ctx, msg, cfg, tracer)
	return k.evmConstructor(blockCtx, txCtx, stateDB, cfg.ChainConfig, vmConfig, k.customPrecompiles)
}

Ref: ethereum/go-ethereum#24141

@fedekunze fedekunze moved this to 📋 Backlog in Ethermint Board Nov 30, 2022
@fedekunze fedekunze changed the title Missing EIP-4399 RANDOM opcode Missing EIP-4399 RANDOM opcode info Nov 30, 2022
@VictorTrustyDev
Copy link
Contributor

VictorTrustyDev commented Dec 2, 2022

Btw: evm proto ChainConfig is currently missing merge_fork_block, which defined in genesis.json, is one of the bugs that block evmos validate-genesis command

@github-actions
Copy link

This issue is stale because it has been open 45 days with no activity. Remove Status: Stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ❌ Canceled in Ethermint Board Jan 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Status: Canceled
Development

Successfully merging a pull request may close this issue.

2 participants