Bootstraped with Rust-Cannon-Template
Docker can be used for cross-compiling MIPS on any host. First build the docker image by running:
make docker_image
# or for Apple Silicon users
make docker_image_apple_silicon
After this a Cannon ready MIPS binary can be build with:
make build
This will write an out.bin
file to the build directory.
The build script build.sh
will cross-compile to the MIPS target and then post-process the resulting elf file into a binary that can be used in the MIPS emulator and proven on-chain.
This has only been tested in Ubuntu 22.04 so milage may vary
sudo apt install \
build-essential \
g++-mips-linux-gnu \
libc6-dev-mips-cross \
llvm \
clang \
python3 python3.8-venv python3-pip
Build a binary compatible with Ethereum mainnet with
./build.sh
This will write the Cannon compatible binary to build/mainnet_out.bin
You can also build a binary for verifying with the Ethereum spec tests with
SPEC=spec_test ./build.sh
which will output to build/spec_test_out.bin
Alternatively if you want to experiment in the build environment you can load up an interactive shell with
make docker_image
docker run -it --rm -v $(pwd):/code zipline-state-transition-mips/builder bash
(replace with your project name as required)
and from there you can run
./build.sh
to produce the output