Skip to content

Commit 166a12f

Browse files
committed
everything works
1 parent a0a129d commit 166a12f

33 files changed

+1097
-482
lines changed

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ start-env:
3838
[ "$$(docker compose -f $(COMPOSE_FILE) ps -q sequencer | xargs docker inspect -f '{{.State.Health.Status}}')" != "healthy" ]; }; do \
3939
sleep 2; \
4040
echo "Checking health status of l1-el-node and sequencer..."; \
41-
done
41+
done; \
42+
if [ "$(SKIP_L1_L2_NODE_HEALTH_CHECK)" = "false" ]; then \
43+
echo "Container health checks passed"; \
44+
echo "Performing network readiness verification..."; \
45+
./scripts/verify-network-ready.sh || { echo "❌ Network readiness verification failed"; exit 1; }; \
46+
fi
4247
if [ "$(SKIP_CONTRACTS_DEPLOYMENT)" = "true" ]; then \
4348
echo "Skipping contracts deployment"; \
4449
else \
@@ -80,6 +85,13 @@ start-env-with-staterecovery:
8085
start-env-with-rln:
8186
make start-env COMPOSE_FILE=docker/compose-tracing-v2-rln.yml LINEA_PROTOCOL_CONTRACTS_ONLY=true STATUS_NETWORK_CONTRACTS_ENABLED=true
8287

88+
start-env-with-rln-and-contracts:
89+
@echo "Starting complete RLN environment with automated contract deployment..."
90+
make start-env COMPOSE_FILE=docker/compose-tracing-v2-rln.yml LINEA_PROTOCOL_CONTRACTS_ONLY=true STATUS_NETWORK_CONTRACTS_ENABLED=true
91+
@echo "Environment started. Beginning contract deployment with automatic RLN handling..."
92+
make deploy-contracts LINEA_PROTOCOL_CONTRACTS_ONLY=true STATUS_NETWORK_CONTRACTS_ENABLED=true
93+
@echo "Complete RLN environment with contracts is ready!"
94+
8395
staterecovery-replay-from-block: L1_ROLLUP_CONTRACT_ADDRESS:=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9
8496
staterecovery-replay-from-block: STATERECOVERY_OVERRIDE_START_BLOCK_NUMBER:=1
8597
staterecovery-replay-from-block:

besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRlnValidatorCliOptions.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ public class LineaRlnValidatorCliOptions implements LineaCliOptions {
7777
arity = "1")
7878
private long proofWaitTimeoutMs = 1000L; // 1 second (increased from 200ms)
7979

80+
@CommandLine.Option(
81+
names = "--plugin-linea-rln-epoch-mode",
82+
description =
83+
"Epoch mode used to compute the RLN external nullifier (options: BLOCK, TIMESTAMP_1H, TEST, FIXED_FIELD_ELEMENT; default: ${DEFAULT-VALUE})",
84+
arity = "1")
85+
private String epochMode = LineaRlnValidatorConfiguration.V1_DEFAULT.defaultEpochForQuota();
86+
8087
private LineaRlnValidatorCliOptions() {}
8188

8289
public static LineaRlnValidatorCliOptions create() {
@@ -126,7 +133,7 @@ public LineaRlnValidatorConfiguration toDomainObject() {
126133
timeoutsMs, // karmaServiceTimeoutMs
127134
true, // exponentialBackoffEnabled (good default)
128135
60000L, // maxBackoffDelayMs (1 min, good default)
129-
"TIMESTAMP_1H", // defaultEpochForQuota (good default)
136+
epochMode, // defaultEpochForQuota (configurable via CLI)
130137
Optional.empty() // rlnJniLibPath (use system path)
131138
);
132139
}

besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaEstimateGas.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,9 @@ public LineaEstimateGas.Response execute(final PluginRpcRequest request) {
250250
if (karmaInfoOpt.isPresent()) {
251251
KarmaInfo karmaInfo = karmaInfoOpt.get();
252252
boolean hasQuotaAvailable = karmaInfo.epochTxCount() < karmaInfo.dailyQuota();
253-
boolean isEligibleTier =
254-
!"Unknown".equals(karmaInfo.tier()) && karmaInfo.dailyQuota() > 0;
253+
// Consider eligibility based on positive quota. Tier name may be unspecified in some
254+
// environments (e.g., mock service), so avoid relying on tier label.
255+
boolean isEligibleTier = karmaInfo.dailyQuota() > 0;
255256

256257
log.debug(
257258
"[{}] Karma info for sender {}: Tier={}, TxCount={}, Quota={}, HasQuota={}, IsEligibleTier={}",

besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/services/LineaEstimateGasEndpointPlugin.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class LineaEstimateGasEndpointPlugin extends AbstractLineaRequiredPlugin
2525

2626
private TransactionSimulationService transactionSimulationService;
2727
private LineaEstimateGas lineaEstimateGasMethod;
28+
private net.consensys.linea.sequencer.txpoolvalidation.shared.SharedServiceManager sharedServiceManager;
2829

2930
/**
3031
* Register the RPC service.
@@ -54,12 +55,19 @@ public void doRegister(final ServiceManager serviceManager) {
5455
@Override
5556
public void beforeExternalServices() {
5657
super.beforeExternalServices();
58+
// Initialize shared gasless services (deny list, karma client) so estimateGas can use them
59+
sharedServiceManager =
60+
new net.consensys.linea.sequencer.txpoolvalidation.shared.SharedServiceManager(
61+
rlnValidatorConfiguration(), lineaRpcConfiguration());
62+
5763
lineaEstimateGasMethod.init(
5864
lineaRpcConfiguration(),
5965
transactionPoolValidatorConfiguration(),
6066
profitabilityConfiguration(),
6167
l1L2BridgeSharedConfiguration(),
62-
tracerConfiguration());
68+
tracerConfiguration(),
69+
sharedServiceManager.getDenyListManager(),
70+
sharedServiceManager.getKarmaServiceClient());
6371
}
6472

6573
@Override
@@ -68,4 +76,15 @@ public void doStart() {
6876
throw new IllegalArgumentException("L1L2 bridge settings have not been defined.");
6977
}
7078
}
79+
80+
@Override
81+
public void stop() {
82+
super.stop();
83+
if (sharedServiceManager != null) {
84+
try {
85+
sharedServiceManager.close();
86+
} catch (java.io.IOException ignored) {
87+
}
88+
}
89+
}
7190
}

besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public LineaTransactionPoolValidatorFactory(
8787
public PluginTransactionPoolValidator createTransactionValidator() {
8888
final var validatorsList = new ArrayList<PluginTransactionPoolValidator>();
8989

90+
// Removed GaslessFeeBypassValidator to simplify and avoid redundant logic
91+
9092
validatorsList.add(new AllowedAddressValidator(denied));
9193
validatorsList.add(new GasLimitValidator(txPoolValidatorConf));
9294
validatorsList.add(new CalldataValidator(txPoolValidatorConf));

besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/RlnProverForwarderValidator.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,14 @@ public Optional<String> validateTransaction(
224224
}
225225

226226
localTransactionCount.incrementAndGet();
227-
LOG.debug("Forwarding local transaction to RLN prover: {}", transaction.getHash());
227+
LOG.debug(
228+
"Forwarding local transaction to RLN prover: {} from {} (legacyGasPrice={}, maxFee={}, maxPrio={}, chainId={})",
229+
transaction.getHash().toHexString(),
230+
transaction.getSender().toHexString(),
231+
transaction.getGasPrice().map(Object::toString).orElse("-"),
232+
transaction.getMaxFeePerGas().map(Object::toString).orElse("-"),
233+
transaction.getMaxPriorityFeePerGas().map(Object::toString).orElse("-"),
234+
transaction.getChainId().map(Object::toString).orElse("-"));
228235

229236
// GASLESS KARMA CHECK: Check if user is eligible for gasless transactions
230237
if (karmaServiceClient != null && karmaServiceClient.isAvailable()) {
@@ -312,7 +319,11 @@ public Optional<String> validateTransaction(
312319

313320
SendTransactionRequest request = requestBuilder.build();
314321

315-
LOG.debug("Sending transaction to RLN prover: {}", request);
322+
LOG.debug(
323+
"Sending transaction to RLN prover: txHash={}, sender={}, chainId={}",
324+
transaction.getHash().toHexString(),
325+
transaction.getSender().toHexString(),
326+
transaction.getChainId().map(Object::toString).orElse("-"));
316327
SendTransactionReply reply = blockingStub.sendTransaction(request);
317328

318329
if (reply.getResult()) {

besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/RlnVerifierValidator.java

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -844,24 +844,37 @@ public Optional<String> validateTransaction(
844844
return Optional.empty(); // RLN validation is disabled
845845
}
846846

847+
// Priority txs (configured via tx-pool-priority-senders) bypass RLN checks.
848+
// This is required to allow infrastructure/deployment accounts to operate
849+
// regardless of base-fee configuration.
850+
if (hasPriority) {
851+
LOG.info(
852+
"[RLN] Bypass RLN validation for priority transaction {} from {}",
853+
transaction.getHash().toHexString(),
854+
transaction.getSender().toHexString());
855+
return Optional.empty();
856+
}
857+
847858
final Address sender = transaction.getSender();
848859
final org.hyperledger.besu.datatypes.Hash txHash = transaction.getHash();
849860
final String txHashString = txHash.toHexString();
850861

862+
// Compute effective gas price (0 indicates gasless intent)
863+
final Wei effectiveGasPrice =
864+
transaction
865+
.getGasPrice()
866+
.map(q -> Wei.of(q.getAsBigInteger()))
867+
.orElseGet(
868+
() ->
869+
transaction
870+
.getMaxFeePerGas()
871+
.map(q -> Wei.of(q.getAsBigInteger()))
872+
.orElse(Wei.ZERO));
873+
851874
// 1. Deny List Check
852875
if (denyListManager.isDenied(sender)) {
853876
// User is actively denied. Check for premium gas.
854877
long premiumThresholdWei = rlnConfig.premiumGasPriceThresholdWei();
855-
Wei effectiveGasPrice =
856-
transaction
857-
.getGasPrice()
858-
.map(q -> Wei.of(q.getAsBigInteger()))
859-
.orElseGet(
860-
() ->
861-
transaction
862-
.getMaxFeePerGas()
863-
.map(q -> Wei.of(q.getAsBigInteger()))
864-
.orElse(Wei.ZERO));
865878

866879
if (effectiveGasPrice.getAsBigInteger().compareTo(BigInteger.valueOf(premiumThresholdWei))
867880
>= 0) {
@@ -871,6 +884,8 @@ public Optional<String> validateTransaction(
871884
sender.toHexString(),
872885
effectiveGasPrice,
873886
premiumThresholdWei);
887+
// Allow immediately - premium gas paid
888+
return Optional.empty();
874889
} else {
875890
LOG.warn(
876891
"Sender {} is on deny list. Transaction {} rejected. Effective gas price {} Wei < {} Wei.",
@@ -882,15 +897,32 @@ public Optional<String> validateTransaction(
882897
}
883898
}
884899

900+
// If this is a paid-gas transaction (not gasless), skip RLN proof requirement
901+
if (!effectiveGasPrice.isZero()) {
902+
LOG.debug(
903+
"Transaction {} has non-zero effective gas price ({} Wei). Skipping RLN proof checks.",
904+
txHashString,
905+
effectiveGasPrice);
906+
return Optional.empty();
907+
}
908+
885909
// 2. RLN Proof Verification (via gRPC Cache) - with non-blocking wait
886-
LOG.debug("Attempting to fetch RLN proof for txHash: {} from cache.", txHashString);
910+
LOG.debug(
911+
"Attempting to fetch RLN proof for txHash: {} from cache. isLocal={}, hasPriority={}",
912+
txHashString,
913+
isLocal,
914+
hasPriority);
887915
CachedProof proof = waitForProofInCache(txHashString);
888916

889917
if (proof == null) {
890918
LOG.warn(
891-
"RLN proof not found in cache after timeout for txHash: {}. Timeout: {}ms",
919+
"RLN proof not found in cache after timeout for txHash: {}. Timeout: {}ms (sender={}, gasPrice={}, maxFee={}, maxPrio={})",
892920
txHashString,
893-
rlnConfig.rlnProofLocalWaitTimeoutMs());
921+
rlnConfig.rlnProofLocalWaitTimeoutMs(),
922+
sender.toHexString(),
923+
transaction.getGasPrice().map(Object::toString).orElse("-"),
924+
transaction.getMaxFeePerGas().map(Object::toString).orElse("-"),
925+
transaction.getMaxPriorityFeePerGas().map(Object::toString).orElse("-"));
894926
return Optional.of("RLN proof not found in cache after timeout.");
895927
}
896928
LOG.debug("RLN proof found in cache for txHash: {}", txHashString);

build-rln-enabled-sequencer.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ TIMESTAMP=$(date +%Y%m%d%H%M%S)
205205
BESU_IMAGE_TAG="linea-besu-minimal-rln:${TIMESTAMP}"
206206

207207
echo -e "${YELLOW}🔨 Building Docker image...${NC}"
208-
docker build -t "$BESU_IMAGE_TAG" .
208+
docker build --platform linux/amd64 -t "$BESU_IMAGE_TAG" .
209209

210210
echo -e "${GREEN}✅ Minimal custom Besu image built: $BESU_IMAGE_TAG${NC}"
211211

212212
echo -e "${BLUE}🐳 Building RLN Prover Docker image...${NC}"
213213
cd "$STATUS_RLN_PROVER_DIR"
214214
RLN_PROVER_TAG="status-rln-prover:${TIMESTAMP}"
215-
docker build -t "$RLN_PROVER_TAG" .
215+
docker build --platform linux/amd64 -t "$RLN_PROVER_TAG" .
216216

217217
echo -e "${GREEN}✅ RLN Prover image built: $RLN_PROVER_TAG${NC}"
218218

contracts/deploy/13_deploy_StatusNetwork_StakeManager.ts

Lines changed: 0 additions & 62 deletions
This file was deleted.

contracts/deploy/14_deploy_StatusNetwork_VaultFactory.ts

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)