Dockerizing Supersim: Improving the Superchain

The blockchain ecosystem is growing rapidly, and with it, the need for tools that allow developers to simulate complex environments efficiently. Supersim is one such tool, designed to simulate the Superchain locally. However, in a development environment that involves multiple chains and specialized tools, installing and configuring dependencies can be a challenge. This is why I suggested dockerizing Supersim, aiming to offer a cleaner, more efficient, and conflict-free solution.

This article details the process followed to implement this improvement and why we decided to add Docker support to Supersim. If you're a developer looking to collaborate on open-source projects, you've come to the right place to learn and contribute!

The Process Behind Dockerizing Supersim

1. Identifying the Problem

During the development and testing of Supersim, one of the main challenges was managing dependencies. Supersim requires the installation of multiple tools, such as Go, Foundry, and Anvil, which can lead to potential version conflicts and configuration issues. This complexity led me to look for a solution that would allow developers to run Supersim without having to deal with local installations or complex setups.

2. The Suggestion to Dockerize Supersim

Docker emerged as a natural solution. By encapsulating Supersim in a Docker container, we can guarantee a consistent development environment, independent of the user’s operating system configuration. This approach offers several advantages:

  • Consistent Environment: Docker ensures that all developers use the same versions of tools and dependencies, eliminating discrepancies between environments.

  • Ease of Use: With just a few commands, anyone can run Supersim without worrying about local installations or complex setups.

  • Security and Isolation: Docker isolates the application from the host operating system, minimizing risks and reducing the permissions needed on the system.

3. Dockerfile Implementation

Below is the Dockerfile developed for Supersim. This file defines the necessary steps to build a Docker image that encapsulates all required dependencies and tools.

FROM golang:1.22

RUN apt-get update && apt-get install -y curl git

WORKDIR /app

RUN curl -L https://foundry.paradigm.xyz | bash

ENV PATH="/root/.foundry/bin:${PATH}"

RUN foundryup

COPY . .

RUN go mod tidy

RUN go build -o supersim cmd/main.go

CMD ["./supersim"]

4. Documentation Update

To facilitate the adoption of this new feature, we also updated Supersim's documentation by adding a section dedicated to running it with Docker. This way, any developer can start using Supersim in minutes without worrying about installing dependencies.

🐋 Running Supersim with Docker

You can now run Supersim using Docker. This approach guarantees a consistent development environment without the need to install dependencies on your local machine. Here are the steps:

1. Build the Docker image

docker build -t supersim .

2. Run Supersim in Docker

docker run --rm -it --network host supersim:latest

This process encapsulates Supersim in a container, isolating it from the host system. This ensures a clean, conflict-free environment and adds an extra layer of security by reducing the application’s permissions on the host system.

3. Start Testing Multichain Features 🚀

You can now explore the incredible possibilities of Supersim with ready-to-use examples!


Conclusion: The Importance of Contributing to Open Source Projects

This change in Supersim wouldn't have been possible without the collaborative spirit of the community, especially the Mode Network team - CriptoFede (CriptoFede on Twitter). This initiative was born from a small observation that identified the need to simplify the setup process. Based on that, we proposed the dockerization of Supersim, which now makes the work of many developers easier.

I invite you to contribute to open-source projects like Supersim. Every small improvement counts, and your contribution can make a big difference in the community. If you're interested in collaborating, check out the process I followed to make this contribution in this Pull Request: https://github.com/ethereum-optimism/supersim/pull/175, which is now approved and integrated into the main repository.

Also, don’t miss the latest updates from Mode Network and join our growing community!

Let’s build together!

Subscribe to Wolfcito
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.