Skip to content

Commit

Permalink
Merge branch 'master' into pubsub_Error
Browse files Browse the repository at this point in the history
  • Loading branch information
amsanghi authored Jan 21, 2025
2 parents 6aca394 + b84847a commit 4be66d9
Show file tree
Hide file tree
Showing 45 changed files with 1,273 additions and 116 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/arbitrator-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ jobs:
- name: Run rust tests
run: cargo test -p arbutil -p prover -p jit -p stylus --release --manifest-path arbitrator/prover/Cargo.toml

- name: Check stylus_bechmark
run: cargo check --manifest-path arbitrator/tools/stylus_benchmark/Cargo.toml

- name: Rustfmt
run: cargo fmt -p arbutil -p prover -p jit -p stylus --manifest-path arbitrator/Cargo.toml -- --check

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ jobs:

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install cbindgen
run: cargo install --force cbindgen

- name: Cache Build Products
uses: actions/cache@v3
Expand Down Expand Up @@ -204,7 +207,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
6 changes: 4 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install cbindgen
run: cargo install --force cbindgen

- name: Cache Rust Build Products
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/
~/.cargo/git/
~/.cargo/
arbitrator/target/
arbitrator/wasm-libraries/target/
arbitrator/wasm-libraries/soft-float/SoftFloat/build
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
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -333,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
5 changes: 4 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
4 changes: 2 additions & 2 deletions arbitrator/jit/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ pub fn new_program(
)));
};

exec_program(exec, module, calldata, config, evm_data, gas)
launch_program_thread(exec, module, calldata, config, evm_data, gas)
}

pub fn exec_program(
pub fn launch_program_thread(
exec: &mut WasmEnv,
module: Arc<[u8]>,
calldata: Vec<u8>,
Expand Down
13 changes: 7 additions & 6 deletions arbitrator/tools/stylus_benchmark/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions arbitrator/tools/stylus_benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ stylus = { path = "../../stylus/", default-features = false }
clap = { version = "4.4.8", features = ["derive"] }
strum = "0.26"
strum_macros = "0.26"
rand = "0.8.5"
10 changes: 5 additions & 5 deletions arbitrator/tools/stylus_benchmark/src/benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021-2024, Offchain Labs, Inc.
// Copyright 2021-2025, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE

use arbutil::evm::{api::Ink, EvmData};
Expand Down Expand Up @@ -45,7 +45,7 @@ fn run(compiled_module: Vec<u8>) -> (Duration, Ink) {

let exec = &mut WasmEnv::default();

let module = jit::program::exec_program(
let module = jit::program::launch_program_thread(
exec,
compiled_module.into(),
calldata,
Expand Down Expand Up @@ -94,11 +94,11 @@ pub fn benchmark(wat: Vec<u8>) -> eyre::Result<()> {
durations = durations[l..r].to_vec();

let avg_duration = durations.iter().sum::<Duration>() / (r - l) as u32;
let avg_ink_spent_per_micro_second = ink_spent.0 / avg_duration.as_micros() as u64;
let avg_ink_spent_per_nano_second = ink_spent.0 / avg_duration.as_nanos() as u64;
println!("After discarding top and bottom runs: ");
println!(
"avg_duration: {:?}, avg_ink_spent_per_micro_second: {:?}",
avg_duration, avg_ink_spent_per_micro_second
"avg_duration: {:?}, avg_ink_spent_per_nano_second: {:?}",
avg_duration, avg_ink_spent_per_nano_second
);

Ok(())
Expand Down
12 changes: 6 additions & 6 deletions arbitrator/tools/stylus_benchmark/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright 2021-2024, Offchain Labs, Inc.
// Copyright 2021-2025, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE

mod benchmark;
mod scenario;
mod scenarios;

use clap::Parser;
use clap::{Parser, ValueEnum};
use scenario::Scenario;
use std::path::PathBuf;
use strum::IntoEnumIterator;

#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
Expand All @@ -20,7 +20,7 @@ struct Args {
}

fn handle_scenario(scenario: Scenario, output_wat_dir_path: Option<PathBuf>) -> eyre::Result<()> {
println!("Benchmarking {}", scenario);
println!("Benchmarking {:?}", scenario);
let wat = scenario::generate_wat(scenario, output_wat_dir_path);
benchmark::benchmark(wat)
}
Expand All @@ -32,8 +32,8 @@ fn main() -> eyre::Result<()> {
Some(scenario) => handle_scenario(scenario, args.output_wat_dir_path),
None => {
println!("No scenario specified, benchmarking all scenarios\n");
for scenario in Scenario::iter() {
let benchmark_result = handle_scenario(scenario, args.output_wat_dir_path.clone());
for scenario in Scenario::value_variants() {
let benchmark_result = handle_scenario(*scenario, args.output_wat_dir_path.clone());
if let Err(err) = benchmark_result {
return Err(err);
}
Expand Down
Loading

0 comments on commit 4be66d9

Please sign in to comment.