Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
4b34ff8
testsuite
rachel-bousfield May 5, 2022
9469a5c
fix off by one
rachel-bousfield May 5, 2022
e4cb1e0
temp memory fixes
rachel-bousfield May 7, 2022
ee31fc2
add wasm-testsuite gitignore
rachel-bousfield May 7, 2022
536b198
Merge branch 'arbitrator-block-fixes' into wasm-testsuite
rachel-bousfield May 7, 2022
6870783
fix truncation & add saturating trunc
rachel-bousfield May 9, 2022
ea17931
error on divide by 0
rachel-bousfield May 9, 2022
e35f683
fix signed int overflows
rachel-bousfield May 9, 2022
3961eaf
fix div check
rachel-bousfield May 10, 2022
fabe0bb
run inits & actions
rachel-bousfield May 10, 2022
1ddf222
Merge branch 'arbitrator-block-fixes' into wasm-testsuite
rachel-bousfield May 10, 2022
1b801fc
improve page limit
rachel-bousfield May 10, 2022
bc4299f
Merge branch 'arbitrator-block-fixes' into wasm-testsuite
rachel-bousfield May 10, 2022
acfff03
increase step count
rachel-bousfield May 10, 2022
44485de
tests pass sans proving
rachel-bousfield May 11, 2022
3e3fa74
make proofs
rachel-bousfield May 11, 2022
2caf38c
spec proofs
rachel-bousfield May 12, 2022
9035873
fix osp div & skip soft float
rachel-bousfield May 12, 2022
996aebc
Merge branch 'master' into wasm-testsuite
rachel-bousfield May 12, 2022
34d32a4
adopt changes into wasm-testsuite
rachel-bousfield May 12, 2022
7ee770e
improve performance
rachel-bousfield May 12, 2022
7fb4332
format toml
rachel-bousfield May 12, 2022
104f1bf
add memory size
rachel-bousfield May 12, 2022
cef34b8
change float32 & float64 tests to use saturating math
rachel-bousfield May 12, 2022
3c2cd8f
enforce new memory limit in OSP
rachel-bousfield May 12, 2022
9b4a017
tweak .gitignore
rachel-bousfield May 12, 2022
d5a5003
Merge branch 'master' into wasm-testsuite
rachel-bousfield May 12, 2022
44c492a
use https for submodule
rachel-bousfield May 12, 2022
73bea96
remove duplicate submodule
rachel-bousfield May 12, 2022
a9bb9fc
Merge branch 'master' into wasm-testsuite
rachel-bousfield May 12, 2022
612a8f8
fix dockerfile
rachel-bousfield May 13, 2022
f2381cd
Merge branch 'master' into wasm-testsuite
rachel-bousfield May 13, 2022
e04af64
exclude spec-proofs if not present
rachel-bousfield May 13, 2022
e4a92a5
Merge branch 'master' into wasm-testsuite
rachel-bousfield May 13, 2022
a135a84
fix fuzzer & complete merge
rachel-bousfield May 13, 2022
91382ec
make wasm-testsuite its own workspace
rachel-bousfield May 13, 2022
1c36927
Merge branch 'master' into wasm-testsuite
rachel-bousfield May 13, 2022
0ce2d81
Merge branch 'master' into wasm-testsuite
rachel-bousfield May 13, 2022
4676ce6
Merge branch 'master' into wasm-testsuite
rachel-bousfield May 23, 2022
24bed53
Merge branch 'master' into wasm-testsuite
rachel-bousfield Jun 1, 2022
6ee205b
Merge branch 'devnet-reinit-1' into wasm-testsuite
rachel-bousfield Jun 10, 2022
9ddde5a
Remove unused WAVM opcodes
PlasmaPower Jun 10, 2022
d934588
address review comments
rachel-bousfield Jun 17, 2022
c5fb345
Merge branch 'wasm-testsuite' into rm-unused-opcodes
rachel-bousfield Jun 17, 2022
dddde4b
remove wavm blocks
rachel-bousfield Jun 17, 2022
13b907d
Merge pull request #686 from OffchainLabs/rm-unused-opcodes
rachel-bousfield Jun 17, 2022
c9f17af
Merge pull request #700 from OffchainLabs/rm-wavm-blocks
PlasmaPower Jun 17, 2022
13baf87
use remote types
rachel-bousfield Jun 17, 2022
1125114
Merge pull request #701 from OffchainLabs/arbitrator-remote-type-todos
PlasmaPower Jun 17, 2022
16cb33f
Merge remote-tracking branch 'origin/redo-devnet-reinit-1' into wasm-…
rachel-bousfield Jun 17, 2022
2d2593b
address review commetns
rachel-bousfield Jun 17, 2022
1105cd4
fix osp type
rachel-bousfield Jun 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/arbitrator-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --manifest-path arbitrator/Cargo.toml
args: --all --manifest-path arbitrator/Cargo.toml -- -D warnings

