Skip to content

Commit

Permalink
Remove circuit rows consumption check (#146)
Browse files Browse the repository at this point in the history
* remove pipeline

* remove ccc related code

* chunks named to block contexts

* bring back config MaxTxPerBlock

* solve config compatibility issue

* add workflows for cherry-pick 0.6.x

---------

Co-authored-by: fletcher.fan <[email protected]>
  • Loading branch information
FletcherMan and fletcher.fan authored Sep 28, 2024
1 parent e58ac01 commit d5897cc
Show file tree
Hide file tree
Showing 57 changed files with 503 additions and 7,701 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/cherry_pick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ jobs:
branch: release/0.5.x
labels: |
cherry-pick

cherry_pick_release_0_6_x:
runs-on: ubuntu-latest
name: Cherry pick into release/0.6.x
if: ${{ contains(github.event.pull_request.labels.*.name, 'release/0.6.x') && github.event.pull_request.merged == true }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cherry pick into release/0.6.x
uses: carloscastrojumo/[email protected]
with:
branch: release/0.6.x
labels: |
cherry-pick
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56 changes: 12 additions & 44 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,32 @@
ARG COMMIT=""
ARG VERSION=""
ARG BUILDNUM=""
ARG MORPH_LIB_PATH=/morph/lib

# Build libzkp dependency
FROM scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03 as chef
WORKDIR app

FROM chef as planner
COPY ./rollup/circuitcapacitychecker/libzkp/ .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef as zkp-builder
COPY ./rollup/circuitcapacitychecker/libzkp/rust-toolchain ./
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json

COPY ./rollup/circuitcapacitychecker/libzkp .
RUN cargo clean
RUN cargo build --release

# Build Geth in a stock Go builder container
FROM scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03 as builder

ADD . /go-ethereum

ARG MORPH_LIB_PATH
FROM golang:1.21-alpine as builder

RUN mkdir -p $MORPH_LIB_PATH
RUN apk add --no-cache gcc musl-dev linux-headers git

COPY --from=zkp-builder /app/target/release/libzkp.so $MORPH_LIB_PATH
# Get dependencies - will also be cached if we won't change go.mod/go.sum
COPY go.mod /go-ethereum/
COPY go.sum /go-ethereum/
RUN cd /go-ethereum && go mod download

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MORPH_LIB_PATH
ENV CGO_LDFLAGS="-L$MORPH_LIB_PATH -Wl,-rpath,$MORPH_LIB_PATH"

RUN cd /go-ethereum && env GO111MODULE=on go run build/ci.go install -buildtags circuit_capacity_checker ./cmd/geth
ADD . /go-ethereum
RUN cd /go-ethereum && go run build/ci.go install ./cmd/geth

# Pull Geth into a second stage deploy alpine container
FROM ubuntu:20.04

RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates
FROM alpine:latest

RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/

ARG MORPH_LIB_PATH

RUN mkdir -p $MORPH_LIB_PATH

COPY --from=zkp-builder /app/target/release/libzkp.so $MORPH_LIB_PATH

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MORPH_LIB_PATH
ENV CGO_LDFLAGS="-ldl -L$MORPH_LIB_PATH -Wl,-rpath,$MORPH_LIB_PATH"

EXPOSE 8545 8546 30303 30303/udp
ENTRYPOINT ["geth"]

# Add some metadata labels to help programatic image consumption
# Add some metadata labels to help programmatic image consumption
ARG COMMIT=""
ARG VERSION=""
ARG BUILDNUM=""

LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM"
LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM"
25 changes: 0 additions & 25 deletions Dockerfile.mockccc

This file was deleted.

20 changes: 0 additions & 20 deletions Dockerfile.mockccc.alpine

This file was deleted.

18 changes: 2 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,11 @@ GOBIN = ./build/bin
GO ?= latest
GORUN = env GO111MODULE=on go run

libzkp:
cd $(PWD)/rollup/circuitcapacitychecker/libzkp && make libzkp

nccc_geth: ## geth without circuit capacity checker
geth:
$(GORUN) build/ci.go install ./cmd/geth
@echo "Done building."
@echo "Run \"$(GOBIN)/geth\" to launch geth."

geth: libzkp
$(GORUN) build/ci.go install -buildtags circuit_capacity_checker ./cmd/geth
@echo "Done building."
@echo "Run \"$(GOBIN)/geth\" to launch geth."

all:
$(GORUN) build/ci.go install

Expand Down Expand Up @@ -79,11 +71,5 @@ image:
docker build -f Dockerfile -t morph-geth:latest .

docker:
docker build --platform linux/x86_64 -t morph/l2geth:latest ./ -f Dockerfile

mockccc_docker:
docker build --platform linux/x86_64 -t morph/l2geth:latest ./ -f Dockerfile.mockccc

mockccc_alpine_docker:
docker build -t morph/l2geth:latest ./ -f Dockerfile.mockccc.alpine
docker build -t morph/l2geth:latest ./ -f Dockerfile

18 changes: 1 addition & 17 deletions MakefileEc2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,15 @@

GORUN = env GO111MODULE=on go run

libzkp:
cd $(PWD)/rollup/circuitcapacitychecker/libzkp && make libzkp

# in go-ethereum repo
build-bk-prod-morph-prod-mainnet-to-morph-geth: libzkp
if [ ! -d dist ]; then mkdir -p dist; fi
$(GORUN) build/ci.go install -buildtags circuit_capacity_checker ./cmd/geth
$(GORUN) build/ci.go install ./cmd/geth
cp build/bin/geth dist/
cp $(PWD)/rollup/circuitcapacitychecker/libzkp/libzkp.so dist/
tar -czvf morph-geth.tar.gz dist
aws s3 cp morph-geth.tar.gz s3://morph-0582-morph-technical-department-mainnet-data/morph-setup/morph-geth.tar.gz


build-bk-prod-morph-prod-mainnet-to-morph-nccc-geth: ## geth without circuit capacity checker
if [ ! -d dist ]; then mkdir -p dist; fi
$(GORUN) build/ci.go install ./cmd/geth
@echo "Done building."
cp build/bin/geth dist/
tar -czvf morph-nccc-geth.tar.gz dist
aws s3 cp morph-nccc-geth.tar.gz s3://morph-0582-morph-technical-department-mainnet-data/morph-setup/morph-nccc-geth.tar.gz


start-morph-geth:
geth --datadir="/data/morph-geth-db"

start-morph-sentry-geth:
geth --datadir="/data/morph-geth-db"

3 changes: 0 additions & 3 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ var (
utils.MinerEtherbaseFlag, // deprecated
utils.MinerExtraDataFlag,
utils.MinerPendingFeeRecipientFlag,
utils.MinerRecommitIntervalFlag,
utils.MinerStoreSkippedTxTracesFlag,
utils.MinerMaxAccountsNumFlag,
utils.NATFlag,
utils.NoDiscoverFlag,
Expand Down Expand Up @@ -159,7 +157,6 @@ var (
utils.GpoIgnoreGasPriceFlag,
configFileFlag,
utils.CatalystFlag,
utils.CircuitCapacityCheckEnabledFlag,
}

rpcFlags = []cli.Flag{
Expand Down
2 changes: 0 additions & 2 deletions cmd/geth/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ var AppHelpFlagGroups = []flags.FlagGroup{
utils.MinerGasLimitFlag,
utils.MinerEtherbaseFlag,
utils.MinerExtraDataFlag,
utils.MinerRecommitIntervalFlag,
utils.MinerStoreSkippedTxTracesFlag,
utils.MinerMaxAccountsNumFlag,
},
},
Expand Down
28 changes: 0 additions & 28 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,22 +481,13 @@ var (
Name: "miner.extradata",
Usage: "Block extra data set by the miner (default = client version)",
}
MinerRecommitIntervalFlag = cli.DurationFlag{
Name: "miner.recommit",
Usage: "Time interval to recreate the block being mined",
Value: ethconfig.Defaults.Miner.Recommit,
}

MinerNewBlockTimeout = &cli.DurationFlag{
Name: "miner.newblock-timeout",
Usage: "Specify the maximum time allowance for creating a new block",
Value: ethconfig.Defaults.Miner.NewBlockTimeout,
}

MinerStoreSkippedTxTracesFlag = cli.BoolFlag{
Name: "miner.storeskippedtxtraces",
Usage: "Store the wrapped traces when storing a skipped tx",
}
MinerMaxAccountsNumFlag = cli.IntFlag{
Name: "miner.maxaccountsnum",
Usage: "Maximum number of accounts that miner will fetch the pending transactions of when building a new block",
Expand Down Expand Up @@ -851,12 +842,6 @@ var (
Usage: "Catalyst mode (eth2 integration testing)",
}

// Circuit capacity check settings
CircuitCapacityCheckEnabledFlag = cli.BoolFlag{
Name: "ccc",
Usage: "Enable circuit capacity check during block validation",
}

// Max block range for `eth_getLogs` method
MaxBlockRangeFlag = cli.Int64Flag{
Name: "rpc.getlogs.maxrange",
Expand Down Expand Up @@ -1502,12 +1487,6 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {
if ctx.GlobalIsSet(MinerGasPriceFlag.Name) {
cfg.GasPrice = GlobalBig(ctx, MinerGasPriceFlag.Name)
}
if ctx.GlobalIsSet(MinerRecommitIntervalFlag.Name) {
cfg.Recommit = ctx.GlobalDuration(MinerRecommitIntervalFlag.Name)
}
if ctx.GlobalIsSet(MinerStoreSkippedTxTracesFlag.Name) {
cfg.StoreSkippedTxTraces = ctx.GlobalBool(MinerStoreSkippedTxTracesFlag.Name)
}
if ctx.GlobalIsSet(MinerMaxAccountsNumFlag.Name) {
cfg.MaxAccountsNum = ctx.GlobalInt(MinerMaxAccountsNumFlag.Name)
}
Expand Down Expand Up @@ -1542,12 +1521,6 @@ func setWhitelist(ctx *cli.Context, cfg *ethconfig.Config) {
}
}

func setCircuitCapacityCheck(ctx *cli.Context, cfg *ethconfig.Config) {
if ctx.GlobalIsSet(CircuitCapacityCheckEnabledFlag.Name) {
cfg.CheckCircuitCapacity = ctx.GlobalBool(CircuitCapacityCheckEnabledFlag.Name)
}
}

func setMaxBlockRange(ctx *cli.Context, cfg *ethconfig.Config) {
if ctx.GlobalIsSet(MaxBlockRangeFlag.Name) {
cfg.MaxBlockRange = ctx.GlobalInt64(MaxBlockRangeFlag.Name)
Expand Down Expand Up @@ -1621,7 +1594,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
setMiner(ctx, &cfg.Miner)
setWhitelist(ctx, cfg)
setLes(ctx, cfg)
setCircuitCapacityCheck(ctx, cfg)
setMaxBlockRange(ctx, cfg)

// Cap the cache allowance and tune the garbage collector
Expand Down
3 changes: 0 additions & 3 deletions consensus/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,4 @@ var (
// ErrInvalidNumber is returned if a block's number doesn't equal its parent's
// plus one.
ErrInvalidNumber = errors.New("invalid block number")

// ErrInvalidTxCount is returned if a block contains too many transactions.
ErrInvalidTxCount = errors.New("invalid transaction count")
)
Loading

0 comments on commit d5897cc

Please sign in to comment.