Skip to content

Commit

Permalink
Merge tag 'v3.2.1' into release/v3.x-fh
Browse files Browse the repository at this point in the history
Arbitrum Nitro v3.2.1
  • Loading branch information
sduchesneau committed Sep 24, 2024
2 parents d95ee0e + d81324d commit 26cda07
Show file tree
Hide file tree
Showing 41 changed files with 117 additions and 42 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/shellcheck-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: ShellCheck CI
run-name: ShellCheck CI triggered from @${{ github.actor }} of ${{ github.head_ref }}

on:
workflow_dispatch:
merge_group:
pull_request:
push:
branches:
- master

jobs:
shellcheck:
name: Run ShellCheck
runs-on: ubuntu-8
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
ignore_paths: >-
./fastcache/**
./contracts/**
./safe-smart-account/**
./go-ethereum/**
./nitro-testnode/**
./brotli/**
./arbitrator/**
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ linters-settings:
gosec:
excludes:
- G404 # checks that random numbers are securely generated
- G115

govet:
enable-all: true
Expand Down
3 changes: 3 additions & 0 deletions .rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.76"
components = [ "rustfmt" ]
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ COPY ./scripts/download-machine.sh .
#RUN ./download-machine.sh consensus-v20 0x8b104a2e80ac6165dc58b9048de12f301d70b02a0ab51396c22b4b4b802a16a4
RUN ./download-machine.sh consensus-v30 0xb0de9cb89e4d944ae6023a3b62276e54804c242fd8c4c2d8e6cc4450f5fa8b1b && true
RUN ./download-machine.sh consensus-v31 0x260f5fa5c3176a856893642e149cf128b5a8de9f828afec8d11184415dd8dc69
RUN ./download-machine.sh consensus-v32 0x184884e1eb9fefdc158f6c8ac912bb183bf3cf83f0090317e0bc4ac5860baa39

FROM golang:1.21.10-bookworm AS node-builder
WORKDIR /workspace
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x0754e09320c381566cc0449904c377a52bd34a6b9404432e80afd573b67f7b17
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x68e4fe5023f792d4ef584796c84d710303a5e12ea02d6e37e2b5e9c4332507c4
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x6b94a7fc388fd8ef3def759297828dc311761e88d8179c7ee8d3887dc554f3c3
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x8b104a2e80ac6165dc58b9048de12f301d70b02a0ab51396c22b4b4b802a16a4
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xda4e3ad5e7feacb817c21c8d0220da7650fe9051ece68a3f0b1c5d38bbb27b21
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xf4389b835497a910d7ba3ebfb77aa93da985634f3c052de1290360635be40c4a
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xf559b6d4fa869472dabce70fe1c15221bdda837533dfd891916836975b434dec
Binary file not shown.
14 changes: 14 additions & 0 deletions app/legacy-machines/download-machine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e

mkdir "$2"
ln -sfT "$2" latest
cd "$2"
echo "$2" > module-root.txt
url_base="https://github.com/OffchainLabs/nitro/releases/download/$1"
wget "$url_base/machine.wavm.br"

status_code="$(curl -LI "$url_base/replay.wasm" -so /dev/null -w '%{http_code}')"
if [ "$status_code" -ne 404 ]; then
wget "$url_base/replay.wasm"
fi
1 change: 1 addition & 0 deletions app/legacy-machines/latest
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x260f5fa5c3176a856893642e149cf128b5a8de9f828afec8d11184415dd8dc69
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xb0de9cb89e4d944ae6023a3b62276e54804c242fd8c4c2d8e6cc4450f5fa8b1b
Binary file not shown.
14 changes: 14 additions & 0 deletions app/machines/download-machine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e

mkdir "$2"
ln -sfT "$2" latest
cd "$2"
echo "$2" > module-root.txt
url_base="https://github.com/OffchainLabs/nitro/releases/download/$1"
wget "$url_base/machine.wavm.br"

status_code="$(curl -LI "$url_base/replay.wasm" -so /dev/null -w '%{http_code}')"
if [ "$status_code" -ne 404 ]; then
wget "$url_base/replay.wasm"
fi
1 change: 1 addition & 0 deletions app/machines/latest
Binary file added mach.tar.gz
Binary file not shown.
4 changes: 4 additions & 0 deletions runfirehose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fireeth start reader-node --config-file= --log-format=stackdriver --log-to-file=false --data-dir=/Users/stepd/data \
--common-one-block-store-url=/Users/stepd/blocks/nova/new --common-first-streamable-block=0 --reader-node-data-dir=/Users/stepd/data --reader-node-working-dir=/Users/stepd/data/work \
--reader-node-grpc-listen-addr=:9000 --reader-node-manager-api-addr=:8080 --reader-node-path=./target/bin/nitro \
--reader-node-arguments="--parent-chain.blob-client.beacon-url=http://localhost:5052 --parent-chain.connection.url=http://localhost:8545 --chain.name=nova --http.api=net,web3,eth,debug --http.corsdomain=* --http.addr=0.0.0.0 --http.vhosts=* --persistent.global-config=/Users/stepd/data --metrics --metrics-server.addr=0.0.0.0 --metrics-server.port=6061 --http.port=8546 --ipc.path=./node.ipc --node.firehose --validation.wasm.allowed-wasm-module-roots=/Users/stepd/arbmachines/nitro-legacy/machines,/Users/stepd/arbmachines/target/machines"
13 changes: 8 additions & 5 deletions scripts/build-brotli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

mydir=`dirname $0`
mydir=$(dirname "$0")
cd "$mydir"

BUILD_WASM=false
Expand Down Expand Up @@ -35,7 +35,7 @@ usage(){
echo "all relative paths are relative to script location"
}

while getopts "s:t:c:D:wldhf" option; do
while getopts "n:s:t:c:D:wldhf" option; do
case $option in
h)
usage
Expand All @@ -62,6 +62,9 @@ while getopts "s:t:c:D:wldhf" option; do
s)
SOURCE_DIR="$OPTARG"
;;
*)
usage
;;
esac
done

Expand All @@ -74,7 +77,7 @@ if [ ! -d "$TARGET_DIR" ]; then
mkdir -p "${TARGET_DIR}lib"
ln -s "lib" "${TARGET_DIR}lib64" # Fedora build
fi
TARGET_DIR_ABS=`cd -P "$TARGET_DIR"; pwd`
TARGET_DIR_ABS=$(cd -P "$TARGET_DIR"; pwd)


if $USE_DOCKER; then
Expand All @@ -94,9 +97,9 @@ cd "$SOURCE_DIR"
if $BUILD_WASM; then
mkdir -p buildfiles/build-wasm
mkdir -p buildfiles/install-wasm
TEMP_INSTALL_DIR_ABS=`cd -P buildfiles/install-wasm; pwd`
TEMP_INSTALL_DIR_ABS=$(cd -P buildfiles/install-wasm; pwd)
cd buildfiles/build-wasm
cmake ../../ -DCMAKE_C_COMPILER=emcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=-fPIC -DCMAKE_INSTALL_PREFIX="$TEMP_INSTALL_DIR_ABS" -DCMAKE_AR=`which emar` -DCMAKE_RANLIB=`which touch`
cmake ../../ -DCMAKE_C_COMPILER=emcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=-fPIC -DCMAKE_INSTALL_PREFIX="$TEMP_INSTALL_DIR_ABS" -DCMAKE_AR="$(which emar)" -DCMAKE_RANLIB="$(which touch)"
make -j
make install
cp -rv "$TEMP_INSTALL_DIR_ABS/lib" "$TARGET_DIR_ABS/lib-wasm"
Expand Down
43 changes: 20 additions & 23 deletions scripts/convert-databases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ printStatus() {
}

printUsage() {
echo Usage: $0 \[OPTIONS..\]
echo Usage: "$0" \[OPTIONS..\]
echo
echo OPTIONS:
echo "--dbconv dbconv binary path (default: \"$DEFAULT_DBCONV\")"
Expand All @@ -42,15 +42,15 @@ echo Usage: $0 \[OPTIONS..\]
echo "--force remove destination directory if it exists"
echo "--skip-existing skip convertion of databases which directories already exist in the destination directory"
echo "--clean sets what should be removed in case of error, possible values:"
echo " \"failed\" - remove database which conversion failed (default)"
echo " \"failed\" - remove database which conversion failed (default)"
echo " \"none\" - remove nothing, leave unfinished and potentially corrupted databases"
echo " \"all\" - remove whole destination directory"
}

removeDir() {
cmd="rm -r \"$1\""
echo $cmd
eval $cmd
echo "$cmd"
eval "$cmd"
return $?
}

Expand All @@ -62,7 +62,7 @@ cleanup() {
;;
failed)
echo "== Note: removing only failed destination directory"
dstdir=$(echo $dst/$1 | tr -s /)
dstdir=$(echo "$dst"/"$1" | tr -s /)
removeDir "$dstdir"
;;
none)
Expand Down Expand Up @@ -127,8 +127,8 @@ if $force && $skip_existing; then
exit 1
fi

if [ $clean != "all" ] && [ $clean != "failed" ] && [ $clean != "none" ] ; then
echo Error: Invalid --clean value: $clean
if [ "$clean" != "all" ] && [ "$clean" != "failed" ] && [ "$clean" != "none" ] ; then
echo Error: Invalid --clean value: "$clean"
printUsage
exit 1
fi
Expand All @@ -138,8 +138,8 @@ if ! [ -e "$dbconv" ]; then
exit 1
fi

if ! [ -n "$dst" ]; then
echo Error: Missing destination directory \(\-\-dst\)
if [ -z "$dst" ]; then
echo "Error: Missing destination directory (--dst)"
printUsage
exit 1
fi
Expand Down Expand Up @@ -168,9 +168,8 @@ fi

if [ -e "$dst" ] && ! $skip_existing; then
if $force; then
echo == Warning! Destination already exists, --force is set, removing all files under path: "$dst"
removeDir "$dst"
if [ $? -ne 0 ]; then
echo "== Warning! Destination already exists, --force is set, removing all files under path: $dst"
if ! removeDir "$dst"; then
echo Error: failed to remove "$dst"
exit 1
fi
Expand All @@ -183,14 +182,13 @@ fi
convert_result=
convert () {
srcdir="$src"/$1
dstdir=$(echo $dst/$1 | tr -s /)
if ! [ -e $dstdir ]; then
dstdir=$(echo "$dst"/"$1" | tr -s /)
if ! [ -e "$dstdir" ]; then
echo "== Converting $1 db"
cmd="$dbconv --src.db-engine=leveldb --src.data \"$srcdir\" --dst.db-engine=pebble --dst.data \"$dstdir\" --convert --compact"
echo $cmd
eval $cmd
if [ $? -ne 0 ]; then
cleanup $1
echo "$cmd"
if ! eval "$cmd"; then
cleanup "$1"
convert_result="FAILED"
return 1
fi
Expand Down Expand Up @@ -221,9 +219,8 @@ if ! [ -e "$dst"/l2chaindata/ancient ]; then
ancient_dst=$(echo "$dst"/l2chaindata/ | tr -s /)
echo "== Copying l2chaindata ancients"
cmd="cp -r \"$ancient_src\" \"$ancient_dst\""
echo $cmd
eval $cmd
if [ $? -ne 0 ]; then
echo "$cmd"
if ! eval "$cmd"; then
l2chaindata_ancient_status="FAILED (failed to copy)"
cleanup "l2chaindata"
printStatus
Expand All @@ -249,7 +246,7 @@ if [ $res -ne 0 ]; then
exit 1
fi

if [ -e $src/wasm ]; then
if [ -e "$src"/wasm ]; then
convert "wasm"
res=$?
wasm_status=$convert_result
Expand All @@ -262,7 +259,7 @@ else
wasm_status="not found in source directory"
fi

if [ -e $src/classic-msg ]; then
if [ -e "$src"/classic-msg ]; then
convert "classic-msg"
res=$?
classicmsg_status=$convert_result
Expand Down
21 changes: 10 additions & 11 deletions scripts/fuzz.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

set -e

mydir=`dirname $0`
mydir=$(dirname "$0")
cd "$mydir"

function printusage {
echo Usage: $0 --build \[--binary-path PATH\]
echo " " $0 \<fuzzer-name\> \[--binary-path PATH\] \[--fuzzcache-path PATH\] \[--nitro-path PATH\] \[--duration DURATION\]
echo Usage: "$0" --build \[--binary-path PATH\]
echo " " "$0" \<fuzzer-name\> \[--binary-path PATH\] \[--fuzzcache-path PATH\] \[--nitro-path PATH\] \[--duration DURATION\]
echo
echo fuzzer names:
echo " " FuzzPrecompiles
Expand All @@ -22,7 +22,6 @@ if [[ $# -eq 0 ]]; then
exit
fi

fuzz_executable=../target/bin/system_test.fuzz
binpath=../target/bin/
fuzzcachepath=../target/var/fuzz-cache
nitropath=../
Expand Down Expand Up @@ -72,7 +71,7 @@ while [[ $# -gt 0 ]]; do
shift
;;
FuzzPrecompiles | FuzzStateTransition)
if [[ ! -z "$test_name" ]]; then
if [[ -n "$test_name" ]]; then
echo can only run one fuzzer at a time
exit 1
fi
Expand All @@ -81,7 +80,7 @@ while [[ $# -gt 0 ]]; do
shift
;;
FuzzInboxMultiplexer)
if [[ ! -z "$test_name" ]]; then
if [[ -n "$test_name" ]]; then
echo can only run one fuzzer at a time
exit 1
fi
Expand All @@ -102,17 +101,17 @@ fi

if $run_build; then
for build_group in system_tests arbstate; do
go test -c ${nitropath}/${build_group} -fuzz Fuzz -o "$binpath"/${build_group}.fuzz
go test -c "${nitropath}"/${build_group} -fuzz Fuzz -o "$binpath"/${build_group}.fuzz
done
fi

if [[ ! -z $test_group ]]; then
timeout "$((60 * duration))" "$binpath"/${test_group}.fuzz -test.run "^$" -test.fuzzcachedir "$fuzzcachepath" -test.fuzz $test_name || exit_status=$?
if [[ -n $test_group ]]; then
timeout "$((60 * duration))" "$binpath"/${test_group}.fuzz -test.run "^$" -test.fuzzcachedir "$fuzzcachepath" -test.fuzz "$test_name" || exit_status=$?
fi

if [ -n "$exit_status" ] && [ $exit_status -ne 0 ] && [ $exit_status -ne 124 ]; then
if [ -n "$exit_status" ] && [ "$exit_status" -ne 0 ] && [ "$exit_status" -ne 124 ]; then
echo "Fuzzing failed."
exit $exit_status
exit "$exit_status"
fi

echo "Fuzzing succeeded."
4 changes: 2 additions & 2 deletions scripts/startup-testnode.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

timeout 60 ./nitro-testnode/test-node.bash --init --dev || exit_status=$?

if [ -n "$exit_status" ] && [ $exit_status -ne 0 ] && [ $exit_status -ne 124 ]; then
if [ -n "$exit_status" ] && [ "$exit_status" -ne 0 ] && [ "$exit_status" -ne 124 ]; then
echo "Startup failed."
exit $exit_status
exit "$exit_status"
fi

echo "Startup succeeded."

0 comments on commit 26cda07

Please sign in to comment.