Skip to content
Closed
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
24 changes: 24 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,29 @@ jobs:
- notify-failures-on-develop:
mentions: "@proofs-team"

analyze-op-program-client:
docker:
- image: cimg/go:1.21
steps:
- checkout

- run:
name: Install Dependencies
command: |
sudo apt-get update
sudo apt-get install -y llvm curl

- run:
name: Set up LLVM Path
command: |
export PATH="/usr/bin:$PATH" # Ensure LLVM is in PATH
echo 'export PATH="/usr/bin:$PATH"' >> $BASH_ENV

- run:
name: Run Analyzer
command: |
make analyze-op-program-client

op-program-compat:
machine: true
resource_class: ethereum-optimism/latitude-1
Expand Down Expand Up @@ -1555,6 +1578,7 @@ workflows:
- contracts-bedrock-build
- cannon-prestate-quick
- op-program-compat
- analyze-op-program-client
- bedrock-go-tests:
requires:
- go-lint
Expand Down
61 changes: 61 additions & 0 deletions op-program/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@ VERSION ?= v0.0.0
LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT)
LDFLAGSSTRING +=-X main.GitDate=$(GITDATE)

# Detect OS and architecture
OS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
ARCH := $(shell uname -m)
BIN_DIR := bin
ANALYZER_BIN := $(BIN_DIR)/analyzer

# Normalize architecture naming
ifeq ($(ARCH),x86_64)
ARCH := amd64
endif
ifeq ($(ARCH),aarch64)
ARCH := arm64
endif

# Detect package manager
PKG_MANAGER :=
ifeq ($(OS),linux)
ifeq ($(shell command -v apt-get),/usr/bin/apt-get)
PKG_MANAGER := sudo apt-get install -y
else ifeq ($(shell command -v yum),/usr/bin/yum)
PKG_MANAGER := sudo yum install -y
else ifeq ($(shell command -v pacman),/usr/bin/pacman)
PKG_MANAGER := sudo pacman -Sy --noconfirm
endif
else ifeq ($(OS),darwin)
PKG_MANAGER := brew install
endif

# Define the binary based on OS and ARCH
ANALYZER_URL := https://github.com/ChainSafe/vm-compat/releases/latest/download/analyzer-$(OS)-$(ARCH)

# op-program-client version must ALWAYS be set to the same value (v0.0.0) to ensure exact build is reproducible
PC_LDFLAGSSTRING := $(LDFLAGSSTRING)
PC_LDFLAGSSTRING +=-X github.com/ethereum-optimism/optimism/op-program/version.Version=v0.0.0
Expand Down Expand Up @@ -111,6 +142,36 @@ verify-sepolia-fjord: op-program-host op-program-client

verify-compat: verify-sepolia-delta verify-sepolia-ecotone verify-mainnet-genesis

# Install llvm-objdump if missing
.PHONY: install-llvm
install-llvm:
@echo "Checking if llvm-objdump is installed..."
@which llvm-objdump >/dev/null 2>&1 || (echo "Installing llvm-objdump..." && $(PKG_MANAGER) llvm)

.PHONY: fetch-analyzer
fetch-analyzer:
@if [ -f "$(ANALYZER_BIN)" ]; then \
echo "Analyzer binary already exists, skipping download."; \
else \
echo "Fetching Analyzer Binary for $(OS)-$(ARCH)..."; \
mkdir -p $(BIN_DIR); \
curl -L -o $(ANALYZER_BIN) $(ANALYZER_URL); \
chmod +x $(ANALYZER_BIN); \
fi

.PHONY: analyze-op-program-client
analyze-op-program-client: analyze-op-program-client-cannon-singlethreaded-32 analyze-op-program-client-cannon-multithreaded-64

.PHONY: analyze-op-program-client-cannon-singlethreaded-32
analyze-op-program-client-cannon-singlethreaded-32: fetch-analyzer install-llvm
@echo "Analyzing op-program-client for cannon-singlethreaded-32..."
$(ANALYZER_BIN) analyze --with-trace=true --format=json --vm-profile cannon-singlethreaded-32 --baseline-report ./compatibility-test/op-program-cannon-singlethreaded-32.json ./client/cmd/main.go

.PHONY: analyze-op-program-client-cannon-multithreaded-64
analyze-op-program-client-cannon-multithreaded-64: fetch-analyzer install-llvm
@echo "Analyzing op-program-client for cannon-multithreaded-64..."
$(ANALYZER_BIN) analyze --with-trace=true --format=json --vm-profile cannon-multithreaded-64 --baseline-report ./compatibility-test/op-program-cannon-multithreaded-64.json ./client/cmd/main.go

.PHONY: \
op-program \
op-program-host \
Expand Down