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

chore(evm): add comment regarding RANDOM opcode #1520

Merged
merged 4 commits into from
Dec 2, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ func (k *Keeper) NewEVM(
tracer vm.EVMLogger,
stateDB vm.StateDB,
) evm.EVM {
// Use BlockHash for random field
random := common.BytesToHash(ctx.HeaderHash())
fedekunze marked this conversation as resolved.
Show resolved Hide resolved

blockCtx := vm.BlockContext{
CanTransfer: core.CanTransfer,
Transfer: core.Transfer,
Expand All @@ -89,6 +92,7 @@ func (k *Keeper) NewEVM(
Time: big.NewInt(ctx.BlockHeader().Time.Unix()),
Difficulty: big.NewInt(0), // unused. Only required in PoW context
BaseFee: cfg.BaseFee,
Random: &random,
}

txCtx := core.NewEVMTxContext(msg)
Expand Down