forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d32c1ef
commit 175d544
Showing
3 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Build libzkp dependency | ||
FROM --platform=linux/arm64 scrolltech/go-rust-builder:go-1.20-rust-nightly-2022-12-10 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 mkdir -p .cargo && \ | ||
echo '[source.crates-io]' > .cargo/config.toml && \ | ||
echo 'registry = "https://github.com/rust-lang/crates.io-index"' >> .cargo/config.toml && \ | ||
echo 'replace-with = "ustc"' >> .cargo/config.toml && \ | ||
echo '[source.ustc]' >> .cargo/config.toml && \ | ||
echo 'registry = "git://mirrors.ustc.edu.cn/crates.io-index"' >> .cargo/config.toml | ||
RUN cargo chef cook --release --recipe-path recipe.json | ||
|
||
COPY ./rollup/circuitcapacitychecker/libzkp . | ||
RUN cargo clean | ||
RUN cargo build --release | ||
RUN find ./ | grep libzktrie.so | xargs -I{} cp {} /app/target/release/ | ||
|
||
# Build Geth in a stock Go builder container | ||
FROM scrolltech/go-rust-builder:go-1.20-rust-nightly-2022-12-10 as builder | ||
|
||
ADD . /go-ethereum | ||
COPY --from=zkp-builder /app/target/release/libzkp.so /usr/local/lib/ | ||
COPY --from=zkp-builder /app/target/release/libzktrie.so /usr/local/lib/ | ||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package circuitcapacitychecker | ||
|
||
import ( | ||
"encoding/json" | ||
"os" | ||
"testing" | ||
|
||
"github.com/scroll-tech/go-ethereum/core/types" | ||
) | ||
|
||
func BenchmarkApplyTransaction(b *testing.B) { | ||
data, err := os.ReadFile("block_trace_0xac92e50305b280808a06573888c89cde3556b79d72556c8cdfa97dc6b5695e44.json") | ||
if err != nil { | ||
b.Fatalf("Error reading block trace file: %v", err) | ||
} | ||
|
||
var blockTrace types.BlockTrace | ||
err = json.Unmarshal(data, &blockTrace) | ||
if err != nil { | ||
b.Fatalf("Error unmarshaling block trace JSON: %v", err) | ||
} | ||
|
||
ccc := NewCircuitCapacityChecker(true) | ||
|
||
b.ResetTimer() | ||
for i := 0; i < b.N; i++ { | ||
_, err := ccc.ApplyTransaction(&blockTrace) | ||
if err != nil { | ||
b.Fatalf("Error applying transaction: %v", err) | ||
} | ||
} | ||
} |