The current ArbOS version used on Arbitrum One and Arbitrum Nova is ArbOS 20, corresponding to the Arbitrum Nitro consensus-v20 git tag.

You can verify this by running the previously mentioned steps to build the WASM module root on that git tag, which produces the WASM module root 0x8b104a2e80ac6165dc58b9048de12f301d70b02a0ab51396c22b4b4b802a16a4, which is what the rollup contract’s wasmModuleRoot() method returns for both Arbitrum One and Arbitrum Nova.

To audit the code difference from ArbOS 20 to ArbOS 31, you could simply generate a full nitro diff with git diff consensus-v20 consensus-v31 (and also generate a diff of the go-ethereum submodule mentioned in that nitro diff). However, that includes a lot of code that isn’t part of the WASM module root. To filter down to just the replay binary which defines the state transition function, you can start by generating a list of files in the nitro and go-ethereum repositories included by the replay binary in either ArbOS 20 or ArbOS 31 with bash:

# !/usr/bin/env bash
set -e
mkdir -p ~/tmp
# This script uses ~/tmp as scratch space and output
# This script should be run in the nitro repository: 

# Checkout and update submodules for consensus-v31
git checkout consensus-v31
git submodule update --init --recursive
make .make/solgen

# List dependencies for replay command, filter nitro dependencies, and save to file
go list -f "{{.Deps}}" ./cmd/replay | tr -d '[]' | sed 's/ /\\\\n/g' | grep 'github.com/offchainlabs/nitro/' | sed '[email protected]/offchainlabs/nitro/@@' | while read dir; do
  find "$dir" -type f -name '*.go' -maxdepth 1
done | grep -v '_test\\\\.go$' > ~/tmp/consensus-v31-nitro-files.txt

# List dependencies for replay command, filter geth dependencies, and save to file
go list -f "{{.Deps}}" ./cmd/replay | tr -d '[]' | sed 's/ /\\\\n/g' | grep 'github.com/ethereum/go-ethereum/' | sed '[email protected]/ethereum/go-ethereum/@go-ethereum/@' | while read dir; do
  find "$dir" -type f -name '*.go' -maxdepth 1
done | grep -v '_test\\\\.go$' > ~/tmp/consensus-v31-geth-files.txt

# Checkout and update submodules for consensus-v20
git checkout consensus-v20
git submodule update --init --recursive
make .make/solgen

# List dependencies for replay command, filter nitro dependencies, and save to file
go list -f "{{.Deps}}" ./cmd/replay | tr -d '[]' | sed 's/ /\\\\n/g' | grep 'github.com/offchainlabs/nitro/' | sed '[email protected]/offchainlabs/nitro/@@' | while read dir; do
  find "$dir" -type f -name '*.go' -maxdepth 1
done | grep -v '_test\\\\.go$' > ~/tmp/consensus-v20-nitro-files.txt

# List dependencies for replay command, filter geth dependencies, and save to file
go list -f "{{.Deps}}" ./cmd/replay | tr -d '[]' | sed 's/ /\\\\n/g' | grep 'github.com/ethereum/go-ethereum/' | sed '[email protected]/ethereum/go-ethereum/@go-ethereum/@' | while read dir; do
  find "$dir" -type f -name '*.go' -maxdepth 1
done | grep -v '_test\\\\.go$' > ~/tmp/consensus-v20-geth-files.txt

# Combine and sort nitro dependencies
sort -u ~/tmp/consensus-v20-nitro-files.txt ~/tmp/consensus-v31-nitro-files.txt > ~/tmp/replay-binary-nitro-dependencies.txt

# Combine, sort, and filter geth dependencies
sort -u ~/tmp/consensus-v20-geth-files.txt ~/tmp/consensus-v31-geth-files.txt | sed 's@^[./]*go-ethereum/@@' > ~/tmp/replay-binary-geth-dependencies.txt

Now, ~/tmp/replay-binary-dependencies.txt contains a list of dependencies of the replay binary that were present in ArbOS 20 or ArbOS 31. To use that to generate a smaller diff of the nitro repository, you can run:

git diff consensus-v20 consensus-v31 -- cmd/replay $(cat ~/tmp/replay-binary-nitro-dependencies.txt)

The fraud prover is not part of the on-chain upgrade, but may be helpful in understanding the fraud proving smart contract changes and other components:

git diff consensus-20 consensus-v31 -- arbitrator/prover arbitrator/wasm-libraries/ arbitrator/arbutil ':!**/Cargo.lock' ':!**/kzg-trusted-setup.json'

For the go-ethereum submodule, you can first find out what go-ethereum commit ArbOS 20 and 31 used:

$ git ls-tree consensus-v20 go-ethereum
160000 commit abe584818e104dd5b4fdb8f60381a14eede896de go-ethereum
$ git ls-tree consensus-v31 go-ethereum
160000 commit 5a89d012232039ab57e28f9628c8e50b9093edc7 go-ethereum

Those commit hashes are the go-ethereum commit hashes pinned by each Nitro commit. Then, you can again use git diff and the files generated by the earlier script to generate a diff limited to code used by the replay binary:

# this should be run inside the go-ethereum submodule folder
git diff abe584818e104dd5b4fdb8f60381a14eede896de 5a89d012232039ab57e28f9628c8e50b9093edc7 -- $(cat ~/tmp/replay-binary-geth-dependencies.txt)

This diff also includes the diff between upstream go-ethereum versions v1.13.3 and v1.13.11, as ArbOS 20 used the former and ArbOS 31 uses the latter.

To filter out that difference, you can use this tool to find the intersection of two git diffs:

Git diff intersection finder

We can use that to find the intersection of the diff of ArbOS 31’s go-ethereum against ArbOS 20’s go-ethereum and the diff of ArbOS 31’s go-etheruem against upstream go-ethereum v1.13.11:

# This should be run inside the go-ethereum submodule folder

# Generate diff between two specific commits and save to file
git diff abe584818e104dd5b4fdb8f60381a14eede896de 5a89d012232039ab57e28f9628c8e50b9093edc7 -- $(cat ~/tmp/replay-binary-geth-dependencies.txt) > ~/tmp/arbos-20-vs-31-geth.diff

# Generate diff between upstream geth and nitro geth, and save to file
git diff v1.13.11 5a89d012232039ab57e28f9628c8e50b9093edc7 -- $(cat ~/tmp/replay-binary-geth-dependencies.txt) > ~/tmp/arbos-31-vs-upstream-geth.diff

# Run the diff-intersection script with the specified diff files and ignored files
diff-intersection.py ~/tmp/arbos-20-vs-31-geth.diff ~/tmp/arbos-31-vs-upstream-geth.diff --ignore-files 'core/blockchain*.go' arbitrum_types/txoptions.go 'rawdb/**' 'rpc/**'

The above command ignores files that are included by the replay binary but whose components are not used with these arguments:

--ignore-files 'core/blockchain*.go' arbitrum_types/txoptions.go 'rawdb/**' 'rpc/**'.