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

Preprocess batches from datastream to overcome slow resequence startup #250

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 1 deletion Dockerfile.local
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ADD . .
RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/tmp/go-build \
--mount=type=cache,target=/go/pkg/mod \
make BUILD_TAGS=nosqlite,noboltdb,nosilkworm cdk-erigon
make BUILD_TAGS=nosqlite,noboltdb,nosilkworm cdk-erigon integration

FROM docker.io/library/golang:1.21-alpine3.17 AS tools-builder
RUN apk --no-cache add build-base linux-headers git bash ca-certificates libstdc++
Expand Down Expand Up @@ -46,6 +46,7 @@ WORKDIR /home/erigon

## then give each binary its own layer
COPY --from=builder /app/build/bin/cdk-erigon /usr/local/bin/cdk-erigon
COPY --from=builder /app/build/bin/integration /usr/local/bin/integration

EXPOSE 8545 \
8551 \
Expand Down
9 changes: 7 additions & 2 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,11 @@ var (
Usage: "When enabled, the sequencer will automatically resequence unseen batches stored in data stream",
Value: false,
}
SequencerResequenceHaltOnBatchNumber = cli.Uint64Flag{
Name: "zkevm.sequencer-resequence-halt-on-batch-number",
Usage: "Halt the sequencer on this batch number when resequencing",
Value: 0,
}
SequencerResequenceStrict = cli.BoolFlag{
Name: "zkevm.sequencer-resequence-strict",
Usage: "Strictly resequence the rolledback batches",
Expand Down Expand Up @@ -1454,7 +1459,7 @@ var (
YieldSizeFlag = cli.Uint64Flag{
Name: "yieldsize",
Usage: "transaction count fetched from txpool each time",
Value: 1000,
Value: 30,
}
)

Expand Down Expand Up @@ -1945,7 +1950,7 @@ func setTxPool(ctx *cli.Context, fullCfg *ethconfig.Config) {

// For X Layer
setTxPoolXLayer(ctx, cfg)

purgeEvery := ctx.Duration(TxpoolPurgeEveryFlag.Name)
purgeDistance := ctx.Duration(TxpoolPurgeDistanceFlag.Name)

Expand Down
3 changes: 2 additions & 1 deletion eth/ethconfig/config_zkevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type Zk struct {
SequencerTimeoutOnEmptyTxPool time.Duration
SequencerHaltOnBatchNumber uint64
SequencerResequence bool
SequencerResequenceHaltOnBatchNumber uint64
SequencerResequenceStrict bool
SequencerResequenceReuseL1InfoIndex bool
ExecutorUrls []string
Expand Down Expand Up @@ -90,7 +91,7 @@ type Zk struct {

// For X Layer
XLayer XLayerConfig

InitialBatchCfgFile string
ACLPrintHistory int
InfoTreeUpdateInterval time.Duration
Expand Down
43 changes: 43 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,46 @@ test-1: stop all ## Runs group 1 e2e tests checking race conditions
sleep 3
docker ps -a
trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -failfast -race -v -p 1 -timeout 600s ../ci/e2e-1/...

DOCKER_COMPOSE_LRP := docker compose -f docker-compose-lrp.yml
DOCKER_LRP_UNWIND := xlayer-lrp-unwind
DOCKER_LRP_RESEQUENCE := xlayer-lrp-resequence

RUN_DOCKER_LRP_STATELESS_EXECUTOR := $(DOCKER_COMPOSE_LRP) up -d $(DOCKER_STATELESS_EXECUTOR)
RUN_DOCKER_LRP_L1_NETWORK := $(DOCKER_COMPOSE_LRP) up -d $(DOCKER_L1_NETWORK)
RUN_DOCKER_LRP_UNWIND := $(DOCKER_COMPOSE_LRP) up -d $(DOCKER_LRP_UNWIND)
RUN_DOCKER_LRP_RESEQUENCE := $(DOCKER_COMPOSE_LRP) up -d $(DOCKER_LRP_RESEQUENCE)

STOP_LRP := $(DOCKER_COMPOSE_LRP) down --remove-orphans; sleep 3; rm -rf data

.PHONY: lrp-run
lrp-run: build-docker
$(RUN_DOCKER_LRP_L1_NETWORK)
$(RUN_DOCKER_LRP_STATELESS_EXECUTOR)
sleep 3
@read -p "Enter unwind batch number: " UNWIND_BATCH_NO; \
read -p "Enter halt on batch number: " HALT_BATCH_NO; \
if [ "$(shell uname)" = "Darwin" ]; then \
sed -i '' "s/--unwind-batch-no=[0-9]*/--unwind-batch-no=$$UNWIND_BATCH_NO/" docker-compose-lrp.yml; \
sed -i '' "s/--zkevm.sequencer-resequence-halt-on-batch-number=[0-9]*/--zkevm.sequencer-resequence-halt-on-batch-number=$$HALT_BATCH_NO/" docker-compose-lrp.yml; \
else \
sed -i "s/--unwind-batch-no=[0-9]*/--unwind-batch-no=$$UNWIND_BATCH_NO/" docker-compose-lrp.yml; \
sed -i "s/--zkevm.sequencer-resequence-halt-on-batch-number=[0-9]*/--zkevm.sequencer-resequence-halt-on-batch-number=$$HALT_BATCH_NO/" docker-compose-lrp.yml; \
fi
$(RUN_DOCKER_LRP_UNWIND)
sleep 20
$(RUN_DOCKER_LRP_RESEQUENCE)

.PHONY: lrp-stop
lrp-stop:
$(STOP_LRP)

TARGET_LOG_FILE := filtered.log

.PHONY: lrp-check
lrp-check: ## Filter logs for LRP & Compute TPS & Check stateroots (configure debugToolsConfig.yaml)
docker logs $(DOCKER_LRP_RESEQUENCE) 2>&1 | grep "\[5/13 Execution\]" > $(TARGET_LOG_FILE)
sleep 3
python process_log.py $(TARGET_LOG_FILE)
sleep 3
go run ../zk/debug_tools/rpc-blockhashes-compare/main.go
Loading
Loading