Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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,120 changes: 1,188 additions & 932 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ ALL_CONTRACTS = $(shell find ./smart_contracts/contracts/[!.]* -mindepth 1 -m
CLIENT_CONTRACTS = $(shell find ./smart_contracts/contracts/client -mindepth 1 -maxdepth 1 -type d -exec basename {} \;)
CARGO_HOME_REMAP = $(if $(CARGO_HOME),$(CARGO_HOME),$(HOME)/.cargo)
RUSTC_FLAGS = "--remap-path-prefix=$(CARGO_HOME_REMAP)=/home/cargo --remap-path-prefix=$$PWD=/dir"
WASM_RUSTC_FLAGS = "--remap-path-prefix=$(CARGO_HOME_REMAP)=/home/cargo --remap-path-prefix=$$PWD=/dir -C target-feature=-bulk-memory,-bulk-memory-opt"

CONTRACT_TARGET_DIR = target/wasm32-unknown-unknown/release

build-contract-rs/%:
cd smart_contracts/contracts && RUSTFLAGS=$(RUSTC_FLAGS) $(CARGO) build --verbose --release $(filter-out --release, $(CARGO_FLAGS)) --package $*
cd smart_contracts/contracts && RUSTFLAGS=$(WASM_RUSTC_FLAGS) $(CARGO) build --verbose --release -Z build-std=std,core,alloc,panic_abort $(filter-out --release, $(CARGO_FLAGS)) --package $*

build-vm2-contract-rs/%:
RUSTFLAGS=$(RUSTC_FLAGS) $(CARGO) run -p cargo-casper --bin cargo-casper -- build-schema --package $*
cd smart_contracts/contracts/vm2 && RUSTFLAGS=$(RUSTC_FLAGS) $(CARGO) build --verbose --release $(filter-out --release, $(CARGO_FLAGS)) --package $*
CMAKE_POLICY_VERSION_MINIMUM=3.5 $(CARGO) build -p cargo-casper --bin cargo-casper
RUSTFLAGS=$(RUSTC_FLAGS) $(CURDIR)/target/debug/cargo-casper build-schema --package $*
cd smart_contracts/contracts/vm2 && RUSTFLAGS=$(WASM_RUSTC_FLAGS) $(CARGO) build --verbose --release -Z build-std=std,core,alloc,panic_abort $(filter-out --release, $(CARGO_FLAGS)) --package $*

.PHONY: build-vm2-contracts-rs
build-vm2-contracts-rs: $(patsubst %, build-vm2-contract-rs/%, $(VM2_CONTRACTS))
Expand Down Expand Up @@ -188,6 +190,7 @@ setup-rs:
$(RUSTUP) target add --toolchain $(PINNED_NIGHTLY) wasm32-unknown-unknown
$(RUSTUP) component add --toolchain $(PINNED_NIGHTLY) rustfmt clippy-preview
$(RUSTUP) component add --toolchain $(PINNED_STABLE) clippy-preview
$(RUSTUP) component add rust-src --toolchain $(PINNED_NIGHTLY)
$(CARGO) install cargo-audit

.PHONY: setup
Expand Down
2 changes: 1 addition & 1 deletion binary_port/src/error_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ impl From<InvalidTransactionV1> for ErrorCode {
InvalidTransactionV1::UnexpectedEntryPoint { .. } => {
ErrorCode::InvalidTransactionUnexpectedEntryPoint
}
InvalidTransactionV1::CouldNotSerializeTransaction { .. } => {
InvalidTransactionV1::CouldNotSerializeTransaction => {
ErrorCode::TransactionHasMalformedBinaryRepresentation
}
InvalidTransactionV1::InsufficientAmount { .. } => {
Expand Down
8 changes: 4 additions & 4 deletions execution_engine_testing/tests/src/test/explorer/faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,14 +663,14 @@ fn faucet_costs() {
// This test will fail if execution costs vary. The expected costs should not be updated
// without understanding why the cost has changed. If the costs do change, it should be
// reflected in the "Costs by Entry Point" section of the faucet crate's README.md.
const EXPECTED_FAUCET_INSTALL_COST: u64 = 149_181_711_315;
const EXPECTED_FAUCET_INSTALL_COST: u64 = 112_723_697_942;
const EXPECTED_FAUCET_INSTALL_COST_ALT: u64 = 149_230_872_143;

const EXPECTED_FAUCET_SET_VARIABLES_COST: u64 = 79_463_750;
const EXPECTED_FAUCET_SET_VARIABLES_COST: u64 = 79_796_780;

const EXPECTED_FAUCET_CALL_BY_INSTALLER_COST: u64 = 2_652_633_308;
const EXPECTED_FAUCET_CALL_BY_INSTALLER_COST: u64 = 2_652_960_368;

const EXPECTED_FAUCET_CALL_BY_USER_COST: u64 = 2_558_333_326;
const EXPECTED_FAUCET_CALL_BY_USER_COST: u64 = 2_558_834_176;

let installer_account = AccountHash::new([1u8; 32]);
let user_account: AccountHash = AccountHash::new([2u8; 32]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ fn should_run_ee_1152_regression_test() {

let (era_id, _) = era_validators
.into_iter()
.last()
.next_back()
.expect("should have last element");
assert!(era_id > INITIAL_ERA_ID, "{}", era_id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn regression_20220221_should_distribute_to_many_validators() {

let (era_id, trusted_era_validators) = era_validators
.into_iter()
.last()
.next_back()
.expect("should have last element");
assert!(era_id > INITIAL_ERA_ID, "{}", era_id);

Expand Down
8 changes: 4 additions & 4 deletions executor/wasmer_backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ casper-types = { version = "7.0.0", path = "../../types" }
regex = "1.11"
# Added rustls-webpki dependency to fix audit issue
rustls-webpki = "0.103.13"
wasmer = { version = "5.0.4", default-features = false, features = [
wasmer = { version = "6.1.0", default-features = false, features = [
"singlepass",
] }
wasmer-compiler-singlepass = "5.0.4"
wasmer-middlewares = "5.0.4"
wasmer-types = "5.0.4"
wasmer-compiler-singlepass = "6.1.0"
wasmer-middlewares = "6.1.0"
wasmer-types = "6.1.0"
tracing = "0.1.41"

[dev-dependencies]
Expand Down
5 changes: 4 additions & 1 deletion executor/wasmer_backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use middleware::{
};
use regex::Regex;
use wasmer::{
AsStoreMut, AsStoreRef, CompilerConfig, Engine, Function, FunctionEnv, FunctionEnvMut,
sys::CompilerConfig, AsStoreMut, AsStoreRef, Engine, Function, FunctionEnv, FunctionEnvMut,
Instance, Memory, MemoryView, Module, RuntimeError, Store, StoreMut, Table, TypedFunction,
};
use wasmer_compiler_singlepass::Singlepass;
Expand Down Expand Up @@ -64,6 +64,9 @@ fn from_wasmer_trap_code(value: wasmer_types::TrapCode) -> TrapCode {
wasmer_types::TrapCode::UnalignedAtomic => {
todo!("Atomic memory extension is not supported")
}
wasmer_types::TrapCode::UncaughtException => {
unreachable!("Wasm exceptions extension is not supported")
}
}
}

Expand Down
13 changes: 12 additions & 1 deletion executor/wasmer_backend/src/middleware/gas_metering.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

use wasmer::{wasmparser::Operator, ModuleMiddleware};
use wasmer::{sys::ModuleMiddleware, wasmparser::Operator};
use wasmer_middlewares::Metering;

/// Calculated based on the benchmark results and fitted for approx ~1000 CSPR of computation and
Expand Down Expand Up @@ -625,7 +625,18 @@ fn cycles(operator: &Operator) -> u64 {
| Operator::ArrayAtomicRmwXor { .. }
| Operator::ArrayAtomicRmwXchg { .. }
| Operator::ArrayAtomicRmwCmpxchg { .. }
| Operator::ContNew { .. }
| Operator::ContBind { .. }
| Operator::Suspend { .. }
| Operator::Resume { .. }
| Operator::ResumeThrow { .. }
| Operator::Switch { .. }
| Operator::I64Add128
| Operator::I64Sub128
| Operator::I64MulWideS
| Operator::I64MulWideU
| Operator::RefI31Shared => todo!("{operator:?}"),
_ => todo!("{operator:?}") // We need to add a wildcart here since Operator uses #[non_exhaustive]
}
}

Expand Down
Loading
Loading