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).
This commit is contained in:
Marius van der Wijden 2022-09-07 13:09:52 +02:00 committed by GitHub
parent a32a02f237
commit d30e39b2f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -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.

View File

@ -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),

View File

@ -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",