Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/go_modules/golang.org/x/crypto-…
Browse files Browse the repository at this point in the history
…0.31.0
  • Loading branch information
tsahee authored Jan 10, 2025
2 parents 784fa46 + 8ec07cf commit af92ce7
Show file tree
Hide file tree
Showing 100 changed files with 4,721 additions and 554 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
26 changes: 19 additions & 7 deletions .github/workflows/arbitrator-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,29 @@ 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: Install rust stable
id: install-rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: '1.80.1'
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 +180,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
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion .github/workflows/submodule-pin-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
#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
Expand Down
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -440,54 +440,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
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>,
}
51 changes: 3 additions & 48 deletions arbitrator/jit/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,58 +1,13 @@
// Copyright 2022-2024, Offchain Labs, Inc.
// For license information, see https://github.com/nitro/blob/master/LICENSE

use crate::machine::{Escape, WasmEnv};
use arbutil::{color, Color};
use eyre::Result;
use std::path::PathBuf;
use jit::machine;
use jit::machine::{Escape, WasmEnv};
use jit::Opts;
use structopt::StructOpt;

mod arbcompress;
mod caller_env;
mod machine;
mod prepare;
mod program;
mod socket;
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)]
debug: bool,
#[structopt(long)]
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>,
}

fn main() -> Result<()> {
let opts = Opts::from_args();
let env = match WasmEnv::cli(&opts) {
Expand Down
2 changes: 1 addition & 1 deletion arbitrator/jit/src/prepare.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022-2024, Offchain Labs, Inc.
// For license information, see https://github.com/nitro/blob/master/LICENSE

use crate::WasmEnv;
use crate::machine::WasmEnv;
use arbutil::{Bytes32, PreimageType};
use eyre::Ok;
use prover::parse_input::FileData;
Expand Down
Loading

0 comments on commit af92ce7

Please sign in to comment.