diff --git a/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasTest.java b/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasTest.java index df80e487..527bd3a4 100644 --- a/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasTest.java +++ b/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasTest.java @@ -49,9 +49,8 @@ import org.web3j.protocol.http.HttpService; public class EstimateGasTest extends LineaPluginTestBase { - protected static final int VERIFICATION_GAS_COST = 1_200_000; - protected static final int VERIFICATION_CAPACITY = 90_000; - protected static final int GAS_PRICE_RATIO = 15; + protected static final int FIXED_GAS_COST_KWEI = 1_200_000; + protected static final int VARIABLE_GAS_COST_KWEI = 90_000; protected static final double MIN_MARGIN = 1.0; protected static final double ESTIMATE_GAS_MIN_MARGIN = 1.0; protected static final Wei MIN_GAS_PRICE = Wei.of(1_000_000_000); @@ -65,9 +64,8 @@ public List getTestCliOptions() { protected TestCommandLineOptionsBuilder getTestCommandLineOptionsBuilder() { return new TestCommandLineOptionsBuilder() - .set("--plugin-linea-verification-gas-cost=", String.valueOf(VERIFICATION_GAS_COST)) - .set("--plugin-linea-verification-capacity=", String.valueOf(VERIFICATION_CAPACITY)) - .set("--plugin-linea-gas-price-ratio=", String.valueOf(GAS_PRICE_RATIO)) + .set("--plugin-linea-fixed-gas-cost-kwei=", String.valueOf(FIXED_GAS_COST_KWEI)) + .set("--plugin-linea-variable-gas-cost-kwei=", String.valueOf(VARIABLE_GAS_COST_KWEI)) .set("--plugin-linea-min-margin=", String.valueOf(MIN_MARGIN)) .set("--plugin-linea-estimate-gas-min-margin=", String.valueOf(ESTIMATE_GAS_MIN_MARGIN)) .set("--plugin-linea-max-tx-gas-limit=", String.valueOf(MAX_TRANSACTION_GAS_LIMIT)); @@ -82,9 +80,8 @@ public void setMinGasPrice() { public void createDefaultConfigurations() { profitabilityConf = LineaProfitabilityCliOptions.create().toDomainObject().toBuilder() - .verificationCapacity(VERIFICATION_CAPACITY) - .verificationGasCost(VERIFICATION_GAS_COST) - .gasPriceRatio(GAS_PRICE_RATIO) + .fixedCostKWei(FIXED_GAS_COST_KWEI) + .variableCostKWei(VARIABLE_GAS_COST_KWEI) .minMargin(MIN_MARGIN) .estimateGasMinMargin(ESTIMATE_GAS_MIN_MARGIN) .build(); @@ -161,7 +158,7 @@ protected void assertIsProfitable( final var profitablePriorityFee = profitabilityCalculator.profitablePriorityFeePerGas( - tx, profitabilityConf.txPoolMinMargin(), minGasPrice, estimatedGasLimit); + tx, profitabilityConf.txPoolMinMargin(), estimatedGasLimit); assertThat(profitablePriorityFee.greaterThan(minGasPrice)).isTrue(); @@ -170,7 +167,6 @@ protected void assertIsProfitable( "Test", tx, profitabilityConf.txPoolMinMargin(), - minerNode.getMiningParameters().getMinTransactionGasPrice(), estimatedMaxGasPrice, estimatedGasLimit)) .isTrue(); diff --git a/arithmetization/src/main/java/net/consensys/linea/bl/TransactionProfitabilityCalculator.java b/arithmetization/src/main/java/net/consensys/linea/bl/TransactionProfitabilityCalculator.java index d31d093b..2768f71d 100644 --- a/arithmetization/src/main/java/net/consensys/linea/bl/TransactionProfitabilityCalculator.java +++ b/arithmetization/src/main/java/net/consensys/linea/bl/TransactionProfitabilityCalculator.java @@ -15,6 +15,7 @@ package net.consensys.linea.bl; import java.math.BigDecimal; +import java.math.BigInteger; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.compress.LibCompress; @@ -25,68 +26,50 @@ @Slf4j public class TransactionProfitabilityCalculator { - + private static final BigInteger TO_WEI_MULTIPLIER = BigInteger.valueOf(1000); private final LineaProfitabilityConfiguration profitabilityConf; - private final double preComputedValue; - private final double priceAdjustment; public TransactionProfitabilityCalculator( final LineaProfitabilityConfiguration profitabilityConf) { this.profitabilityConf = profitabilityConf; - this.preComputedValue = - profitabilityConf.gasPriceRatio() * profitabilityConf.verificationGasCost(); - this.priceAdjustment = profitabilityConf.gasPriceAdjustment().getAsBigInteger().doubleValue(); } public Wei profitablePriorityFeePerGas( - final Transaction transaction, - final double minMargin, - final Wei minGasPrice, - final long gas) { - final double compressedTxSize = getCompressedTxSize(transaction); + final Transaction transaction, final double minMargin, final long gas) { + final int compressedTxSize = getCompressedTxSize(transaction); - final var profitAt = - (preComputedValue - * compressedTxSize - * minGasPrice.getAsBigInteger().doubleValue() - / (gas * profitabilityConf.verificationCapacity()) - + priceAdjustment) - * minMargin; + final var profitAtKWei = + minMargin + * (profitabilityConf.variableCostKWei() * compressedTxSize / gas + + profitabilityConf.fixedCostKWei()); - final var adjustedProfit = Wei.ofNumber(BigDecimal.valueOf(profitAt).toBigInteger()); + final var profitAtWei = + Wei.ofNumber(BigDecimal.valueOf(profitAtKWei).toBigInteger().multiply(TO_WEI_MULTIPLIER)); log.atDebug() .setMessage( - "Estimated profitable priorityFeePerGas: {}; estimateGasMinMargin={}, verificationCapacity={}, " - + "verificationGasCost={}, gasPriceRatio={}, gasPriceAdjustment={}, gas={}, minGasPrice={}, " - + "l1GasPrice={}, txSize={}, compressedTxSize={}") - .addArgument(adjustedProfit::toHumanReadableString) - .addArgument(profitabilityConf.estimateGasMinMargin()) - .addArgument(profitabilityConf.verificationCapacity()) - .addArgument(profitabilityConf.verificationGasCost()) - .addArgument(profitabilityConf.gasPriceRatio()) - .addArgument(profitabilityConf.gasPriceAdjustment()::toHumanReadableString) + "Estimated profitable priorityFeePerGas: {}; minMargin={}, fixedCostKWei={}, " + + "variableCostKWei={}, gas={}, txSize={}, compressedTxSize={}") + .addArgument(profitAtWei::toHumanReadableString) + .addArgument(minMargin) + .addArgument(profitabilityConf.fixedCostKWei()) + .addArgument(profitabilityConf.variableCostKWei()) .addArgument(gas) - .addArgument(minGasPrice::toHumanReadableString) - .addArgument( - () -> minGasPrice.multiply(profitabilityConf.gasPriceRatio()).toHumanReadableString()) .addArgument(transaction::getSize) .addArgument(compressedTxSize) .log(); - return adjustedProfit; + return profitAtWei; } public boolean isProfitable( final String context, final Transaction transaction, final double minMargin, - final Wei minGasPrice, final Wei effectiveGasPrice, final long gas) { - final Wei profitablePriorityFee = - profitablePriorityFeePerGas(transaction, minMargin, minGasPrice, gas); + final Wei profitablePriorityFee = profitablePriorityFeePerGas(transaction, minMargin, gas); if (effectiveGasPrice.lessThan(profitablePriorityFee)) { log( @@ -96,8 +79,7 @@ public boolean isProfitable( minMargin, effectiveGasPrice, profitablePriorityFee, - gas, - minGasPrice); + gas); return false; } @@ -108,12 +90,11 @@ public boolean isProfitable( minMargin, effectiveGasPrice, profitablePriorityFee, - gas, - minGasPrice); + gas); return true; } - private double getCompressedTxSize(final Transaction transaction) { + private int getCompressedTxSize(final Transaction transaction) { final byte[] bytes = transaction.encoded().toArrayUnsafe(); return LibCompress.CompressedSize(bytes, bytes.length); } @@ -125,12 +106,11 @@ private void log( final double minMargin, final Wei effectiveGasPrice, final Wei profitableGasPrice, - final long gasUsed, - final Wei minGasPrice) { + final long gasUsed) { leb.setMessage( "Context {}. Transaction {} has a margin of {}, minMargin={}, effectiveGasPrice={}," - + " profitableGasPrice={}, verificationCapacity={}, verificationGasCost={}, gasPriceRatio={},, gasPriceAdjustment={}" - + " gasUsed={}, minGasPrice={}") + + " profitableGasPrice={}, fixedCostKWei={}, variableCostKWei={}, " + + " gasUsed={}") .addArgument(context) .addArgument(transaction::getHash) .addArgument( @@ -140,12 +120,9 @@ private void log( .addArgument(minMargin) .addArgument(effectiveGasPrice::toHumanReadableString) .addArgument(profitableGasPrice::toHumanReadableString) - .addArgument(profitabilityConf.verificationCapacity()) - .addArgument(profitabilityConf.verificationGasCost()) - .addArgument(profitabilityConf.gasPriceRatio()) - .addArgument(profitabilityConf.gasPriceAdjustment()::toHumanReadableString) + .addArgument(profitabilityConf.fixedCostKWei()) + .addArgument(profitabilityConf.variableCostKWei()) .addArgument(gasUsed) - .addArgument(minGasPrice::toHumanReadableString) .log(); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/config/LineaProfitabilityCliOptions.java b/arithmetization/src/main/java/net/consensys/linea/config/LineaProfitabilityCliOptions.java index 14683bb5..bf5cff00 100644 --- a/arithmetization/src/main/java/net/consensys/linea/config/LineaProfitabilityCliOptions.java +++ b/arithmetization/src/main/java/net/consensys/linea/config/LineaProfitabilityCliOptions.java @@ -19,23 +19,15 @@ import com.google.common.base.MoreObjects; import jakarta.validation.constraints.Positive; -import net.consensys.linea.config.converters.WeiConverter; -import org.hyperledger.besu.datatypes.Wei; import picocli.CommandLine; /** The Linea profitability calculator CLI options. */ public class LineaProfitabilityCliOptions { - public static final String VERIFICATION_GAS_COST = "--plugin-linea-verification-gas-cost"; - public static final int DEFAULT_VERIFICATION_GAS_COST = 1_200_000; + public static final String FIXED_GAS_COST_KWEI = "--plugin-linea-fixed-gas-cost-kwei"; + public static final long DEFAULT_FIXED_GAS_COST_KWEI = 1_200_000; - public static final String VERIFICATION_CAPACITY = "--plugin-linea-verification-capacity"; - public static final int DEFAULT_VERIFICATION_CAPACITY = 90_000; - - public static final String GAS_PRICE_RATIO = "--plugin-linea-gas-price-ratio"; - public static final int DEFAULT_GAS_PRICE_RATIO = 15; - - public static final String GAS_PRICE_ADJUSTMENT = "--plugin-linea-gas-price-adjustment"; - public static final Wei DEFAULT_GAS_PRICE_ADJUSTMENT = Wei.ZERO; + public static final String VARIABLE_GAS_COST_KWEI = "--plugin-linea-variable-gas-cost-kwei"; + public static final long DEFAULT_VARIABLE_GAS_COST_KWEI = 90_000; public static final String MIN_MARGIN = "--plugin-linea-min-margin"; public static final BigDecimal DEFAULT_MIN_MARGIN = BigDecimal.ONE; @@ -56,36 +48,19 @@ public class LineaProfitabilityCliOptions { @Positive @CommandLine.Option( - names = {VERIFICATION_GAS_COST}, + names = {FIXED_GAS_COST_KWEI}, hidden = true, paramLabel = "", - description = "L1 verification gas cost (default: ${DEFAULT-VALUE})") - private int verificationGasCost = DEFAULT_VERIFICATION_GAS_COST; + description = "Fixed gas cost in KWei (default: ${DEFAULT-VALUE})") + private long fixedGasCostKwei = DEFAULT_FIXED_GAS_COST_KWEI; @Positive @CommandLine.Option( - names = {VERIFICATION_CAPACITY}, + names = {VARIABLE_GAS_COST_KWEI}, hidden = true, paramLabel = "", - description = "L1 verification capacity (default: ${DEFAULT-VALUE})") - private int verificationCapacity = DEFAULT_VERIFICATION_CAPACITY; - - @Positive - @CommandLine.Option( - names = {GAS_PRICE_RATIO}, - hidden = true, - paramLabel = "", - description = "L1/L2 gas price ratio (default: ${DEFAULT-VALUE})") - private int gasPriceRatio = DEFAULT_GAS_PRICE_RATIO; - - @CommandLine.Option( - names = {GAS_PRICE_ADJUSTMENT}, - hidden = true, - converter = WeiConverter.class, - paramLabel = "", - description = - "Amount to add to the calculated profitable gas price (default: ${DEFAULT-VALUE})") - private Wei gasPriceAdjustment = DEFAULT_GAS_PRICE_ADJUSTMENT; + description = "Variable gas cost in KWei (default: ${DEFAULT-VALUE})") + private long variableGasCostKwei = DEFAULT_VARIABLE_GAS_COST_KWEI; @Positive @CommandLine.Option( @@ -151,10 +126,8 @@ public static LineaProfitabilityCliOptions create() { public static LineaProfitabilityCliOptions fromConfig( final LineaProfitabilityConfiguration config) { final LineaProfitabilityCliOptions options = create(); - options.verificationGasCost = config.verificationGasCost(); - options.verificationCapacity = config.verificationCapacity(); - options.gasPriceRatio = config.gasPriceRatio(); - options.gasPriceAdjustment = config.gasPriceAdjustment(); + options.fixedGasCostKwei = config.fixedCostKWei(); + options.variableGasCostKwei = config.variableCostKWei(); options.minMargin = BigDecimal.valueOf(config.minMargin()); options.estimageGasMinMargin = BigDecimal.valueOf(config.estimateGasMinMargin()); options.txPoolMinMargin = BigDecimal.valueOf(config.txPoolMinMargin()); @@ -170,10 +143,8 @@ public static LineaProfitabilityCliOptions fromConfig( */ public LineaProfitabilityConfiguration toDomainObject() { return LineaProfitabilityConfiguration.builder() - .verificationGasCost(verificationGasCost) - .verificationCapacity(verificationCapacity) - .gasPriceRatio(gasPriceRatio) - .gasPriceAdjustment(gasPriceAdjustment) + .fixedCostKWei(fixedGasCostKwei) + .variableCostKWei(variableGasCostKwei) .minMargin(minMargin.doubleValue()) .estimateGasMinMargin(estimageGasMinMargin.doubleValue()) .txPoolMinMargin(txPoolMinMargin.doubleValue()) @@ -185,10 +156,8 @@ public LineaProfitabilityConfiguration toDomainObject() { @Override public String toString() { return MoreObjects.toStringHelper(this) - .add(VERIFICATION_GAS_COST, verificationGasCost) - .add(VERIFICATION_CAPACITY, verificationCapacity) - .add(GAS_PRICE_RATIO, gasPriceRatio) - .add(GAS_PRICE_ADJUSTMENT, gasPriceAdjustment) + .add(FIXED_GAS_COST_KWEI, fixedGasCostKwei) + .add(VARIABLE_GAS_COST_KWEI, variableGasCostKwei) .add(MIN_MARGIN, minMargin) .add(ESTIMATE_GAS_MIN_MARGIN, estimageGasMinMargin) .add(TX_POOL_MIN_MARGIN, txPoolMinMargin) diff --git a/arithmetization/src/main/java/net/consensys/linea/config/LineaProfitabilityConfiguration.java b/arithmetization/src/main/java/net/consensys/linea/config/LineaProfitabilityConfiguration.java index 514371eb..9157a3b8 100644 --- a/arithmetization/src/main/java/net/consensys/linea/config/LineaProfitabilityConfiguration.java +++ b/arithmetization/src/main/java/net/consensys/linea/config/LineaProfitabilityConfiguration.java @@ -16,17 +16,22 @@ package net.consensys.linea.config; import lombok.Builder; -import org.hyperledger.besu.datatypes.Wei; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.Accessors; /** The Linea profitability calculator configuration. */ @Builder(toBuilder = true) -public record LineaProfitabilityConfiguration( - int verificationGasCost, - int verificationCapacity, - int gasPriceRatio, - Wei gasPriceAdjustment, - double minMargin, - double estimateGasMinMargin, - double txPoolMinMargin, - boolean txPoolCheckApiEnabled, - boolean txPoolCheckP2pEnabled) {} +@Accessors(fluent = true) +@Getter +@ToString +public class LineaProfitabilityConfiguration { + @Setter private volatile long fixedCostKWei; + @Setter private volatile long variableCostKWei; + double minMargin; + double estimateGasMinMargin; + double txPoolMinMargin; + boolean txPoolCheckApiEnabled; + boolean txPoolCheckP2pEnabled; +} diff --git a/arithmetization/src/main/java/net/consensys/linea/extradata/LineaExtraDataHandler.java b/arithmetization/src/main/java/net/consensys/linea/extradata/LineaExtraDataHandler.java index f7a4182f..c27d103f 100644 --- a/arithmetization/src/main/java/net/consensys/linea/extradata/LineaExtraDataHandler.java +++ b/arithmetization/src/main/java/net/consensys/linea/extradata/LineaExtraDataHandler.java @@ -15,8 +15,11 @@ package net.consensys.linea.extradata; +import java.util.function.Consumer; + import lombok.extern.slf4j.Slf4j; import org.apache.tuweni.bytes.Bytes; +import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.plugin.data.AddedBlockContext; import org.hyperledger.besu.plugin.services.BesuEvents; @@ -25,28 +28,78 @@ public class LineaExtraDataHandler implements BesuEvents.BlockAddedListener { @Override public void onBlockAdded(final AddedBlockContext addedBlockContext) { final var blockHeader = addedBlockContext.getBlockHeader(); - final var extraData = blockHeader.getExtraData(); + final var versionedExtraData = blockHeader.getExtraData(); - if (!Bytes.EMPTY.equals(extraData)) { - final byte version = extractVersion(extraData); + if (!Bytes.EMPTY.equals(versionedExtraData)) { + final byte version = extractVersion(versionedExtraData); + final var extraData = versionedExtraData.slice(1); switch (version) { case 1: - parseVersion1(extraData); + Version1.parse(versionedExtraData); break; default: log.warn( - "unsupported extra data version: {}, raw extra data field", + "unsupported extra data version: {}, raw extra data field {}", version, - extraData.toHexString()); + versionedExtraData.toHexString()); } } } - private void parseVersion1(final Bytes extraData) { - log.info("Found extra data version 1: {}", extraData.toHexString()); - } - private byte extractVersion(final Bytes extraData) { return extraData.get(0); } + + private static class Version1 { + static final KWeiFieldConsumer FIXED_COST_RANGE = new KWeiFieldConsumer(4, Version1::consume); + static final KWeiFieldConsumer VARIABLE_COST_RANGE = + new KWeiFieldConsumer(4, Version1::consume); + static final KWeiFieldConsumer MIN_GAS_PRICE_RANGE = + new KWeiFieldConsumer(4, Version1::consume); + static final KWeiFieldConsumer[] fieldsSequence = + new KWeiFieldConsumer[] {FIXED_COST_RANGE, VARIABLE_COST_RANGE, MIN_GAS_PRICE_RANGE}; + + static void parse(final Bytes extraData) { + log.info("Found extra data version 1: {}", extraData.toHexString()); + int startIndex = 0; + for (KWeiFieldConsumer fieldConsumer : fieldsSequence) { + fieldConsumer.accept(extraData.slice(startIndex, fieldConsumer.length)); + startIndex += fieldConsumer.length; + } + } + + static void consume(final Bytes fieldBytes) { + log.info("Field bytes", fieldBytes.toHexString()); + } + } + + private abstract static class FieldConsumer implements Consumer { + final int length; + final Consumer consumer; + + FieldConsumer(final int length, final Consumer consumer) { + this.length = length; + this.consumer = consumer; + } + + abstract T convert(final Bytes fieldBytes); + + @Override + public void accept(final Bytes bytes) { + consumer.accept(convert(bytes)); + } + } + + private static class KWeiFieldConsumer extends FieldConsumer { + static final int FROM_KWEI_MULTIPLIER = 1000; + + KWeiFieldConsumer(final int length, final Consumer consumer) { + super(length, consumer); + } + + @Override + Wei convert(final Bytes fieldBytes) { + return Wei.wrap(fieldBytes).multiply(FROM_KWEI_MULTIPLIER); + } + } } diff --git a/arithmetization/src/main/java/net/consensys/linea/rpc/linea/LineaEstimateGas.java b/arithmetization/src/main/java/net/consensys/linea/rpc/linea/LineaEstimateGas.java index e5c38813..1700dbc7 100644 --- a/arithmetization/src/main/java/net/consensys/linea/rpc/linea/LineaEstimateGas.java +++ b/arithmetization/src/main/java/net/consensys/linea/rpc/linea/LineaEstimateGas.java @@ -188,7 +188,7 @@ private Wei getEstimatedPriorityFee( final Wei profitablePriorityFee = txProfitabilityCalculator.profitablePriorityFeePerGas( - transaction, profitabilityConf.estimateGasMinMargin(), minGasPrice, estimatedGasUsed); + transaction, profitabilityConf.estimateGasMinMargin(), estimatedGasUsed); if (profitablePriorityFee.greaterOrEqualThan(priorityFeeLowerBound)) { return profitablePriorityFee; diff --git a/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidator.java b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidator.java index 97d25fd5..0acf3975 100644 --- a/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidator.java +++ b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidator.java @@ -55,7 +55,6 @@ public Optional validateTransaction( "Txpool", transaction, profitabilityConf.txPoolMinMargin(), - besuConfiguration.getMinGasPrice(), calculateUpfrontGasPrice(transaction), transaction.getGasLimit()) ? Optional.empty() diff --git a/arithmetization/src/main/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelector.java b/arithmetization/src/main/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelector.java index 65e89d74..08c33e87 100644 --- a/arithmetization/src/main/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelector.java +++ b/arithmetization/src/main/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelector.java @@ -80,7 +80,6 @@ public TransactionSelectionResult evaluateTransactionPreProcessing( "PreProcessing", transaction, profitabilityConf.minMargin(), - minGasPrice, evaluationContext.getTransactionGasPrice(), gasLimit)) { return TX_UNPROFITABLE_UPFRONT; @@ -133,7 +132,6 @@ public TransactionSelectionResult evaluateTransactionPostProcessing( "PostProcessing", transaction, profitabilityConf.minMargin(), - evaluationContext.getMinGasPrice(), evaluationContext.getTransactionGasPrice(), gasUsed)) { rememberUnprofitable(transaction); diff --git a/arithmetization/src/test/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelectorTest.java b/arithmetization/src/test/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelectorTest.java index a4ce76ae..50e067bc 100644 --- a/arithmetization/src/test/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelectorTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelectorTest.java @@ -41,9 +41,8 @@ import org.junit.jupiter.api.Test; public class ProfitableTransactionSelectorTest { - private static final int VERIFICATION_GAS_COST = 1_200_000; - private static final int VERIFICATION_CAPACITY = 90_000; - private static final int GAS_PRICE_RATIO = 15; + private static final int FIXED_GAS_COST_KWEI = 1_200_000; + private static final int VARIABLE_GAS_COST_KWEI = 90_000; private static final double MIN_MARGIN = 1.0; private static final int UNPROFITABLE_CACHE_SIZE = 2; private static final int UNPROFITABLE_RETRY_LIMIT = 1; @@ -54,10 +53,9 @@ public class ProfitableTransactionSelectorTest { .build(); private final LineaProfitabilityConfiguration profitabilityConf = LineaProfitabilityCliOptions.create().toDomainObject().toBuilder() - .gasPriceRatio(GAS_PRICE_RATIO) .minMargin(MIN_MARGIN) - .verificationCapacity(VERIFICATION_CAPACITY) - .verificationGasCost(VERIFICATION_GAS_COST) + .fixedCostKWei(FIXED_GAS_COST_KWEI) + .variableCostKWei(VARIABLE_GAS_COST_KWEI) .build(); private TestableProfitableTransactionSelector transactionSelector; diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/ToyAccount.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/ToyAccount.java index c426c6c9..4dcf2480 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/ToyAccount.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/ToyAccount.java @@ -68,6 +68,11 @@ public Address getAddress() { return address; } + @Override + public boolean isStorageEmpty() { + return false; + } + @Override public Hash getAddressHash() { return addressHash.get(); diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/ToyExecutionEnvironment.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/ToyExecutionEnvironment.java index 20b688b1..1bec795e 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/ToyExecutionEnvironment.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/ToyExecutionEnvironment.java @@ -165,7 +165,6 @@ private void executeFrom(final ConflationSnapshot conflation) { for (Transaction tx : body.getTransactions()) { final TransactionProcessingResult result = transactionProcessor.processTransaction( - null, overridenToyWorld.updater(), (ProcessableBlockHeader) header, tx, @@ -198,7 +197,6 @@ private void execute() { for (Transaction tx : mockBlockBody.getTransactions()) { final TransactionProcessingResult result = transactionProcessor.processTransaction( - null, toyWorld.updater(), (ProcessableBlockHeader) header, tx, diff --git a/gradle.properties b/gradle.properties index ae5f5b73..1567f62c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ releaseVersion=0.1.4-SNAPSHOT -besuVersion=24.4-develop-a5a3eb8 +besuVersion=24.5-develop-0513bfa besuArtifactGroup=io.consensys.linea-besu distributionIdentifier=besu-sequencer-plugins distributionBaseUrl=https://artifacts.consensys.net/public/linea-besu/raw/names/linea-besu.tar.gz/versions/ diff --git a/reference-tests/src/test/java/net/consensys/linea/CorsetBlockProcessor.java b/reference-tests/src/test/java/net/consensys/linea/CorsetBlockProcessor.java index 2deddaba..fe5fb9d4 100644 --- a/reference-tests/src/test/java/net/consensys/linea/CorsetBlockProcessor.java +++ b/reference-tests/src/test/java/net/consensys/linea/CorsetBlockProcessor.java @@ -126,7 +126,6 @@ public BlockProcessingResult processBlock( zkTracer.traceStartBlock(blockHeader, blockBody); final TransactionProcessingResult result = transactionProcessor.processTransaction( - blockchain, worldStateUpdater, blockHeader, transaction, diff --git a/reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java b/reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java index 0aebb4a3..a3c3f6ef 100644 --- a/reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java +++ b/reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java @@ -175,7 +175,6 @@ public static void executeTest(final GeneralStateTestCaseEipSpec spec) { final TransactionProcessingResult result = processor.processTransaction( - blockchain, worldStateUpdater, blockHeader, transaction,