Commit 95d3ee1c authored by Nicolas "Norswap" Laurent's avatar Nicolas "Norswap" Laurent Committed by norswap

make unicorn a git module

parent a2020455
node_modules node_modules
artifacts artifacts
cache cache
unicorn
unicorn2
.*.swp .*.swp
venv venv
.idea .idea
......
...@@ -2,3 +2,6 @@ ...@@ -2,3 +2,6 @@
branch = l2minigeth branch = l2minigeth
path = minigeth path = minigeth
url = git@github.com:ethereum-optimism/minigeth.git url = git@github.com:ethereum-optimism/minigeth.git
[submodule "unicorn"]
path = unicorn
url = git@github.com:unicorn-engine/unicorn.git
SHELL := /bin/bash SHELL := /bin/bash
build: unicorn submodule minigeth_mips minigeth_default_arch mipsevm contracts build: submodules unicorn minigeth_mips minigeth_default_arch mipsevm contracts
unicorn: unicorn:
./build_unicorn.sh ./build_unicorn.sh
submodule: submodules:
# CI will checkout submodules on its own (and fails on these commands) # CI will checkout submodules on its own (and fails on these commands)
if [[ -z "$$GITHUB_ENV" ]]; then \ if [[ -z "$$GITHUB_ENV" ]]; then \
git submodule init; \ git submodule init; \
...@@ -31,11 +31,16 @@ nodejs: ...@@ -31,11 +31,16 @@ nodejs:
npm install; \ npm install; \
fi fi
# Must be a definition and not a rule, otherwise it gets only called once and
# not before each test as we wish.
define clear_cache define clear_cache
rm -rf /tmp/cannon rm -rf /tmp/cannon
mkdir -p /tmp/cannon mkdir -p /tmp/cannon
endef endef
clear_cache:
$(call clear_cache)
test_challenge: test_challenge:
$(call clear_cache) $(call clear_cache)
# Build preimage cache for block 13284469 # Build preimage cache for block 13284469
...@@ -82,5 +87,5 @@ mrproper: clean ...@@ -82,5 +87,5 @@ mrproper: clean
rm -rf node_modules rm -rf node_modules
rm -rf mipigo/venv rm -rf mipigo/venv
.PHONY: build unicorn submodule minigeth_mips minigeth_default_arch mipsevm contracts \ .PHONY: build unicorn submodules minigeth_mips minigeth_default_arch mipsevm contracts \
nodejs clean mrproper test_challenge test_mipsevm test_minigeth test nodejs clean mrproper test_challenge test_mipsevm test_minigeth test clear_cache
#!/usr/bin/env bash cd unicorn
if [[ ! -d unicorn2 ]]; then mkdir -p build
git clone https://github.com/geohot/unicorn.git -b dev unicorn2 cd build
#git clone https://github.com/unicorn-engine/unicorn.git -b dev unicorn2 cmake .. -DUNICORN_ARCH=mips -DCMAKE_BUILD_TYPE=Release
fi
cd unicorn2
cmake . -DUNICORN_ARCH=mips -DCMAKE_BUILD_TYPE=Release
#cmake . -DUNICORN_ARCH=mips -DCMAKE_BUILD_TYPE=Debug
make -j8 make -j8
# The Go linker / runtime expects these to be there!
cp libunicorn.so.1 ..
cp libunicorn.so.2 ..
# export LIBUNICORN_PATH for Github CI # export LIBUNICORN_PATH for Github CI
# TODO: is this actually needed? # TODO: is this actually needed?
if [[ ! -z "$GITHUB_ENV" ]]; then if [[ ! -z "$GITHUB_ENV" ]]; then
echo "LIBUNICORN_PATH=$(pwd)/unicorn2/" >> $GITHUB_ENV echo "LIBUNICORN_PATH=$(pwd)/unicorn/" >> $GITHUB_ENV
fi fi
...@@ -4,7 +4,7 @@ go 1.17 ...@@ -4,7 +4,7 @@ go 1.17
replace github.com/ethereum/go-ethereum => ../minigeth replace github.com/ethereum/go-ethereum => ../minigeth
replace github.com/unicorn-engine/unicorn => ../unicorn2 replace github.com/unicorn-engine/unicorn => ../unicorn
require ( require (
github.com/ethereum/go-ethereum v1.10.8 github.com/ethereum/go-ethereum v1.10.8
......
Subproject commit e5e1303243cf1a4e788a981ac7e6dbe945802260
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment