Skip to content

Commit

Permalink
Merge #4894
Browse files Browse the repository at this point in the history
4894: Bump casper-wasmi, add sign-ext support r=igor-casper a=igor-casper

This PR addresses #4855 by bumping casper-wasmi to 0.14.0

As a key takeaway, [sign-ext](https://github.com/WebAssembly/sign-extension-ops/blob/master/proposals/sign-extension-ops/Overview.md) ops were previously unsupported, which is no longer the case with the newest interpreter. The engine was updated to accommodate this change:
- chainspec was modified to include ''wasm.opcode_costs.sign'' field which dictates the cost of these ops
- certain execution engine tests no longer make sense, so they've been removed:
  - should_not_accept_sign_ext_i32_e8s_proposal_wasm
  - should_not_accept_sign_ext_i32_e16s_proposal_wasm
  - should_not_accept_sign_ext_i64_e8s_proposal_wasm
  - should_not_accept_sign_ext_i64_e16s_proposal_wasm
  - should_not_accept_sign_ext_i64_e32s_proposal_wasm
- the appropriate serialization error no longer mentions unsupported sign extension operators

This PR also bumps the supported nightly toolchain to 2024-07-31.

Co-authored-by: igor-casper <igor@casper.network>
Co-authored-by: Michał Papierski <michal@casper.network>
Co-authored-by: igor-casper <152597353+igor-casper@users.noreply.github.com>
  • Loading branch information
4 people authored Oct 3, 2024
2 parents ad1f16d + 55337d9 commit 515aac5
Show file tree
Hide file tree
Showing 39 changed files with 191 additions and 433 deletions.
85 changes: 54 additions & 31 deletions Cargo.lock

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

9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,11 @@ RUSTUP = $(or $(shell which rustup), $(HOME)/.cargo/bin/rustup)
NPM = $(or $(shell which npm), /usr/bin/npm)

PINNED_NIGHTLY := $(shell cat smart_contracts/rust-toolchain)
# TODO: When `PINNED_NIGHTLY` is updated to something reletively new, we can get rid
# of this specific 'NIGHTLY_FOR_DOC' variable and use `PINNED_NIGHTLY` in `make doc` instead.
#
# At the moment, we can't use STABLE for doc, due to 'doc_auto_cfg' feature being unstable.
# We also can't use the nightly version that is pinned for the contracts, because it is too old.
NIGHTLY_FOR_DOC = nightly-2024-01-01
PINNED_STABLE := $(shell sed -nr 's/channel *= *\"(.*)\"/\1/p' rust-toolchain.toml)
WASM_STRIP_VERSION := $(shell wasm-strip --version)

CARGO_OPTS := --locked
CARGO_PINNED_NIGHTLY := $(CARGO) +$(PINNED_NIGHTLY) $(CARGO_OPTS)
CARGO_NIGHTLY_FOR_DOC := $(CARGO) +$(NIGHTLY_FOR_DOC) $(CARGO_OPTS)
CARGO := $(CARGO) $(CARGO_OPTS)

DISABLE_LOGGING = RUST_LOG=MatchesNothing
Expand Down Expand Up @@ -164,7 +157,7 @@ audit: audit-rs

.PHONY: doc
doc:
RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--cfg docsrs" $(CARGO_NIGHTLY_FOR_DOC) doc --all-features $(CARGO_FLAGS) --no-deps
RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--cfg docsrs" $(CARGO_PINNED_NIGHTLY) doc --all-features $(CARGO_FLAGS) --no-deps
cd smart_contracts/contract && RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--cfg docsrs" $(CARGO_PINNED_NIGHTLY) doc --all-features $(CARGO_FLAGS) --no-deps

.PHONY: check-rs
Expand Down
3 changes: 0 additions & 3 deletions binary_port/src/response_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ use core::{convert::TryFrom, fmt};

#[cfg(test)]
use rand::Rng;
#[cfg(feature = "json-schema")]
use schemars::JsonSchema;

#[cfg(test)]
use casper_types::testing::TestRng;
Expand All @@ -32,7 +30,6 @@ use crate::{
/// A type of the payload being returned in a binary response.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[repr(u8)]
#[cfg_attr(feature = "json-schema", derive(JsonSchema))]
pub enum ResponseType {
/// Legacy version of the block header.
BlockHeaderV1,
Expand Down
4 changes: 0 additions & 4 deletions binary_port/src/type_wrappers.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use core::{convert::TryFrom, num::TryFromIntError, time::Duration};
use std::collections::BTreeMap;

#[cfg(feature = "datasize")]
use datasize::DataSize;

use casper_types::{
bytesrepr::{self, Bytes, FromBytes, ToBytes},
contracts::ContractHash,
Expand Down Expand Up @@ -76,7 +73,6 @@ impl TryFrom<Uptime> for TimeDiff {

/// Type representing changes in consensus validators.
#[derive(Debug, PartialEq, Eq, Serialize)]
#[cfg_attr(feature = "datasize", derive(DataSize))]
pub struct ConsensusValidatorChanges(BTreeMap<PublicKey, Vec<(EraId, ValidatorChange)>>);

impl ConsensusValidatorChanges {
Expand Down
6 changes: 3 additions & 3 deletions execution_engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ base16 = "0.2.1"
bincode = "1.3.1"
casper-storage = { version = "2.0.0", path = "../storage" }
casper-types = { version = "5.0.0", path = "../types", default-features = false, features = ["datasize", "gens", "json-schema", "std"] }
casper-wasm = { version = "0.46.0", default-features = false }
casper-wasm-utils = "3.0.0"
casper-wasmi = "0.13.2"
casper-wasm = { version = "0.46.0", default-features = false, features = ["sign_ext"] }
casper-wasm-utils = { version = "3.0.0", default-features = false, features = ["sign_ext"] }
casper-wasmi = { version = "0.14.0", features = ["sign_ext"] }
datasize = "0.2.4"
either = "1.8.1"
hex-buffer-serde = "0.2.1"
Expand Down
5 changes: 4 additions & 1 deletion execution_engine/src/engine_state/wasm_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,10 @@ impl TryFrom<&TransactionV1> for SessionInfo {
}
TransactionTarget::Stored { id, .. } => {
let TransactionEntryPoint::Custom(entry_point) = v1_txn.entry_point() else {
return Err(InvalidRequest::InvalidEntryPoint(transaction_hash, v1_txn.entry_point().to_string()));
return Err(InvalidRequest::InvalidEntryPoint(
transaction_hash,
v1_txn.entry_point().to_string(),
));
};
let item = ExecutableItem::Invocation(id.clone());
ExecutableInfo {
Expand Down
Loading

0 comments on commit 515aac5

Please sign in to comment.