Skip to content

Commit

Permalink
Release 0.1.4-test35
Browse files Browse the repository at this point in the history
# Conflicts:
#	gradle.properties
#	sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorFactory.java
#	sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java
#	sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidatorTest.java
  • Loading branch information
fab-10 committed Oct 8, 2024
2 parents 67d1e2d + 02a2f6b commit c6f356f
Show file tree
Hide file tree
Showing 35 changed files with 797 additions and 226 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Changelog

## Next release
* feat: Report rejected transactions to an external service [#69](https://github.com/Consensys/linea-sequencer/pull/69)
* feat: Report rejected transactions to an external service for validators used by LineaTransactionPoolValidatorPlugin [#85](https://github.com/Consensys/linea-sequencer/pull/85)
* feat: Report rejected transactions to an external service for LineaTransactionSelector used by LineaTransactionSelectorPlugin [#69](https://github.com/Consensys/linea-sequencer/pull/69)

## 0.6.0-rc1.1
* bump linea-arithmetization version to 0.6.0-rc1 [#71](https://github.com/Consensys/linea-sequencer/pull/71)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public List<String> getTestCliOptions() {
@Override
@BeforeEach
public void setup() throws Exception {
minerNode = besu.createMinerNodeWithExtraCliOptions("miner1", getTestCliOptions());
cluster.start(minerNode);
super.setup();
minerNode.execute(minerTransactions.minerStop());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,14 @@ private BesuNode createCliqueNodeWithExtraCliOptionsAndRpcApis(
.jsonRpcTxPool()
.genesisConfigProvider(
validators -> Optional.of(provideGenesisConfig(validators, cliqueOptions)))
.extraCLIOptions(extraCliOptions);
.extraCLIOptions(extraCliOptions)
.requestedPlugins(
List.of(
"LineaExtraDataPlugin",
"LineaEstimateGasEndpointPlugin",
"LineaSetExtraDataEndpointPlugin",
"LineaTransactionPoolValidatorPlugin",
"LineaTransactionSelectorPlugin"));

return besu.create(nodeConfBuilder.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.hyperledger.besu.tests.acceptance.dsl.condition.login.LoginConditions;
import org.hyperledger.besu.tests.acceptance.dsl.condition.net.NetConditions;
import org.hyperledger.besu.tests.acceptance.dsl.condition.perm.PermissioningConditions;
import org.hyperledger.besu.tests.acceptance.dsl.condition.priv.PrivConditions;
import org.hyperledger.besu.tests.acceptance.dsl.condition.process.ExitedWithCode;
import org.hyperledger.besu.tests.acceptance.dsl.condition.txpool.TxPoolConditions;
import org.hyperledger.besu.tests.acceptance.dsl.condition.web3.Web3Conditions;
Expand All @@ -54,7 +53,6 @@
import org.hyperledger.besu.tests.acceptance.dsl.transaction.miner.MinerTransactions;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.net.NetTransactions;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.perm.PermissioningTransactions;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyTransactions;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.txpool.TxPoolTransactions;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.web3.Web3Transactions;
import org.junit.jupiter.api.AfterEach;
Expand Down Expand Up @@ -88,8 +86,6 @@ public class AcceptanceTestBase {
protected final PermissioningTransactions permissioningTransactions;
protected final MinerTransactions minerTransactions;
protected final Web3Conditions web3;
protected final PrivConditions priv;
protected final PrivacyTransactions privacyTransactions;
protected final TxPoolConditions txPoolConditions;
protected final TxPoolTransactions txPoolTransactions;
protected final ExitedWithCode exitedSuccessfully;
Expand All @@ -104,7 +100,6 @@ protected AcceptanceTestBase() {
bftTransactions = new BftTransactions();
accountTransactions = new AccountTransactions(accounts);
permissioningTransactions = new PermissioningTransactions();
privacyTransactions = new PrivacyTransactions();
contractTransactions = new ContractTransactions();
minerTransactions = new MinerTransactions();

Expand All @@ -116,7 +111,6 @@ protected AcceptanceTestBase() {
net = new NetConditions(new NetTransactions());
cluster = new Cluster(net);
perm = new PermissioningConditions(permissioningTransactions);
priv = new PrivConditions(privacyTransactions);
admin = new AdminConditions(adminTransactions);
web3 = new Web3Conditions(new Web3Transactions());
besu = new BesuNodeFactory();
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
releaseVersion=0.1.4-test34
besuVersion=24.9-delivery32
releaseVersion=0.1.4-test35
besuVersion=24.10-delivery34
besuArtifactGroup=io.consensys.linea-besu
distributionIdentifier=besu-sequencer-plugins
distributionBaseUrl=https://artifacts.consensys.net/public/linea-besu/raw/names/linea-besu.tar.gz/versions/
distributionBaseUrl=https://artifacts.consensys.net/public/linea-besu/raw/names/linea-besu.tar.gz/versions/
1 change: 1 addition & 0 deletions gradle/dependency-management.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ dependencyManagement {
entry "dsl"
entry "eth"
entry "rlp"
entry "besu"
}

dependencySet(group: 'ch.qos.logback', version: '1.5.6') {
Expand Down
3 changes: 2 additions & 1 deletion sequencer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ dependencies {
testImplementation "${besuArtifactGroup}.internal:algorithms"
testImplementation "${besuArtifactGroup}.internal:core"
testImplementation "${besuArtifactGroup}.internal:rlp"
testImplementation "${besuArtifactGroup}.internal:core"
testImplementation "${besuArtifactGroup}:plugin-api"
testImplementation "${besuArtifactGroup}.internal:besu"
testImplementation "info.picocli:picocli"
testImplementation "org.awaitility:awaitility"

// workaround for bug https://github.com/dnsjava/dnsjava/issues/329, remove when upgraded upstream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import net.consensys.linea.compress.LibCompress;
import net.consensys.linea.config.LineaProfitabilityCliOptions;
import net.consensys.linea.config.LineaProfitabilityConfiguration;
import net.consensys.linea.config.LineaRejectedTxReportingCliOptions;
import net.consensys.linea.config.LineaRejectedTxReportingConfiguration;
import net.consensys.linea.config.LineaRpcCliOptions;
import net.consensys.linea.config.LineaRpcConfiguration;
import net.consensys.linea.config.LineaTracerCliOptions;
Expand Down Expand Up @@ -66,6 +68,9 @@ public Map<String, LineaOptionsPluginConfiguration> getLineaPluginConfigMap() {
configMap.put(
LineaTracerCliOptions.CONFIG_KEY, LineaTracerCliOptions.create().asPluginConfig());

configMap.put(
LineaRejectedTxReportingCliOptions.CONFIG_KEY,
LineaRejectedTxReportingCliOptions.create().asPluginConfig());
return configMap;
}

Expand Down Expand Up @@ -94,6 +99,11 @@ public LineaTracerConfiguration tracerConfiguration() {
getConfigurationByKey(LineaTracerCliOptions.CONFIG_KEY).optionsConfig();
}

public LineaRejectedTxReportingConfiguration rejectedTxReportingConfiguration() {
return (LineaRejectedTxReportingConfiguration)
getConfigurationByKey(LineaRejectedTxReportingCliOptions.CONFIG_KEY).optionsConfig();
}

@Override
public void start() {
super.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
import lombok.extern.slf4j.Slf4j;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.services.BlockchainService;

@Slf4j
public abstract class AbstractLineaRequiredPlugin extends AbstractLineaPrivateOptionsPlugin {
protected BlockchainService blockchainService;

/**
* Linea plugins extending this class will halt startup of Besu in case of exception during
Expand All @@ -34,7 +36,15 @@ public abstract class AbstractLineaRequiredPlugin extends AbstractLineaPrivateOp
public void register(final BesuContext context) {
super.register(context);
try {
log.info("Registering Linea plugin " + this.getClass().getName());
log.info("Registering Linea plugin {}", this.getClass().getName());

blockchainService =
context
.getService(BlockchainService.class)
.orElseThrow(
() ->
new RuntimeException(
"Failed to obtain BlockchainService from the BesuContext."));

doRegister(context);

Expand All @@ -52,4 +62,21 @@ public void register(final BesuContext context) {
* @param context
*/
public abstract void doRegister(final BesuContext context);

@Override
public void beforeExternalServices() {
super.beforeExternalServices();

blockchainService
.getChainId()
.ifPresentOrElse(
chainId -> {
if (chainId.signum() <= 0) {
throw new IllegalArgumentException("Chain id must be greater than zero.");
}
},
() -> {
throw new IllegalArgumentException("Chain id required");
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright Consensys Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

package net.consensys.linea.config;

/** Linea node type that is used when reporting rejected transactions. */
public enum LineaNodeType {
SEQUENCER,
RPC,
P2P
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* Copyright Consensys Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package net.consensys.linea.config;

import java.net.URL;

import com.google.common.base.MoreObjects;
import net.consensys.linea.LineaCliOptions;
import picocli.CommandLine.Option;

/** The Linea Rejected Transaction Reporting CLI options. */
public class LineaRejectedTxReportingCliOptions implements LineaCliOptions {
/**
* The configuration key used in AbstractLineaPrivateOptionsPlugin to identify the cli options.
*/
public static final String CONFIG_KEY = "rejected-tx-reporting-config";

/** The rejected transaction endpoint. */
public static final String REJECTED_TX_ENDPOINT = "--plugin-linea-rejected-tx-endpoint";

/** The Linea node type. */
public static final String LINEA_NODE_TYPE = "--plugin-linea-node-type";

@Option(
names = {REJECTED_TX_ENDPOINT},
hidden = true,
paramLabel = "<URL>",
description =
"Endpoint URI for reporting rejected transactions. Specify a valid URI to enable reporting.")
URL rejectedTxEndpoint = null;

@Option(
names = {LINEA_NODE_TYPE},
hidden = true,
paramLabel = "<NODE_TYPE>",
description =
"Linea Node type to use when reporting rejected transactions. (Valid values: ${COMPLETION-CANDIDATES})")
LineaNodeType lineaNodeType = null;

/** Default constructor. */
private LineaRejectedTxReportingCliOptions() {}

/**
* Create Linea Rejected Transaction Reporting CLI options.
*
* @return the Linea Rejected Transaction Reporting CLI options
*/
public static LineaRejectedTxReportingCliOptions create() {
return new LineaRejectedTxReportingCliOptions();
}

/**
* Instantiates a new Linea rejected tx reporting cli options from Configuration object
*
* @param config An instance of LineaRejectedTxReportingConfiguration
*/
public static LineaRejectedTxReportingCliOptions fromConfig(
final LineaRejectedTxReportingConfiguration config) {
final LineaRejectedTxReportingCliOptions options = create();
options.rejectedTxEndpoint = config.rejectedTxEndpoint();
options.lineaNodeType = config.lineaNodeType();
return options;
}

@Override
public LineaRejectedTxReportingConfiguration toDomainObject() {
// perform validation here, if endpoint is specified then node type is required.
// We can ignore node type if endpoint is not specified.
if (rejectedTxEndpoint != null && lineaNodeType == null) {
throw new IllegalArgumentException(
"Error: Missing required argument(s): " + LINEA_NODE_TYPE + "=<NODE_TYPE>");
}

return LineaRejectedTxReportingConfiguration.builder()
.rejectedTxEndpoint(rejectedTxEndpoint)
.lineaNodeType(lineaNodeType)
.build();
}

@Override
public String toString() {

return MoreObjects.toStringHelper(this)
.add(REJECTED_TX_ENDPOINT, rejectedTxEndpoint)
.add(LINEA_NODE_TYPE, lineaNodeType)
.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Consensys Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

package net.consensys.linea.config;

import java.net.URL;

import lombok.Builder;
import net.consensys.linea.LineaOptionsConfiguration;

/** Linea Rejected Transactions Reporting Configuration */
@Builder(toBuilder = true)
public record LineaRejectedTxReportingConfiguration(
URL rejectedTxEndpoint, LineaNodeType lineaNodeType) implements LineaOptionsConfiguration {}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

package net.consensys.linea.config;

import java.net.URI;

import com.google.common.base.MoreObjects;
import jakarta.validation.constraints.Positive;
import net.consensys.linea.LineaCliOptions;
Expand All @@ -41,8 +39,6 @@ public class LineaTransactionSelectorCliOptions implements LineaCliOptions {
public static final String UNPROFITABLE_RETRY_LIMIT = "--plugin-linea-unprofitable-retry-limit";
public static final int DEFAULT_UNPROFITABLE_RETRY_LIMIT = 10;

public static final String REJECTED_TX_ENDPOINT = "--plugin-linea-rejected-tx-endpoint";

@Positive
@CommandLine.Option(
names = {MAX_BLOCK_CALLDATA_SIZE},
Expand Down Expand Up @@ -86,13 +82,6 @@ public class LineaTransactionSelectorCliOptions implements LineaCliOptions {
"Max number of unprofitable transactions we retry on each block creation (default: ${DEFAULT-VALUE})")
private int unprofitableRetryLimit = DEFAULT_UNPROFITABLE_RETRY_LIMIT;

@CommandLine.Option(
names = {REJECTED_TX_ENDPOINT},
hidden = true,
paramLabel = "<URI>",
description = "Endpoint URI for reporting rejected transactions (default: ${DEFAULT-VALUE})")
private URI rejectedTxEndpoint = null;

private LineaTransactionSelectorCliOptions() {}

/**
Expand All @@ -118,7 +107,6 @@ public static LineaTransactionSelectorCliOptions fromConfig(
options.maxGasPerBlock = config.maxGasPerBlock();
options.unprofitableCacheSize = config.unprofitableCacheSize();
options.unprofitableRetryLimit = config.unprofitableRetryLimit();
options.rejectedTxEndpoint = config.rejectedTxEndpoint();
return options;
}

Expand All @@ -135,7 +123,6 @@ public LineaTransactionSelectorConfiguration toDomainObject() {
.maxGasPerBlock(maxGasPerBlock)
.unprofitableCacheSize(unprofitableCacheSize)
.unprofitableRetryLimit(unprofitableRetryLimit)
.rejectedTxEndpoint(rejectedTxEndpoint)
.build();
}

Expand All @@ -147,7 +134,6 @@ public String toString() {
.add(MAX_GAS_PER_BLOCK, maxGasPerBlock)
.add(UNPROFITABLE_CACHE_SIZE, unprofitableCacheSize)
.add(UNPROFITABLE_RETRY_LIMIT, unprofitableRetryLimit)
.add(REJECTED_TX_ENDPOINT, rejectedTxEndpoint)
.toString();
}
}
Loading

0 comments on commit c6f356f

Please sign in to comment.