-
Notifications
You must be signed in to change notification settings - Fork 152
[M2] Integrate block explorer URL override for Otterscan #4077
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
base: main
Are you sure you want to change the base?
[M2] Integrate block explorer URL override for Otterscan #4077
Conversation
- Add nginx-spa.conf with try_files fallback for client-side routing - Update Dockerfile.explorer to use nginx SPA config (fixes 404 on direct URL access/refresh) - Add REACT_APP_EXPLORER_URL_DEV to cowswap build command - Fix README typo and remove "not yet implemented" from explorer 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix heredoc EOF quoting to enable variable expansion in otterscan-entrypoint.sh - Update Node.js from v22 to v24 (current LTS) in Dockerfile.sourcify - Update Sourcify repo to argotorg/sourcify with explicit master branch - Align sourcify-db postgres version to 16 (matching main db service)
The dbmate binary download was hardcoded to amd64, which breaks builds on ARM64 machines (Apple Silicon) when using alternative container runtimes like Podman or lima that don't have automatic x86 emulation. Changes: - Detect host architecture using dpkg --print-architecture - Map dpkg naming to dbmate naming (i386→386, armhf→arm) - Add clear error message for unsupported architectures - Verify binary works with dbmate --version after download Supports: amd64, arm64, i386, armhf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request integrates Otterscan as the local block explorer by updating Docker configurations and adding new services for Otterscan and Sourcify. My review identifies several opportunities to improve the long-term maintainability and reproducibility of the playground environment. Key suggestions include pinning base images and git dependencies to specific versions to prevent unexpected breakages, and optimizing Dockerfiles for better layer caching and clarity.
| apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Clone Sourcify with submodules | ||
| RUN git clone --depth 1 --branch master --recurse-submodules https://github.com/argotorg/sourcify.git /sourcify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cloning the master branch makes the build non-reproducible, as master can change at any time, potentially introducing breaking changes. It is strongly recommended to clone a specific git tag or commit hash to ensure deterministic and stable builds.
RUN git clone --depth 1 --branch v1.2.0 --recurse-submodules https://github.com/argotorg/sourcify.git /sourcify
| ARG REACT_APP_EXPLORER_URL_DEV=http://localhost:8001 | ||
|
|
||
| # Block explorer URL (Otterscan for local development) | ||
| ARG REACT_APP_BLOCK_EXPLORER_URL=http://localhost:8003 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| # Build the frontend | ||
| RUN APP_ID=1 yarn build:explorer | ||
| RUN APP_ID=1 REACT_APP_BLOCK_EXPLORER_URL=$REACT_APP_BLOCK_EXPLORER_URL yarn build:explorer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The REACT_APP_BLOCK_EXPLORER_URL environment variable is already set for the build stage using the ENV instruction on line 18. It is redundant to set it again on the RUN command line, as the build process will automatically pick up the variable from the environment. Removing the redundancy improves clarity.
RUN APP_ID=1 yarn build:explorer
|
In the gif, the link you click is still named Etherscan though, it can be a bit confusing for playground users |
@jmg-duarte that could be an improvement to make but it would not live in this repo but rather in Cowswap repo, where the PR for this feature was already merged |
Summary
This is a copy of a stale PR
This PR delivers part of Milestone 2: Frontend Integration of the CoW Grants Program RFP: CoW Protocol Playground Block Explorer Integration proposal by CoBuilders.
Updates the CoW Swap and Explorer Dockerfiles to use
REACT_APP_BLOCK_EXPLORER_URL, enabling all block explorer links to point to the local Otterscan instance (port 8003) instead of Etherscan.Milestone 2 Deliverables
CoW Swap Frontend Integration
REACT_APP_BLOCK_EXPLORER_URL=http://localhost:8003in buildCoW Explorer Frontend Integration
REACT_APP_BLOCK_EXPLORER_URL=http://localhost:8003in buildSuccess Criteria
Changes
Modified Files
Dockerfile.cowswapREACT_APP_BLOCK_EXPLORER_URLbuild argDockerfile.explorerREACT_APP_BLOCK_EXPLORER_URLenv varArchitecture
Dependencies
This PR depends on:
REACT_APP_BLOCK_EXPLORER_URLenv var supportTesting
Start the playground:
Open CoW Swap at
http://localhost:8000:http://localhost:8003/tx/{hash}Open CoW Explorer at
http://localhost:8001:http://localhost:8003/address/{addr}Verify Otterscan shows the transaction/address details with full traces
Demo
Milestones
Submitted by CoBuilders as part of the CoW Grants Program