Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Report discarded transactions to external service #69

Merged
merged 29 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d8fa72a
feat: Report discarded transactions to external endpoint
usmansaleem Aug 20, 2024
b5a998b
Merge remote-tracking branch 'upstream/main' into notify-dropped-txs
usmansaleem Aug 21, 2024
68fb015
Use PendingBlockHeader
usmansaleem Aug 21, 2024
da8a2cf
simplify discard condition
usmansaleem Aug 21, 2024
69710a0
feat: Make json-rpc call for discarded tx
usmansaleem Aug 27, 2024
957b3da
cli option for reporting rejected tx endpoint
usmansaleem Aug 27, 2024
d38b539
add spdx header
usmansaleem Aug 27, 2024
7a8d380
build: Add wiremock dependency
usmansaleem Sep 2, 2024
425f05c
Add unit test
usmansaleem Sep 4, 2024
0ce850d
Update json-rpc method and unit tests
usmansaleem Sep 4, 2024
5e01ae9
Adding JsonRpcManager
usmansaleem Sep 10, 2024
6fb16d6
Adding compileOnly okhttp dependency
usmansaleem Sep 10, 2024
4af7d4a
Updated JsonRPCManagerTests
usmansaleem Sep 10, 2024
5dcf745
Adding license header
usmansaleem Sep 10, 2024
3eb843d
Removing initial implementation of json rpc client
usmansaleem Sep 10, 2024
7a6a78a
Updating retry schedule logic
usmansaleem Sep 10, 2024
386008a
review suggestions
usmansaleem Sep 10, 2024
f32b379
Changing json-rpc ExecutorService to use virtual threads
usmansaleem Sep 10, 2024
140cb48
Adding comments to saveJsonToFile method
usmansaleem Sep 11, 2024
80de637
Use high-precision timestamp and a UUID to ensure uniqueness
usmansaleem Sep 11, 2024
3122a92
Use Duration and Instant instead of long
usmansaleem Sep 11, 2024
9199fdd
Updating logs entry in submitJsonRpcCall
usmansaleem Sep 11, 2024
45363cc
Update logs message. Move discarded json-rpc calls to separate direct…
usmansaleem Sep 11, 2024
a784018
Added unit test for processing json-rpc during start. Also introduced…
usmansaleem Sep 11, 2024
4cde321
Use Instant.now to generate timestamp
usmansaleem Sep 12, 2024
aabf838
Update changelog
usmansaleem Sep 12, 2024
c1975fa
Merge remote-tracking branch 'upstream/main' into notify-dropped-txs
usmansaleem Sep 12, 2024
900ba40
post merge
usmansaleem Sep 12, 2024
7ff3a55
Merge remote-tracking branch 'upstream/main' into notify-dropped-txs
usmansaleem Sep 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Next release
* feat: Report rejected transactions to an external service [#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)
* bump Linea-Besu version to 24.9-delivery32 [#71](https://github.com/Consensys/linea-sequencer/pull/71)
Expand Down
2 changes: 2 additions & 0 deletions gradle/common-dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ dependencies {

testImplementation 'org.mockito:mockito-core'
testImplementation 'org.mockito:mockito-junit-jupiter'

testImplementation "org.wiremock:wiremock"
}
4 changes: 4 additions & 0 deletions gradle/dependency-management.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ dependencyManagement {
entry 'picocli-codegen'
}

dependency 'com.squareup.okhttp3:okhttp:4.12.0'

dependencySet(group: 'io.tmio', version: '2.4.2') {
entry 'tuweni-bytes'
entry 'tuweni-net'
Expand Down Expand Up @@ -157,5 +159,7 @@ dependencyManagement {
entry 'core'
entry 'crypto'
}

dependency "org.wiremock:wiremock:3.9.1"
}
}
4 changes: 4 additions & 0 deletions sequencer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ dependencies {

compileOnly 'io.vertx:vertx-core'

compileOnly 'com.squareup.okhttp3:okhttp'

implementation project(":native:compress")

implementation 'com.fasterxml.jackson.core:jackson-databind'
Expand All @@ -68,6 +70,8 @@ dependencies {
testImplementation "${besuArtifactGroup}.internal:core"
testImplementation "${besuArtifactGroup}.internal:rlp"
testImplementation "${besuArtifactGroup}.internal:core"
testImplementation "${besuArtifactGroup}:plugin-api"
testImplementation "org.awaitility:awaitility"

// workaround for bug https://github.com/dnsjava/dnsjava/issues/329, remove when upgraded upstream
testImplementation 'dnsjava:dnsjava:3.6.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

package net.consensys.linea.config;

import java.net.URI;

import com.google.common.base.MoreObjects;
import jakarta.validation.constraints.Positive;
import net.consensys.linea.plugins.LineaCliOptions;
Expand All @@ -39,6 +41,8 @@ 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 @@ -82,6 +86,13 @@ 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 @@ -107,6 +118,7 @@ public static LineaTransactionSelectorCliOptions fromConfig(
options.maxGasPerBlock = config.maxGasPerBlock();
options.unprofitableCacheSize = config.unprofitableCacheSize();
options.unprofitableRetryLimit = config.unprofitableRetryLimit();
options.rejectedTxEndpoint = config.rejectedTxEndpoint();
return options;
}

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

Expand All @@ -134,6 +147,7 @@ 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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

package net.consensys.linea.config;

import java.net.URI;

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

Expand All @@ -25,5 +27,6 @@ public record LineaTransactionSelectorConfiguration(
int overLinesLimitCacheSize,
long maxGasPerBlock,
int unprofitableCacheSize,
int unprofitableRetryLimit)
int unprofitableRetryLimit,
URI rejectedTxEndpoint)
implements LineaOptionsConfiguration {}
Loading
Loading