- name: Run rust tests
uses: actions-rs/cargo@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ contracts/cache/
solgen/go/
contracts/deployments/
contracts/test/prover/proofs/*.json
contracts/test/prover/spec-proofs/*.json
.make/
/cmd/statetransfer/statetransfer
/reproducible-wasm/*.wasm
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "blockscout"]
path = blockscout
url = https://github.com/OffchainLabs/blockscout.git
[submodule "arbitrator/wasm-testsuite/testsuite"]
path = arbitrator/wasm-testsuite/testsuite
url = https://github.com/WebAssembly/testsuite.git
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y make && \
cargo install --force cbindgen
COPY arbitrator/Cargo.* arbitrator/cbindgen.toml arbitrator/
COPY arbitrator/prover/Cargo.toml arbitrator/prover/
COPY ./Makefile ./
COPY arbitrator/prover arbitrator/prover
RUN NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-prover-header
Expand Down
70 changes: 13 additions & 57 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ clean:
rm -rf arbitrator/prover/test-cases/rust/target
rm -f arbitrator/prover/test-cases/*.wasm
rm -f arbitrator/prover/test-cases/go/main
rm -rf arbitrator/wasm-testsuite/tests
rm -rf $(output_root)
rm -f contracts/test/prover/proofs/*.json
rm -f contracts/test/prover/proofs/*.json contracts/test/prover/spec-proofs/*.json
rm -rf arbitrator/target
rm -rf arbitrator/wasm-libraries/target
rm -f arbitrator/wasm-libraries/soft-float/soft-float.wasm
Expand Down Expand Up @@ -214,62 +215,16 @@ $(output_root)/machines/latest/soft-float.wasm: $(DEP_PREDICATE) \
arbitrator/wasm-libraries/soft-float/bindings64.o \
arbitrator/wasm-libraries/soft-float/SoftFloat/build/Wasm-Clang/*.o \
--no-entry -o $@ \
--export wavm__f32_abs \
--export wavm__f32_neg \
--export wavm__f32_ceil \
--export wavm__f32_floor \
--export wavm__f32_trunc \
--export wavm__f32_nearest \
--export wavm__f32_sqrt \
--export wavm__f32_add \
--export wavm__f32_sub \
--export wavm__f32_mul \
--export wavm__f32_div \
--export wavm__f32_min \
--export wavm__f32_max \
--export wavm__f32_copysign \
--export wavm__f32_eq \
--export wavm__f32_ne \
--export wavm__f32_lt \
--export wavm__f32_le \
--export wavm__f32_gt \
--export wavm__f32_ge \
--export wavm__i32_trunc_f32_s \
--export wavm__i32_trunc_f32_u \
--export wavm__i64_trunc_f32_s \
--export wavm__i64_trunc_f32_u \
--export wavm__f32_convert_i32_s \
--export wavm__f32_convert_i32_u \
--export wavm__f32_convert_i64_s \
--export wavm__f32_convert_i64_u \
--export wavm__f64_abs \
--export wavm__f64_neg \
--export wavm__f64_ceil \
--export wavm__f64_floor \
--export wavm__f64_trunc \
--export wavm__f64_nearest \
--export wavm__f64_sqrt \
--export wavm__f64_add \
--export wavm__f64_sub \
--export wavm__f64_mul \
--export wavm__f64_div \
--export wavm__f64_min \
--export wavm__f64_max \
--export wavm__f64_copysign \
--export wavm__f64_eq \
--export wavm__f64_ne \
--export wavm__f64_lt \
--export wavm__f64_le \
--export wavm__f64_gt \
--export wavm__f64_ge \
--export wavm__i32_trunc_f64_s \
--export wavm__i32_trunc_f64_u \
--export wavm__i64_trunc_f64_s \
--export wavm__i64_trunc_f64_u \
--export wavm__f64_convert_i32_s \
--export wavm__f64_convert_i32_u \
--export wavm__f64_convert_i64_s \
--export wavm__f64_convert_i64_u \
$(patsubst %,--export wavm__f32_%, abs neg ceil floor trunc nearest sqrt add sub mul div min max) \
$(patsubst %,--export wavm__f32_%, copysign eq ne lt le gt ge) \
$(patsubst %,--export wavm__f64_%, abs neg ceil floor trunc nearest sqrt add sub mul div min max) \
$(patsubst %,--export wavm__f64_%, copysign eq ne lt le gt ge) \
$(patsubst %,--export wavm__i32_trunc_%, f32_s f32_u f64_s f64_u) \
$(patsubst %,--export wavm__i32_trunc_sat_%, f32_s f32_u f64_s f64_u) \
$(patsubst %,--export wavm__i64_trunc_%, f32_s f32_u f64_s f64_u) \
$(patsubst %,--export wavm__i64_trunc_sat_%, f32_s f32_u f64_s f64_u) \
$(patsubst %,--export wavm__f32_convert_%, i32_s i32_u i64_s i64_u) \
$(patsubst %,--export wavm__f64_convert_%, i32_s i32_u i64_s i64_u) \
--export wavm__f32_demote_f64 \
--export wavm__f64_promote_f32

Expand Down Expand Up @@ -323,6 +278,7 @@ contracts/test/prover/proofs/%.json: arbitrator/prover/test-cases/%.wasm $(arbit
.make/fmt: $(DEP_PREDICATE) build-node-deps .make/yarndeps $(ORDER_ONLY_PREDICATE) .make
golangci-lint run --disable-all -E gofmt --fix
cargo fmt --all --manifest-path arbitrator/Cargo.toml -- --check
cargo fmt --all --manifest-path arbitrator/wasm-testsuite/Cargo.toml -- --check
yarn --cwd contracts prettier:solidity
@touch $@

Expand Down
2 changes: 1 addition & 1 deletion arbitrator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
members = [
"prover",
"prover",
]

[profile.release]
Expand Down
1 change: 1 addition & 0 deletions arbitrator/prover/fuzz/fuzz_targets/osp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ fn fuzz_impl(data: &[u8]) -> Result<()> {
&[],
wavm_binary,
true,
true,
false,
GlobalState::default(),
Default::default(),
Expand Down
15 changes: 8 additions & 7 deletions arbitrator/prover/src/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ pub enum FloatInstruction {
UnOp(FloatType, FloatUnOp),
BinOp(FloatType, FloatBinOp),
RelOp(FloatType, FloatRelOp),
TruncIntOp(IntegerValType, FloatType, bool),
/// The bools represent (saturating, signed)
TruncIntOp(IntegerValType, FloatType, bool, bool),
ConvertIntOp(FloatType, IntegerValType, bool),
F32DemoteF64,
F64PromoteF32,
Expand All @@ -80,7 +81,7 @@ impl FloatInstruction {
FloatInstruction::RelOp(t, _) => {
FunctionType::new(vec![t.into(); 2], vec![ArbValueType::I32])
}
FloatInstruction::TruncIntOp(i, f, _) => {
FloatInstruction::TruncIntOp(i, f, ..) => {
FunctionType::new(vec![f.into()], vec![i.into()])
}
FloatInstruction::ConvertIntOp(f, i, _) => {
Expand Down Expand Up @@ -171,12 +172,15 @@ impl FromStr for FloatInstruction {
map(
all_consuming(tuple((
parse_int_type,
tag("_trunc_"),
alt((
value(true, tag("_trunc_sat_")),
value(false, tag("_trunc_")),
)),
parse_fp_type,
tag("_"),
parse_signedness,
))),
|(i, _, f, _, s)| FloatInstruction::TruncIntOp(i, f, s),
|(i, sat, f, _, s)| FloatInstruction::TruncIntOp(i, f, sat, s),
),
map(
all_consuming(tuple((
Expand Down Expand Up @@ -230,9 +234,6 @@ pub struct Local {
pub struct NameCustomSection {
pub module: String,
pub functions: HashMap<u32, String>,
// TODO: remove this when re-initializing the rollup
// this is kept around to deserialize old binaries
pub _locals_removed: HashMap<u32, HashMap<u32, String>>,
}

#[derive(Clone, Default)]
Expand Down
85 changes: 85 additions & 0 deletions arbitrator/prover/src/console.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/nitro/blob/master/LICENSE

#![allow(dead_code)]

use std::fmt;

pub struct Color;

impl Color {
pub const RED: &'static str = "\x1b[31;1m";
pub const BLUE: &'static str = "\x1b[34;1m";
pub const YELLOW: &'static str = "\x1b[33;1m";
pub const PINK: &'static str = "\x1b[38;5;161;1m";
pub const MINT: &'static str = "\x1b[38;5;48;1m";
pub const GREY: &'static str = "\x1b[90m";
pub const RESET: &'static str = "\x1b[0;0m";

pub const LIME: &'static str = "\x1b[38;5;119;1m";
pub const LAVENDER: &'static str = "\x1b[38;5;183;1m";
pub const MAROON: &'static str = "\x1b[38;5;124;1m";
pub const ORANGE: &'static str = "\x1b[38;5;202;1m";

pub fn color<S: fmt::Display>(color: &str, text: S) -> String {
format!("{}{}{}", color, text, Color::RESET)
}

/// Colors text red.
pub fn red<S: fmt::Display>(text: S) -> String {
Color::color(Color::RED, text)
}

/// Colors text blue.
pub fn blue<S: fmt::Display>(text: S) -> String {
Color::color(Color::BLUE, text)
}

/// Colors text yellow.
pub fn yellow<S: fmt::Display>(text: S) -> String {
Color::color(Color::YELLOW, text)
}

/// Colors text pink.
pub fn pink<S: fmt::Display>(text: S) -> String {
Color::color(Color::PINK, text)
}

/// Colors text grey.
pub fn grey<S: fmt::Display>(text: S) -> String {
Color::color(Color::GREY, text)
}

/// Colors text lavender.
pub fn lavender<S: fmt::Display>(text: S) -> String {
Color::color(Color::LAVENDER, text)
}

/// Colors text mint.
pub fn mint<S: fmt::Display>(text: S) -> String {
Color::color(Color::MINT, text)
}

/// Colors text lime.
pub fn lime<S: fmt::Display>(text: S) -> String {
Color::color(Color::LIME, text)
}

/// Colors text orange.
pub fn orange<S: fmt::Display>(text: S) -> String {
Color::color(Color::ORANGE, text)
}

/// Colors text maroon.
pub fn maroon<S: fmt::Display>(text: S) -> String {
Color::color(Color::MAROON, text)
}

/// Color a bool one of two colors depending on its value.
pub fn color_if(cond: bool, true_color: &str, false_color: &str) -> String {
match cond {
true => Color::color(true_color, &format!("{}", cond)),
false => Color::color(false_color, &format!("{}", cond)),
}
}
}
7 changes: 5 additions & 2 deletions arbitrator/prover/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/nitro/blob/master/LICENSE

#![allow(clippy::missing_safety_doc)] // We have a lot of unsafe ABI
#![allow(clippy::missing_safety_doc, clippy::too_many_arguments)]

pub mod binary;
/// cbindgen:ignore
pub mod console;
mod host;
pub mod machine;
/// cbindgen:ignore
mod memory;
mod merkle;
mod reinterpret;
pub mod utils;
mod value;
pub mod value;
pub mod wavm;

use crate::machine::{argument_data_to_inbox, Machine};
Expand Down Expand Up @@ -77,6 +79,7 @@ unsafe fn arbitrator_load_machine_impl(
let mach = Machine::from_paths(
&libraries,
binary_path,
true,
false,
false,
Default::default(),
Expand Down
Loading