Skip to content

Commit

Permalink
merge master and resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli committed Jan 16, 2025
1 parent ef22576 commit 37e0402
Show file tree
Hide file tree
Showing 179 changed files with 10,592 additions and 1,777 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ arbitrator/tools/wasmer/target/
arbitrator/tools/wasm-tools/
arbitrator/tools/pricers/
arbitrator/tools/module_roots/
arbitrator/tools/stylus_benchmark
arbitrator/langs/rust/target/
arbitrator/langs/bf/target/

Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/arbitrator-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,22 @@ jobs:
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install rust stable
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 'stable'
components: 'llvm-tools-preview, rustfmt, clippy'

- name: Install rust nightly
uses: dtolnay/rust-toolchain@nightly
id: install-rust-nightly
with:
toolchain: 'nightly-2024-08-06'
toolchain: 'nightly-2024-10-06'
targets: 'wasm32-wasi, wasm32-unknown-unknown'
components: 'rust-src, rustfmt, clippy'

- name: Install rust stable
id: install-rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: '1.80.1'
targets: 'wasm32-wasi, wasm32-unknown-unknown'
components: 'llvm-tools-preview, rustfmt, clippy'

- name: Set STYLUS_NIGHTLY_VER environment variable
run: echo "STYLUS_NIGHTLY_VER=+$(rustup toolchain list | grep '^nightly' | head -n1 | cut -d' ' -f1)" >> "$GITHUB_ENV"

Expand Down Expand Up @@ -171,6 +173,9 @@ jobs:
- name: Rustfmt - langs/rust
run: cargo fmt --all --manifest-path arbitrator/langs/rust/Cargo.toml -- --check

- name: Rustfmt - tools/stylus_benchmark
run: cargo fmt --all --manifest-path arbitrator/tools/stylus_benchmark/Cargo.toml -- --check

- name: Make proofs from test cases
run: make -j test-gen-proofs

Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
redis:
image: redis
ports:
- 6379:6379
- 6379:6379

strategy:
fail-fast: false
Expand Down Expand Up @@ -55,16 +55,17 @@ jobs:
- name: Install rust stable
uses: dtolnay/rust-toolchain@stable
id: install-rust
with:
toolchain: 'stable'
toolchain: '1.80.1'
targets: 'wasm32-wasi, wasm32-unknown-unknown'
components: 'llvm-tools-preview, rustfmt, clippy'

- name: Install rust nightly
uses: dtolnay/rust-toolchain@nightly
id: install-rust-nightly
with:
toolchain: 'nightly-2024-08-06'
toolchain: 'nightly-2024-10-06'
targets: 'wasm32-wasi, wasm32-unknown-unknown'
components: 'rust-src, rustfmt, clippy'

Expand Down Expand Up @@ -192,7 +193,7 @@ jobs:
- name: run challenge tests
if: matrix.test-mode == 'challenge'
run: ${{ github.workspace }}/.github/workflows/gotestsum.sh --tags challengetest --run TestChallenge --cover
run: ${{ github.workspace }}/.github/workflows/gotestsum.sh --tags challengetest --run TestChallenge --timeout 60m --cover

- name: run stylus tests
if: matrix.test-mode == 'stylus'
Expand All @@ -203,7 +204,7 @@ jobs:
run: ${{ github.workspace }}/.github/workflows/gotestsum.sh --tags stylustest --run TestProgramLong --timeout 60m --cover

