core/vm: rename RANDOM to PREVRANDAO (#25691)

See: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4399.md

>  This EIP supplants the semantics of the return value of existing DIFFICULTY (0x44) opcode and renames the opcode to PREVRANDAO (0x44).
pull/25715/head
Marius van der Wijden 2 years ago committed by GitHub
parent a32a02f237
commit d30e39b2f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      core/vm/evm.go
  2. 2
      core/vm/jump_table.go
  3. 3
      core/vm/opcodes.go

@ -75,7 +75,7 @@ type BlockContext struct {
Time *big.Int // Provides information for TIME Time *big.Int // Provides information for TIME
Difficulty *big.Int // Provides information for DIFFICULTY Difficulty *big.Int // Provides information for DIFFICULTY
BaseFee *big.Int // Provides information for BASEFEE BaseFee *big.Int // Provides information for BASEFEE
Random *common.Hash // Provides information for RANDOM Random *common.Hash // Provides information for PREVRANDAO
} }
// TxContext provides the EVM with information about a transaction. // TxContext provides the EVM with information about a transaction.

@ -80,7 +80,7 @@ func validate(jt JumpTable) JumpTable {
func newMergeInstructionSet() JumpTable { func newMergeInstructionSet() JumpTable {
instructionSet := newLondonInstructionSet() instructionSet := newLondonInstructionSet()
instructionSet[RANDOM] = &operation{ instructionSet[PREVRANDAO] = &operation{
execute: opRandom, execute: opRandom,
constantGas: GasQuickStep, constantGas: GasQuickStep,
minStack: minStack(0, 1), minStack: minStack(0, 1),

@ -99,6 +99,7 @@ const (
NUMBER OpCode = 0x43 NUMBER OpCode = 0x43
DIFFICULTY OpCode = 0x44 DIFFICULTY OpCode = 0x44
RANDOM OpCode = 0x44 // Same as DIFFICULTY RANDOM OpCode = 0x44 // Same as DIFFICULTY
PREVRANDAO OpCode = 0x44 // Same as DIFFICULTY
GASLIMIT OpCode = 0x45 GASLIMIT OpCode = 0x45
CHAINID OpCode = 0x46 CHAINID OpCode = 0x46
SELFBALANCE OpCode = 0x47 SELFBALANCE OpCode = 0x47
@ -280,7 +281,7 @@ var opCodeToString = map[OpCode]string{
COINBASE: "COINBASE", COINBASE: "COINBASE",
TIMESTAMP: "TIMESTAMP", TIMESTAMP: "TIMESTAMP",
NUMBER: "NUMBER", NUMBER: "NUMBER",
DIFFICULTY: "DIFFICULTY", // TODO (MariusVanDerWijden) rename to RANDOM post merge DIFFICULTY: "DIFFICULTY", // TODO (MariusVanDerWijden) rename to PREVRANDAO post merge
GASLIMIT: "GASLIMIT", GASLIMIT: "GASLIMIT",
CHAINID: "CHAINID", CHAINID: "CHAINID",
SELFBALANCE: "SELFBALANCE", SELFBALANCE: "SELFBALANCE",

Loading…
Cancel
Save