Search in sources :

Example 1 with PetersburgGasCalculator

use of org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator in project besu by hyperledger.

the class RefundSstoreGasTest method scenarios.

@Parameters(name = "calculator: {0}, original: {2}, current: {3}, new: {4}")
public static Object[][] scenarios() {
    final GasCalculator constantinople = new ConstantinopleGasCalculator();
    final GasCalculator petersburg = new PetersburgGasCalculator();
    final GasCalculator istanbul = new IstanbulGasCalculator();
    return new Object[][] { // Zero no-op
    { "constantinople", constantinople, ZERO, ZERO, ZERO, 200L, 0L }, { "petersburg", petersburg, ZERO, ZERO, ZERO, 5_000L, 0L }, { "istanbul", istanbul, ZERO, ZERO, ZERO, 800L, 0L }, // Zero fresh change
    { "constantinople", constantinople, ZERO, ZERO, ONE, 20_000L, 0L }, { "petersburg", petersburg, ZERO, ZERO, ONE, 20_000L, 0L }, { "istanbul", istanbul, ZERO, ZERO, ONE, 20_000L, 0L }, // Dirty, reset to zero
    { "constantinople", constantinople, ZERO, ONE, ZERO, 200L, 19_800L }, { "petersburg", petersburg, ZERO, ONE, ZERO, 5_000L, 15_000L }, { "istanbul", istanbul, ZERO, ONE, ZERO, 800L, 19_200L }, // Dirty, changed but not reset
    { "constantinople", constantinople, ZERO, ONE, TWO, 200L, 0L }, { "petersburg", petersburg, ZERO, ONE, TWO, 5_000L, 0L }, { "istanbul", istanbul, ZERO, ONE, TWO, 800L, 0L }, // Dirty no-op
    { "constantinople", constantinople, ZERO, ONE, ONE, 200L, 0L }, { "petersburg", petersburg, ZERO, ONE, ONE, 5_000L, 0L }, { "istanbul", istanbul, ZERO, ONE, ONE, 800L, 0L }, // Dirty, zero no-op
    { "constantinople", constantinople, ONE, ZERO, ZERO, 200L, 0L }, { "petersburg", petersburg, ONE, ZERO, ZERO, 5_000L, 0L }, { "istanbul", istanbul, ONE, ZERO, ZERO, 800L, 0L }, // Dirty, reset to non-zero
    { "constantinople", constantinople, ONE, ZERO, ONE, 200L, -15_000L + 4_800L }, { "petersburg", petersburg, ONE, ZERO, ONE, 20_000L, 0L }, { "istanbul", istanbul, ONE, ZERO, ONE, 800L, -15_000L + 4_200L }, // Fresh change to zero
    { "constantinople", constantinople, ONE, ONE, ZERO, 5_000L, 15_000L }, { "petersburg", petersburg, ONE, ONE, ZERO, 5_000L, 15_000L }, { "istanbul", istanbul, ONE, ONE, ZERO, 5_000L, 15_000L }, // Fresh change with all non-zero
    { "constantinople", constantinople, ONE, ONE, TWO, 5_000L, 0L }, { "petersburg", petersburg, ONE, ONE, TWO, 5_000L, 0L }, { "istanbul", istanbul, ONE, ONE, TWO, 5_000L, 0L }, // Dirty, clear originally set value
    { "constantinople", constantinople, ONE, TWO, ZERO, 200L, 15_000L }, { "petersburg", petersburg, ONE, TWO, ZERO, 5_000L, 15_000L }, { "istanbul", istanbul, ONE, TWO, ZERO, 800L, 15_000L }, // Non-zero no-op
    { "constantinople", constantinople, ONE, ONE, ONE, 200L, 0L }, { "petersburg", petersburg, ONE, ONE, ONE, 5_000L, 0L }, { "istanbul", istanbul, ONE, ONE, ONE, 800L, 0L } };
}
Also used : PetersburgGasCalculator(org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator) GasCalculator(org.hyperledger.besu.evm.gascalculator.GasCalculator) IstanbulGasCalculator(org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator) ConstantinopleGasCalculator(org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator) PetersburgGasCalculator(org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator) ConstantinopleGasCalculator(org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator) IstanbulGasCalculator(org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator) Parameters(org.junit.runners.Parameterized.Parameters)

Example 2 with PetersburgGasCalculator

use of org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator in project besu by hyperledger.

the class BlockHashOperationBenchmark method prepare.

@Setup
public void prepare() throws Exception {
    operationBenchmarkHelper = OperationBenchmarkHelper.create();
    operation = new BlockHashOperation(new PetersburgGasCalculator());
    frame = operationBenchmarkHelper.createMessageFrame();
}
Also used : PetersburgGasCalculator(org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator) BlockHashOperation(org.hyperledger.besu.evm.operation.BlockHashOperation) Setup(org.openjdk.jmh.annotations.Setup)

Aggregations

PetersburgGasCalculator (org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator)2 ConstantinopleGasCalculator (org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator)1 GasCalculator (org.hyperledger.besu.evm.gascalculator.GasCalculator)1 IstanbulGasCalculator (org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator)1 BlockHashOperation (org.hyperledger.besu.evm.operation.BlockHashOperation)1 Parameters (org.junit.runners.Parameterized.Parameters)1 Setup (org.openjdk.jmh.annotations.Setup)1