- name: Archive detailed run log
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.test-mode }}-full.log
path: full.log
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
echo -e "\x1b[1;34mWAVM module root:\x1b[0m $module_root"
- name: Upload WAVM machine as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: wavm-machine-${{ steps.module-root.outputs.module-root }}
path: target/machines/latest/*
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/submodule-pin-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ jobs:
run: |
status_state="pending"
declare -Ar exceptions=(
[contracts]=origin/develop
[contracts]=origin/pre-bold
[nitro-testnode]=origin/master
#TODO Rachel to check these are the intended branches.
[arbitrator/langs/c]=origin/vm-storage-cache
[arbitrator/tools/wasmer]=origin/adopt-v4.2.8
[arbitrator/tools/wasmer]=origin/stylus
)
divergent=0
for mod in `git submodule --quiet foreach 'echo $name'`; do
branch=origin/HEAD
if [[ -v exceptions[$mod] ]]; then
branch=${exceptions[$mod]}
fi
if ! git -C $mod merge-base --is-ancestor HEAD $branch; then
echo $mod diverges from $branch
divergent=1
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
[submodule "nitro-testnode"]
path = nitro-testnode
url = https://github.com/OffchainLabs/nitro-testnode.git
[submodule "bold"]
path = bold
url = https://github.com/OffchainLabs/bold.git
[submodule "arbitrator/langs/rust"]
path = arbitrator/langs/rust
url = https://github.com/OffchainLabs/stylus-sdk-rs.git
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
COPY go.mod go.sum ./
COPY go-ethereum/go.mod go-ethereum/go.sum go-ethereum/
COPY fastcache/go.mod fastcache/go.sum fastcache/
COPY bold/go.mod bold/go.sum bold/
RUN go mod download
COPY . ./
COPY --from=contracts-builder workspace/contracts/build/ contracts/build/
Expand Down Expand Up @@ -332,6 +333,7 @@ RUN rm -f /home/user/target/machines/latest
COPY --from=prover-export /bin/jit /usr/local/bin/
COPY --from=node-builder /workspace/target/bin/deploy /usr/local/bin/
COPY --from=node-builder /workspace/target/bin/seq-coordinator-invalidate /usr/local/bin/
COPY --from=node-builder /workspace/target/bin/mockexternalsigner /usr/local/bin/
COPY --from=module-root-calc /workspace/target/machines/latest/machine.wavm.br /home/user/target/machines/latest/
COPY --from=module-root-calc /workspace/target/machines/latest/until-host-io-state.bin /home/user/target/machines/latest/
COPY --from=module-root-calc /workspace/target/machines/latest/module-root.txt /home/user/target/machines/latest/
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Additional Use Grant: You may use the Licensed Work in a production environment
validating the correctness of the posted chain state, or to deploy
and operate (x) a blockchain that settles to a Covered Arbitrum Chain
or (y) a blockchain in accordance with, and subject to, the [Arbitrum
Expansion Program Term of Use](https://docs.arbitrum.foundation/assets/files/Arbitrum%20Expansion%20Program%20Jan182024-4f08b0c2cb476a55dc153380fa3e64b0.pdf). For purposes of this
Expansion Program Term of Use](https://docs.arbitrum.foundation/aep/ArbitrumExpansionProgramTerms.pdf). For purposes of this
Additional Use Grant, the "Covered Arbitrum Chains" are
(a) Arbitrum One (chainid:42161), Arbitrum Nova (chainid:42170),
Arbitrum Rinkeby testnet/Rinkarby (chainid:421611),Arbitrum Nitro
Expand Down
31 changes: 30 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ all: build build-replay-env test-gen-proofs
@touch .make/all

.PHONY: build
build: $(patsubst %,$(output_root)/bin/%, nitro deploy relay daserver datool seq-coordinator-invalidate nitro-val seq-coordinator-manager dbconv)
build: $(patsubst %,$(output_root)/bin/%, nitro deploy relay daserver datool mockexternalsigner seq-coordinator-invalidate nitro-val seq-coordinator-manager dbconv)
@printf $(done)

.PHONY: build-node-deps
Expand Down Expand Up @@ -314,6 +314,9 @@ $(output_root)/bin/daserver: $(DEP_PREDICATE) build-node-deps
$(output_root)/bin/datool: $(DEP_PREDICATE) build-node-deps
go build $(GOLANG_PARAMS) -o $@ "$(CURDIR)/cmd/datool"

$(output_root)/bin/mockexternalsigner: $(DEP_PREDICATE) build-node-deps
go build $(GOLANG_PARAMS) -o $@ "$(CURDIR)/cmd/mockexternalsigner"

$(output_root)/bin/seq-coordinator-invalidate: $(DEP_PREDICATE) build-node-deps
go build $(GOLANG_PARAMS) -o $@ "$(CURDIR)/cmd/seq-coordinator-invalidate"

Expand Down Expand Up @@ -440,54 +443,80 @@ $(stylus_test_dir)/%.wasm: $(stylus_test_dir)/%.b $(stylus_lang_bf)

$(stylus_test_keccak_wasm): $(stylus_test_keccak_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

$(stylus_test_keccak-100_wasm): $(stylus_test_keccak-100_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

$(stylus_test_fallible_wasm): $(stylus_test_fallible_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

$(stylus_test_storage_wasm): $(stylus_test_storage_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

$(stylus_test_multicall_wasm): $(stylus_test_multicall_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

$(stylus_test_log_wasm): $(stylus_test_log_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

$(stylus_test_create_wasm): $(stylus_test_create_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

$(stylus_test_math_wasm): $(stylus_test_math_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

$(stylus_test_evm-data_wasm): $(stylus_test_evm-data_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

$(stylus_test_read-return-data_wasm): $(stylus_test_read-return-data_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

$(stylus_test_sdk-storage_wasm): $(stylus_test_sdk-storage_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

$(stylus_test_erc20_wasm): $(stylus_test_erc20_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

$(stylus_test_hostio-test_wasm): $(stylus_test_hostio-test_src)
$(cargo_nightly) --manifest-path $< --release --config $(stylus_cargo)
wasm2wat $@ > $@.wat #removing reference types
wat2wasm $@.wat -o $@
@touch -c $@ # cargo might decide to not rebuild the binary

contracts/test/prover/proofs/float%.json: $(arbitrator_cases)/float%.wasm $(prover_bin) $(output_latest)/soft-float.wasm
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Nitro is currently licensed under a [Business Source License](./LICENSE.md), sim

The Additional Use Grant also permits the deployment of the Nitro software, in a permissionless fashion and without cost, as a new blockchain provided that the chain settles to either Arbitrum One or Arbitrum Nova.

For those that prefer to deploy the Nitro software either directly on Ethereum (i.e. an L2) or have it settle to another Layer-2 on top of Ethereum, the [Arbitrum Expansion Program (the "AEP")](https://docs.arbitrum.foundation/assets/files/Arbitrum%20Expansion%20Program%20Jan182024-4f08b0c2cb476a55dc153380fa3e64b0.pdf) was recently established. The AEP allows for the permissionless deployment in the aforementioned fashion provided that 10% of net revenue (as more fully described in the AEP) is contributed back to the Arbitrum community in accordance with the requirements of the AEP.
For those that prefer to deploy the Nitro software either directly on Ethereum (i.e. an L2) or have it settle to another Layer-2 on top of Ethereum, the [Arbitrum Expansion Program (the "AEP")](https://docs.arbitrum.foundation/aep/ArbitrumExpansionProgramTerms.pdf) was recently established. The AEP allows for the permissionless deployment in the aforementioned fashion provided that 10% of net revenue (as more fully described in the AEP) is contributed back to the Arbitrum community in accordance with the requirements of the AEP.

## Contact

Expand Down
1 change: 1 addition & 0 deletions arbitrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ members = [
exclude = [
"stylus/tests/",
"tools/wasmer/",
"tools/stylus_benchmark",
]
resolver = "2"

Expand Down
14 changes: 14 additions & 0 deletions arbitrator/arbutil/src/benchmark.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2024, Offchain Labs, Inc.
// For license information, see https://github.com/nitro/blob/master/LICENSE

use crate::evm::api::Ink;
use std::time::{Duration, Instant};

// Benchmark is used to track the performance of blocks of code in stylus
#[derive(Clone, Copy, Debug, Default)]
pub struct Benchmark {
pub timer: Option<Instant>,
pub elapsed_total: Duration,
pub ink_start: Option<Ink>,
pub ink_total: Ink,
}
1 change: 1 addition & 0 deletions arbitrator/arbutil/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2022-2024, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE

pub mod benchmark;
/// cbindgen:ignore
pub mod color;
pub mod crypto;
Expand Down
4 changes: 2 additions & 2 deletions arbitrator/arbutil/src/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,13 +595,13 @@ impl Display for OperatorCode {
}
}

impl<'a> From<Operator<'a>> for OperatorCode {
impl From<Operator<'_>> for OperatorCode {
fn from(op: Operator) -> Self {
OperatorCode::from(&op)
}
}

impl<'a> From<&Operator<'a>> for OperatorCode {
impl From<&Operator<'_>> for OperatorCode {
fn from(op: &Operator) -> Self {
use Operator as O;

Expand Down
2 changes: 1 addition & 1 deletion arbitrator/jit/src/caller_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl<'a> JitEnv<'a> for WasmEnvMut<'a> {
}
}

impl<'s> JitMemAccess<'s> {
impl JitMemAccess<'_> {
fn view(&self) -> MemoryView {
self.memory.view(&self.store)
}
Expand Down
51 changes: 51 additions & 0 deletions arbitrator/jit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright 2021-2024, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE

use std::path::PathBuf;
use structopt::StructOpt;

mod arbcompress;
mod caller_env;
pub mod machine;
mod prepare;
pub mod program;
mod socket;
pub mod stylus_backend;
mod test;
mod wasip1_stub;
mod wavmio;

#[derive(StructOpt)]
#[structopt(name = "jit-prover")]
pub struct Opts {
#[structopt(short, long)]
binary: PathBuf,
#[structopt(long, default_value = "0")]
inbox_position: u64,
#[structopt(long, default_value = "0")]
delayed_inbox_position: u64,
#[structopt(long, default_value = "0")]
position_within_message: u64,
#[structopt(long)]
last_block_hash: Option<String>,
#[structopt(long)]
last_send_root: Option<String>,
#[structopt(long)]
inbox: Vec<PathBuf>,
#[structopt(long)]
delayed_inbox: Vec<PathBuf>,
#[structopt(long)]
preimages: Option<PathBuf>,
#[structopt(long)]
cranelift: bool,
#[structopt(long)]
forks: bool,
#[structopt(long)]
pub debug: bool,
#[structopt(long)]
pub require_success: bool,
// JSON inputs supercede any of the command-line inputs which could
// be specified in the JSON file.
#[structopt(long)]
json_inputs: Option<PathBuf>,
}
Loading

0 comments on commit 37e0402

Please sign in to comment.