renamed op code RANDOM to PREVRANDAO (#3492)

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
pull/3494/head
Daniel Lehrner 3 years ago committed by GitHub
parent 1830d6d95e
commit f6bff390a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/vm/operations/PrevRanDaoOperationTest.java
  2. 4
      evm/src/main/java/org/hyperledger/besu/evm/MainnetEVMs.java
  3. 6
      evm/src/main/java/org/hyperledger/besu/evm/operation/PrevRanDaoOperation.java

@ -24,18 +24,18 @@ import org.hyperledger.besu.evm.frame.BlockValues;
import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.LondonGasCalculator; import org.hyperledger.besu.evm.gascalculator.LondonGasCalculator;
import org.hyperledger.besu.evm.operation.Operation; import org.hyperledger.besu.evm.operation.Operation;
import org.hyperledger.besu.evm.operation.RandomOperation; import org.hyperledger.besu.evm.operation.PrevRanDaoOperation;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.units.bigints.UInt256; import org.apache.tuweni.units.bigints.UInt256;
import org.junit.Test; import org.junit.Test;
public class RandomOperationTest { public class PrevRanDaoOperationTest {
@Test @Test
public void pushesRandWhenDifficultyZero() { public void pushesRandWhenDifficultyZero() {
RandomOperation op = new RandomOperation(new LondonGasCalculator()); PrevRanDaoOperation op = new PrevRanDaoOperation(new LondonGasCalculator());
MessageFrame messageFrame = mock(MessageFrame.class); MessageFrame messageFrame = mock(MessageFrame.class);
BlockValues blockHeader = mock(BlockValues.class); BlockValues blockHeader = mock(BlockValues.class);
Bytes32 rand = Bytes32.fromHexString("0xb0b0face"); Bytes32 rand = Bytes32.fromHexString("0xb0b0face");
@ -50,7 +50,7 @@ public class RandomOperationTest {
@Test @Test
public void pushesDifficultyWhenPresent() { public void pushesDifficultyWhenPresent() {
RandomOperation op = new RandomOperation(new LondonGasCalculator()); PrevRanDaoOperation op = new PrevRanDaoOperation(new LondonGasCalculator());
MessageFrame messageFrame = mock(MessageFrame.class); MessageFrame messageFrame = mock(MessageFrame.class);
BlockValues blockHeader = mock(BlockValues.class); BlockValues blockHeader = mock(BlockValues.class);
Bytes32 rand = Bytes32.fromHexString("0xb0b0face"); Bytes32 rand = Bytes32.fromHexString("0xb0b0face");

@ -80,8 +80,8 @@ import org.hyperledger.besu.evm.operation.OrOperation;
import org.hyperledger.besu.evm.operation.OriginOperation; import org.hyperledger.besu.evm.operation.OriginOperation;
import org.hyperledger.besu.evm.operation.PCOperation; import org.hyperledger.besu.evm.operation.PCOperation;
import org.hyperledger.besu.evm.operation.PopOperation; import org.hyperledger.besu.evm.operation.PopOperation;
import org.hyperledger.besu.evm.operation.PrevRanDaoOperation;
import org.hyperledger.besu.evm.operation.PushOperation; import org.hyperledger.besu.evm.operation.PushOperation;
import org.hyperledger.besu.evm.operation.RandomOperation;
import org.hyperledger.besu.evm.operation.ReturnDataCopyOperation; import org.hyperledger.besu.evm.operation.ReturnDataCopyOperation;
import org.hyperledger.besu.evm.operation.ReturnDataSizeOperation; import org.hyperledger.besu.evm.operation.ReturnDataSizeOperation;
import org.hyperledger.besu.evm.operation.ReturnOperation; import org.hyperledger.besu.evm.operation.ReturnOperation;
@ -393,6 +393,6 @@ public abstract class MainnetEVMs {
final GasCalculator gasCalculator, final GasCalculator gasCalculator,
final BigInteger chainID) { final BigInteger chainID) {
registerLondonOperations(registry, gasCalculator, chainID); registerLondonOperations(registry, gasCalculator, chainID);
registry.put(new RandomOperation(gasCalculator)); registry.put(new PrevRanDaoOperation(gasCalculator));
} }
} }

@ -20,10 +20,10 @@ import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.apache.tuweni.units.bigints.UInt256; import org.apache.tuweni.units.bigints.UInt256;
public class RandomOperation extends AbstractFixedCostOperation { public class PrevRanDaoOperation extends AbstractFixedCostOperation {
public RandomOperation(final GasCalculator gasCalculator) { public PrevRanDaoOperation(final GasCalculator gasCalculator) {
super(0x44, "RANDOM", 0, 1, 1, gasCalculator, gasCalculator.getBaseTierGasCost()); super(0x44, "PREVRANDAO", 0, 1, 1, gasCalculator, gasCalculator.getBaseTierGasCost());
} }
@Override @Override
Loading…
Cancel
Save