From 7779079c0bb8ecbc3d0e7a3660bef18c3ea96bef Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Thu, 16 Nov 2023 14:07:19 +0100 Subject: [PATCH 1/8] Add instantiate + migrate flags to AnalysisReport --- packages/vm/src/cache.rs | 36 +++++++++++++- packages/vm/src/static_analysis.rs | 80 ------------------------------ 2 files changed, 34 insertions(+), 82 deletions(-) diff --git a/packages/vm/src/cache.rs b/packages/vm/src/cache.rs index b4d1d9ea8e..2f816991b4 100644 --- a/packages/vm/src/cache.rs +++ b/packages/vm/src/cache.rs @@ -16,7 +16,7 @@ use crate::instance::{Instance, InstanceOptions}; use crate::modules::{CachedModule, FileSystemCache, InMemoryCache, PinnedMemoryCache}; use crate::parsed_wasm::ParsedWasm; use crate::size::Size; -use crate::static_analysis::has_ibc_entry_points; +use crate::static_analysis::{ExportInfo, REQUIRED_IBC_EXPORTS}; use crate::wasm_backend::{compile, make_compiling_engine, make_runtime_engine}; const STATE_DIR: &str = "state"; @@ -117,7 +117,16 @@ pub struct Cache { #[derive(PartialEq, Eq, Debug)] pub struct AnalysisReport { + /// `true` if and only if all [`REQUIRED_IBC_EXPORTS`] exist as exported functions. + /// This does not guarantee they are functional or even have the correct signatures. pub has_ibc_entry_points: bool, + /// `true` if the module has an `instantiate` export. + /// This does not guarantee it is functional or even has the correct signature. + pub has_instantiate_entry_point: bool, + /// `true` if the module has a `migrate` export. + /// This does not guarantee it is functional or even has the correct signature. + pub has_migrate_entry_point: bool, + /// The set of capabilities the contract requires. pub required_capabilities: HashSet, } @@ -274,8 +283,14 @@ where // Here we could use a streaming deserializer to slightly improve performance. However, this way it is DRYer. let wasm = self.load_wasm(checksum)?; let module = ParsedWasm::parse(&wasm)?; + let exports = module.exported_function_names(None); + Ok(AnalysisReport { - has_ibc_entry_points: has_ibc_entry_points(&module), + has_ibc_entry_points: REQUIRED_IBC_EXPORTS + .iter() + .all(|required| exports.contains(*required)), + has_instantiate_entry_point: exports.contains("instantiate"), + has_migrate_entry_point: exports.contains("migrate"), required_capabilities: required_capabilities_from_module(&module), }) } @@ -538,6 +553,7 @@ mod tests { static CONTRACT: &[u8] = include_bytes!("../testdata/hackatom.wasm"); static IBC_CONTRACT: &[u8] = include_bytes!("../testdata/ibc_reflect.wasm"); + static EMPTY_CONTRACT: &[u8] = include_bytes!("../testdata/empty.wasm"); // Invalid because it doesn't contain required memory and exports static INVALID_CONTRACT_WAT: &str = r#"(module (type $t0 (func (param i32) (result i32))) @@ -1289,6 +1305,8 @@ mod tests { report1, AnalysisReport { has_ibc_entry_points: false, + has_instantiate_entry_point: true, + has_migrate_entry_point: true, required_capabilities: HashSet::new(), } ); @@ -1299,12 +1317,26 @@ mod tests { report2, AnalysisReport { has_ibc_entry_points: true, + has_instantiate_entry_point: true, + has_migrate_entry_point: true, required_capabilities: HashSet::from_iter([ "iterator".to_string(), "stargate".to_string() ]), } ); + + let checksum3 = cache.save_wasm(EMPTY_CONTRACT).unwrap(); + let report3 = cache.analyze(&checksum3).unwrap(); + assert_eq!( + report3, + AnalysisReport { + has_ibc_entry_points: false, + has_instantiate_entry_point: false, + has_migrate_entry_point: false, + required_capabilities: HashSet::from(["iterator".to_string()]), + } + ); } #[test] diff --git a/packages/vm/src/static_analysis.rs b/packages/vm/src/static_analysis.rs index 7e20fb95f3..6b87dd58c0 100644 --- a/packages/vm/src/static_analysis.rs +++ b/packages/vm/src/static_analysis.rs @@ -60,16 +60,6 @@ impl ExportInfo for &wasmer::Module { } } -/// Returns true if and only if all IBC entry points ([`REQUIRED_IBC_EXPORTS`]) -/// exist as exported functions. This does not guarantee the entry points -/// are functional and for simplicity does not even check their signatures. -pub fn has_ibc_entry_points(module: impl ExportInfo) -> bool { - let available_exports = module.exported_function_names(None); - REQUIRED_IBC_EXPORTS - .iter() - .all(|required| available_exports.contains(*required)) -} - #[cfg(test)] mod tests { use crate::VmError; @@ -225,74 +215,4 @@ mod tests { HashSet::from_iter(vec!["bar".to_string(), "baz".to_string()]) ); } - - #[test] - fn has_ibc_entry_points_works() { - // Non-IBC contract - let wasm = wat::parse_str( - r#"(module - (memory 3) - (export "memory" (memory 0)) - - (type (func)) - (func (type 0) nop) - (export "interface_version_8" (func 0)) - (export "instantiate" (func 0)) - (export "allocate" (func 0)) - (export "deallocate" (func 0)) - )"#, - ) - .unwrap(); - let module = ParsedWasm::parse(&wasm).unwrap(); - assert!(!has_ibc_entry_points(&module)); - - // IBC contract - let wasm = wat::parse_str( - r#"(module - (memory 3) - (export "memory" (memory 0)) - - (type (func)) - (func (type 0) nop) - (export "interface_version_8" (func 0)) - (export "instantiate" (func 0)) - (export "execute" (func 0)) - (export "allocate" (func 0)) - (export "deallocate" (func 0)) - (export "ibc_channel_open" (func 0)) - (export "ibc_channel_connect" (func 0)) - (export "ibc_channel_close" (func 0)) - (export "ibc_packet_receive" (func 0)) - (export "ibc_packet_ack" (func 0)) - (export "ibc_packet_timeout" (func 0)) - )"#, - ) - .unwrap(); - let module = ParsedWasm::parse(&wasm).unwrap(); - assert!(has_ibc_entry_points(&module)); - - // Missing packet ack - let wasm = wat::parse_str( - r#"(module - (memory 3) - (export "memory" (memory 0)) - - (type (func)) - (func (type 0) nop) - (export "interface_version_8" (func 0)) - (export "instantiate" (func 0)) - (export "execute" (func 0)) - (export "allocate" (func 0)) - (export "deallocate" (func 0)) - (export "ibc_channel_open" (func 0)) - (export "ibc_channel_connect" (func 0)) - (export "ibc_channel_close" (func 0)) - (export "ibc_packet_receive" (func 0)) - (export "ibc_packet_timeout" (func 0)) - )"#, - ) - .unwrap(); - let module = ParsedWasm::parse(&wasm).unwrap(); - assert!(!has_ibc_entry_points(&module)); - } } From 486ee784a7ac4d024a2c797b8b863a13a6a2413c Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Thu, 16 Nov 2023 17:14:45 +0100 Subject: [PATCH 2/8] Add Entrypoint enum --- Cargo.lock | 35 ++++++++++++++++++++ packages/vm/Cargo.toml | 9 +++--- packages/vm/src/cache.rs | 35 +++++++++++--------- packages/vm/src/static_analysis.rs | 51 ++++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eb4f764799..62ff478877 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -538,6 +538,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.6", + "strum", "target-lexicon", "tempfile", "thiserror", @@ -1179,6 +1180,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1853,6 +1860,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.13" @@ -2082,6 +2095,28 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.28", +] + [[package]] name = "subtle" version = "2.4.1" diff --git a/packages/vm/Cargo.toml b/packages/vm/Cargo.toml index f3211bcf3b..08fb119bd0 100644 --- a/packages/vm/Cargo.toml +++ b/packages/vm/Cargo.toml @@ -35,7 +35,7 @@ allow_interface_version_7 = [] bench = false [dependencies] -bytes = "1.4.0" # need a higher version than the one required by Wasmer for the Bytes -> Vec implementation +bytes = "1.4.0" # need a higher version than the one required by Wasmer for the Bytes -> Vec implementation clru = "0.6.1" crc32fast = "1.3.2" # Uses the path when built locally; uses the given version from crates.io when published @@ -50,12 +50,13 @@ sha2 = "0.10.3" thiserror = "1.0.26" wasmer = { version = "=4.2.2", default-features = false, features = ["cranelift", "singlepass"] } wasmer-middlewares = "=4.2.2" +strum = { version = "0.25.0", default-features = false, features = ["derive"] } # Dependencies that we do not use ourself. We add those entries # to bump the min version of them. bytecheck = "0.6.3" # With this version the simdutf8 dependency became optional -enumset = "1.0.2" # Fixes https://github.com/Lymia/enumset/issues/17 (https://github.com/Lymia/enumset/commit/a430550cd6a3c9b1ef636d37f75dede7616f5b62) -bitflags = "1.1.0" # https://github.com/CensoredUsername/dynasm-rs/pull/74 +enumset = "1.0.2" # Fixes https://github.com/Lymia/enumset/issues/17 (https://github.com/Lymia/enumset/commit/a430550cd6a3c9b1ef636d37f75dede7616f5b62) +bitflags = "1.1.0" # https://github.com/CensoredUsername/dynasm-rs/pull/74 # Wasmer git/local (used for quick local debugging or patching) # wasmer = { git = "https://github.com/wasmerio/wasmer", rev = "877ce1f7c44fad853c", default-features = false, features = ["cranelift", "singlepass"] } @@ -64,7 +65,7 @@ bitflags = "1.1.0" # https://github.com/CensoredUsername/dynasm-rs/pull/74 # wasmer-middlewares = { path = "../../../wasmer/lib/middlewares" } [dev-dependencies] -criterion = { version = "0.4", features = [ "html_reports" ] } +criterion = { version = "0.4", features = ["html_reports"] } glob = "0.3.1" hex-literal = "0.3.1" tempfile = "3.1.0" diff --git a/packages/vm/src/cache.rs b/packages/vm/src/cache.rs index 2f816991b4..536d4793c2 100644 --- a/packages/vm/src/cache.rs +++ b/packages/vm/src/cache.rs @@ -3,6 +3,7 @@ use std::fs::{self, File, OpenOptions}; use std::io::{Read, Write}; use std::marker::PhantomData; use std::path::{Path, PathBuf}; +use std::str::FromStr; use std::sync::Mutex; use wasmer::{Engine, Store}; @@ -16,7 +17,7 @@ use crate::instance::{Instance, InstanceOptions}; use crate::modules::{CachedModule, FileSystemCache, InMemoryCache, PinnedMemoryCache}; use crate::parsed_wasm::ParsedWasm; use crate::size::Size; -use crate::static_analysis::{ExportInfo, REQUIRED_IBC_EXPORTS}; +use crate::static_analysis::{Entrypoint, ExportInfo, REQUIRED_IBC_EXPORTS}; use crate::wasm_backend::{compile, make_compiling_engine, make_runtime_engine}; const STATE_DIR: &str = "state"; @@ -120,12 +121,8 @@ pub struct AnalysisReport { /// `true` if and only if all [`REQUIRED_IBC_EXPORTS`] exist as exported functions. /// This does not guarantee they are functional or even have the correct signatures. pub has_ibc_entry_points: bool, - /// `true` if the module has an `instantiate` export. - /// This does not guarantee it is functional or even has the correct signature. - pub has_instantiate_entry_point: bool, - /// `true` if the module has a `migrate` export. - /// This does not guarantee it is functional or even has the correct signature. - pub has_migrate_entry_point: bool, + /// A set of all entrypoints that are exported by the contract. + pub entrypoints: HashSet, /// The set of capabilities the contract requires. pub required_capabilities: HashSet, } @@ -285,12 +282,16 @@ where let module = ParsedWasm::parse(&wasm)?; let exports = module.exported_function_names(None); + let entrypoints = exports + .iter() + .filter_map(|export| Entrypoint::from_str(export).ok()) + .collect(); + Ok(AnalysisReport { has_ibc_entry_points: REQUIRED_IBC_EXPORTS .iter() .all(|required| exports.contains(*required)), - has_instantiate_entry_point: exports.contains("instantiate"), - has_migrate_entry_point: exports.contains("migrate"), + entrypoints, required_capabilities: required_capabilities_from_module(&module), }) } @@ -1296,6 +1297,7 @@ mod tests { #[test] fn analyze_works() { + use Entrypoint as E; let cache: Cache = unsafe { Cache::new(make_stargate_testing_options()).unwrap() }; @@ -1305,8 +1307,13 @@ mod tests { report1, AnalysisReport { has_ibc_entry_points: false, - has_instantiate_entry_point: true, - has_migrate_entry_point: true, + entrypoints: HashSet::from([ + E::Instantiate, + E::Migrate, + E::Sudo, + E::Execute, + E::Query + ]), required_capabilities: HashSet::new(), } ); @@ -1317,8 +1324,7 @@ mod tests { report2, AnalysisReport { has_ibc_entry_points: true, - has_instantiate_entry_point: true, - has_migrate_entry_point: true, + entrypoints: HashSet::from([E::Instantiate, E::Reply, E::Query]), required_capabilities: HashSet::from_iter([ "iterator".to_string(), "stargate".to_string() @@ -1332,8 +1338,7 @@ mod tests { report3, AnalysisReport { has_ibc_entry_points: false, - has_instantiate_entry_point: false, - has_migrate_entry_point: false, + entrypoints: HashSet::new(), required_capabilities: HashSet::from(["iterator".to_string()]), } ); diff --git a/packages/vm/src/static_analysis.rs b/packages/vm/src/static_analysis.rs index 6b87dd58c0..3c718b0526 100644 --- a/packages/vm/src/static_analysis.rs +++ b/packages/vm/src/static_analysis.rs @@ -1,9 +1,40 @@ use std::collections::HashSet; +use strum::{Display, EnumString}; use wasmer::wasmparser::ExternalKind; use crate::parsed_wasm::ParsedWasm; +/// An enum containing all available contract entrypoints. +/// This also provides conversions to and from strings. +#[derive(PartialEq, Eq, Debug, Clone, Copy, Hash, EnumString, Display)] +pub enum Entrypoint { + #[strum(serialize = "instantiate")] + Instantiate, + #[strum(serialize = "execute")] + Execute, + #[strum(serialize = "migrate")] + Migrate, + #[strum(serialize = "sudo")] + Sudo, + #[strum(serialize = "reply")] + Reply, + #[strum(serialize = "query")] + Query, + #[strum(serialize = "ibc_channel_open")] + IbcChannelOpen, + #[strum(serialize = "ibc_channel_connect")] + IbcChannelConnect, + #[strum(serialize = "ibc_channel_close")] + IbcChannelClose, + #[strum(serialize = "ibc_packet_receive")] + IbcPacketReceive, + #[strum(serialize = "ibc_packet_ack")] + IbcPacketAck, + #[strum(serialize = "ibc_packet_timeout")] + IbcPacketTimeout, +} + pub const REQUIRED_IBC_EXPORTS: &[&str] = &[ "ibc_channel_open", "ibc_channel_connect", @@ -62,6 +93,8 @@ impl ExportInfo for &wasmer::Module { #[cfg(test)] mod tests { + use std::str::FromStr; + use crate::VmError; use super::*; @@ -215,4 +248,22 @@ mod tests { HashSet::from_iter(vec!["bar".to_string(), "baz".to_string()]) ); } + + #[test] + fn entrypoint_from_string_works() { + assert_eq!( + Entrypoint::from_str("ibc_channel_open").unwrap(), + Entrypoint::IbcChannelOpen + ); + + assert!(Entrypoint::from_str("IbcChannelConnect").is_err()); + } + + #[test] + fn entrypoint_display_works() { + assert_eq!( + Entrypoint::IbcPacketTimeout.to_string(), + "ibc_packet_timeout".to_string() + ); + } } From 2b0fa2fe065da7897a2e7009984c5f7eb87d4bb9 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Thu, 16 Nov 2023 17:23:49 +0100 Subject: [PATCH 3/8] Use Entrypoint type for ibc entrypoints --- packages/vm/src/cache.rs | 7 +++++-- packages/vm/src/static_analysis.rs | 25 +++++++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/packages/vm/src/cache.rs b/packages/vm/src/cache.rs index 536d4793c2..60f434d728 100644 --- a/packages/vm/src/cache.rs +++ b/packages/vm/src/cache.rs @@ -290,7 +290,7 @@ where Ok(AnalysisReport { has_ibc_entry_points: REQUIRED_IBC_EXPORTS .iter() - .all(|required| exports.contains(*required)), + .all(|required| exports.contains(<&str>::from(required))), entrypoints, required_capabilities: required_capabilities_from_module(&module), }) @@ -1320,11 +1320,14 @@ mod tests { let checksum2 = cache.save_wasm(IBC_CONTRACT).unwrap(); let report2 = cache.analyze(&checksum2).unwrap(); + let mut ibc_contract_entrypoints = + HashSet::from([E::Instantiate, E::Migrate, E::Reply, E::Query]); + ibc_contract_entrypoints.extend(REQUIRED_IBC_EXPORTS); assert_eq!( report2, AnalysisReport { has_ibc_entry_points: true, - entrypoints: HashSet::from([E::Instantiate, E::Reply, E::Query]), + entrypoints: ibc_contract_entrypoints, required_capabilities: HashSet::from_iter([ "iterator".to_string(), "stargate".to_string() diff --git a/packages/vm/src/static_analysis.rs b/packages/vm/src/static_analysis.rs index 3c718b0526..b385b87ddf 100644 --- a/packages/vm/src/static_analysis.rs +++ b/packages/vm/src/static_analysis.rs @@ -1,13 +1,13 @@ use std::collections::HashSet; -use strum::{Display, EnumString}; +use strum::{Display, EnumString, IntoStaticStr}; use wasmer::wasmparser::ExternalKind; use crate::parsed_wasm::ParsedWasm; /// An enum containing all available contract entrypoints. /// This also provides conversions to and from strings. -#[derive(PartialEq, Eq, Debug, Clone, Copy, Hash, EnumString, Display)] +#[derive(PartialEq, Eq, Debug, Clone, Copy, Hash, EnumString, Display, IntoStaticStr)] pub enum Entrypoint { #[strum(serialize = "instantiate")] Instantiate, @@ -35,13 +35,13 @@ pub enum Entrypoint { IbcPacketTimeout, } -pub const REQUIRED_IBC_EXPORTS: &[&str] = &[ - "ibc_channel_open", - "ibc_channel_connect", - "ibc_channel_close", - "ibc_packet_receive", - "ibc_packet_ack", - "ibc_packet_timeout", +pub const REQUIRED_IBC_EXPORTS: &[Entrypoint] = &[ + Entrypoint::IbcChannelOpen, + Entrypoint::IbcChannelConnect, + Entrypoint::IbcChannelClose, + Entrypoint::IbcPacketReceive, + Entrypoint::IbcPacketAck, + Entrypoint::IbcPacketTimeout, ]; /// A trait that allows accessing shared functionality of `parity_wasm::elements::Module` @@ -260,10 +260,15 @@ mod tests { } #[test] - fn entrypoint_display_works() { + fn entrypoint_to_string_works() { assert_eq!( Entrypoint::IbcPacketTimeout.to_string(), "ibc_packet_timeout".to_string() ); + + assert_eq!( + <&'static str>::from(Entrypoint::IbcPacketReceive), + "ibc_packet_receive" + ); } } From 810b8dbd6bb8252d3e737c8c2d395f97597acaed Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Thu, 16 Nov 2023 17:36:47 +0100 Subject: [PATCH 4/8] Use AsRef instead of From for &str conversion --- packages/vm/src/cache.rs | 2 +- packages/vm/src/static_analysis.rs | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/vm/src/cache.rs b/packages/vm/src/cache.rs index 60f434d728..db7938e2c7 100644 --- a/packages/vm/src/cache.rs +++ b/packages/vm/src/cache.rs @@ -290,7 +290,7 @@ where Ok(AnalysisReport { has_ibc_entry_points: REQUIRED_IBC_EXPORTS .iter() - .all(|required| exports.contains(<&str>::from(required))), + .all(|required| exports.contains(required.as_ref())), entrypoints, required_capabilities: required_capabilities_from_module(&module), }) diff --git a/packages/vm/src/static_analysis.rs b/packages/vm/src/static_analysis.rs index b385b87ddf..f2f0f77521 100644 --- a/packages/vm/src/static_analysis.rs +++ b/packages/vm/src/static_analysis.rs @@ -1,13 +1,13 @@ use std::collections::HashSet; -use strum::{Display, EnumString, IntoStaticStr}; +use strum::{AsRefStr, Display, EnumString}; use wasmer::wasmparser::ExternalKind; use crate::parsed_wasm::ParsedWasm; /// An enum containing all available contract entrypoints. /// This also provides conversions to and from strings. -#[derive(PartialEq, Eq, Debug, Clone, Copy, Hash, EnumString, Display, IntoStaticStr)] +#[derive(PartialEq, Eq, Debug, Clone, Copy, Hash, EnumString, Display, AsRefStr)] pub enum Entrypoint { #[strum(serialize = "instantiate")] Instantiate, @@ -263,12 +263,10 @@ mod tests { fn entrypoint_to_string_works() { assert_eq!( Entrypoint::IbcPacketTimeout.to_string(), - "ibc_packet_timeout".to_string() + "ibc_packet_timeout" ); - assert_eq!( - <&'static str>::from(Entrypoint::IbcPacketReceive), - "ibc_packet_receive" - ); + let static_str: &'static str = Entrypoint::IbcPacketReceive.as_ref(); + assert_eq!(static_str, "ibc_packet_receive"); } } From ae737eb1a0eb81d0c10fbba4b92e7afc4ef34e18 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Thu, 16 Nov 2023 17:46:29 +0100 Subject: [PATCH 5/8] Update contract lock files --- contracts/burner/Cargo.lock | 35 +++++++++++++++++++++++++++ contracts/crypto-verify/Cargo.lock | 35 +++++++++++++++++++++++++++ contracts/cyberpunk/Cargo.lock | 35 +++++++++++++++++++++++++++ contracts/empty/Cargo.lock | 35 +++++++++++++++++++++++++++ contracts/floaty/Cargo.lock | 35 +++++++++++++++++++++++++++ contracts/hackatom/Cargo.lock | 35 +++++++++++++++++++++++++++ contracts/ibc-reflect-send/Cargo.lock | 35 +++++++++++++++++++++++++++ contracts/ibc-reflect/Cargo.lock | 35 +++++++++++++++++++++++++++ contracts/queue/Cargo.lock | 35 +++++++++++++++++++++++++++ contracts/reflect/Cargo.lock | 35 +++++++++++++++++++++++++++ contracts/staking/Cargo.lock | 35 +++++++++++++++++++++++++++ contracts/virus/Cargo.lock | 35 +++++++++++++++++++++++++++ 12 files changed, 420 insertions(+) diff --git a/contracts/burner/Cargo.lock b/contracts/burner/Cargo.lock index 039c36a785..b34c8884d5 100644 --- a/contracts/burner/Cargo.lock +++ b/contracts/burner/Cargo.lock @@ -274,6 +274,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.3", + "strum", "thiserror", "wasmer", "wasmer-middlewares", @@ -810,6 +811,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1248,6 +1255,12 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.5" @@ -1456,6 +1469,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.37", +] + [[package]] name = "subtle" version = "2.4.1" diff --git a/contracts/crypto-verify/Cargo.lock b/contracts/crypto-verify/Cargo.lock index bc88a47b5e..1b0edfa2a0 100644 --- a/contracts/crypto-verify/Cargo.lock +++ b/contracts/crypto-verify/Cargo.lock @@ -263,6 +263,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.3", + "strum", "thiserror", "wasmer", "wasmer-middlewares", @@ -815,6 +816,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1281,6 +1288,12 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.5" @@ -1499,6 +1512,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.37", +] + [[package]] name = "subtle" version = "2.4.1" diff --git a/contracts/cyberpunk/Cargo.lock b/contracts/cyberpunk/Cargo.lock index 44a1aec8ac..7c5cc0e80c 100644 --- a/contracts/cyberpunk/Cargo.lock +++ b/contracts/cyberpunk/Cargo.lock @@ -298,6 +298,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.3", + "strum", "thiserror", "wasmer", "wasmer-middlewares", @@ -876,6 +877,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1372,6 +1379,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.5" @@ -1580,6 +1593,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.37", +] + [[package]] name = "subtle" version = "2.4.1" diff --git a/contracts/empty/Cargo.lock b/contracts/empty/Cargo.lock index 47ec1c6f80..4af72f118c 100644 --- a/contracts/empty/Cargo.lock +++ b/contracts/empty/Cargo.lock @@ -263,6 +263,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.3", + "strum", "thiserror", "wasmer", "wasmer-middlewares", @@ -809,6 +810,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1247,6 +1254,12 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.5" @@ -1455,6 +1468,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.37", +] + [[package]] name = "subtle" version = "2.4.1" diff --git a/contracts/floaty/Cargo.lock b/contracts/floaty/Cargo.lock index eeeaa6353f..25a79648c7 100644 --- a/contracts/floaty/Cargo.lock +++ b/contracts/floaty/Cargo.lock @@ -263,6 +263,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.3", + "strum", "thiserror", "wasmer", "wasmer-middlewares", @@ -811,6 +812,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1265,6 +1272,12 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.5" @@ -1473,6 +1486,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.32", +] + [[package]] name = "subtle" version = "2.4.1" diff --git a/contracts/hackatom/Cargo.lock b/contracts/hackatom/Cargo.lock index cdb8cf7ede..bf88a6b513 100644 --- a/contracts/hackatom/Cargo.lock +++ b/contracts/hackatom/Cargo.lock @@ -263,6 +263,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.3", + "strum", "thiserror", "wasmer", "wasmer-middlewares", @@ -812,6 +813,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1250,6 +1257,12 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.5" @@ -1458,6 +1471,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.37", +] + [[package]] name = "subtle" version = "2.4.1" diff --git a/contracts/ibc-reflect-send/Cargo.lock b/contracts/ibc-reflect-send/Cargo.lock index 656e614d46..c87567cac2 100644 --- a/contracts/ibc-reflect-send/Cargo.lock +++ b/contracts/ibc-reflect-send/Cargo.lock @@ -263,6 +263,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.3", + "strum", "thiserror", "wasmer", "wasmer-middlewares", @@ -799,6 +800,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1248,6 +1255,12 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.5" @@ -1456,6 +1469,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.37", +] + [[package]] name = "subtle" version = "2.4.1" diff --git a/contracts/ibc-reflect/Cargo.lock b/contracts/ibc-reflect/Cargo.lock index 5c1407d179..63a15bab2a 100644 --- a/contracts/ibc-reflect/Cargo.lock +++ b/contracts/ibc-reflect/Cargo.lock @@ -263,6 +263,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.3", + "strum", "thiserror", "wasmer", "wasmer-middlewares", @@ -799,6 +800,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1248,6 +1255,12 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.5" @@ -1456,6 +1469,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.37", +] + [[package]] name = "subtle" version = "2.4.1" diff --git a/contracts/queue/Cargo.lock b/contracts/queue/Cargo.lock index 2cc2910726..24f9479a69 100644 --- a/contracts/queue/Cargo.lock +++ b/contracts/queue/Cargo.lock @@ -263,6 +263,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.3", + "strum", "thiserror", "wasmer", "wasmer-middlewares", @@ -799,6 +800,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1248,6 +1255,12 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.5" @@ -1456,6 +1469,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.37", +] + [[package]] name = "subtle" version = "2.4.1" diff --git a/contracts/reflect/Cargo.lock b/contracts/reflect/Cargo.lock index ddf696931c..eb44b19333 100644 --- a/contracts/reflect/Cargo.lock +++ b/contracts/reflect/Cargo.lock @@ -263,6 +263,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.3", + "strum", "thiserror", "wasmer", "wasmer-middlewares", @@ -799,6 +800,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1249,6 +1256,12 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.5" @@ -1457,6 +1470,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.37", +] + [[package]] name = "subtle" version = "2.4.1" diff --git a/contracts/staking/Cargo.lock b/contracts/staking/Cargo.lock index adf45172da..c1a78d2d31 100644 --- a/contracts/staking/Cargo.lock +++ b/contracts/staking/Cargo.lock @@ -263,6 +263,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.3", + "strum", "thiserror", "wasmer", "wasmer-middlewares", @@ -805,6 +806,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1243,6 +1250,12 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.5" @@ -1484,6 +1497,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.37", +] + [[package]] name = "subtle" version = "2.4.1" diff --git a/contracts/virus/Cargo.lock b/contracts/virus/Cargo.lock index 859dd66413..78a107c138 100644 --- a/contracts/virus/Cargo.lock +++ b/contracts/virus/Cargo.lock @@ -263,6 +263,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.3", + "strum", "thiserror", "wasmer", "wasmer-middlewares", @@ -799,6 +800,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1237,6 +1244,12 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.5" @@ -1445,6 +1458,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.37", +] + [[package]] name = "subtle" version = "2.4.1" From 5f356ab00c7ab1b4a05c1b15329fbdf9fe568ad6 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 20 Nov 2023 12:43:58 +0100 Subject: [PATCH 6/8] Use BTreeSet in AnalysisReport --- packages/vm/src/cache.rs | 22 ++++++++++++---------- packages/vm/src/static_analysis.rs | 12 ++++++++++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/packages/vm/src/cache.rs b/packages/vm/src/cache.rs index db7938e2c7..c83db3ab8f 100644 --- a/packages/vm/src/cache.rs +++ b/packages/vm/src/cache.rs @@ -1,4 +1,4 @@ -use std::collections::HashSet; +use std::collections::{BTreeSet, HashSet}; use std::fs::{self, File, OpenOptions}; use std::io::{Read, Write}; use std::marker::PhantomData; @@ -122,9 +122,9 @@ pub struct AnalysisReport { /// This does not guarantee they are functional or even have the correct signatures. pub has_ibc_entry_points: bool, /// A set of all entrypoints that are exported by the contract. - pub entrypoints: HashSet, + pub entrypoints: BTreeSet, /// The set of capabilities the contract requires. - pub required_capabilities: HashSet, + pub required_capabilities: BTreeSet, } impl Cache @@ -292,7 +292,9 @@ where .iter() .all(|required| exports.contains(required.as_ref())), entrypoints, - required_capabilities: required_capabilities_from_module(&module), + required_capabilities: required_capabilities_from_module(&module) + .into_iter() + .collect(), }) } @@ -1307,28 +1309,28 @@ mod tests { report1, AnalysisReport { has_ibc_entry_points: false, - entrypoints: HashSet::from([ + entrypoints: BTreeSet::from([ E::Instantiate, E::Migrate, E::Sudo, E::Execute, E::Query ]), - required_capabilities: HashSet::new(), + required_capabilities: BTreeSet::new(), } ); let checksum2 = cache.save_wasm(IBC_CONTRACT).unwrap(); let report2 = cache.analyze(&checksum2).unwrap(); let mut ibc_contract_entrypoints = - HashSet::from([E::Instantiate, E::Migrate, E::Reply, E::Query]); + BTreeSet::from([E::Instantiate, E::Migrate, E::Reply, E::Query]); ibc_contract_entrypoints.extend(REQUIRED_IBC_EXPORTS); assert_eq!( report2, AnalysisReport { has_ibc_entry_points: true, entrypoints: ibc_contract_entrypoints, - required_capabilities: HashSet::from_iter([ + required_capabilities: BTreeSet::from_iter([ "iterator".to_string(), "stargate".to_string() ]), @@ -1341,8 +1343,8 @@ mod tests { report3, AnalysisReport { has_ibc_entry_points: false, - entrypoints: HashSet::new(), - required_capabilities: HashSet::from(["iterator".to_string()]), + entrypoints: BTreeSet::new(), + required_capabilities: BTreeSet::from(["iterator".to_string()]), } ); } diff --git a/packages/vm/src/static_analysis.rs b/packages/vm/src/static_analysis.rs index f2f0f77521..4cff8d6402 100644 --- a/packages/vm/src/static_analysis.rs +++ b/packages/vm/src/static_analysis.rs @@ -35,6 +35,18 @@ pub enum Entrypoint { IbcPacketTimeout, } +// sort entrypoints by their &str representation +impl PartialOrd for Entrypoint { + fn partial_cmp(&self, other: &Self) -> Option { + self.as_ref().partial_cmp(other.as_ref()) + } +} +impl Ord for Entrypoint { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.as_ref().cmp(other.as_ref()) + } +} + pub const REQUIRED_IBC_EXPORTS: &[Entrypoint] = &[ Entrypoint::IbcChannelOpen, Entrypoint::IbcChannelConnect, From 1f397bbc80cc2df100048034fa80f8c541220af6 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 20 Nov 2023 12:48:11 +0100 Subject: [PATCH 7/8] Fix lint --- packages/vm/src/static_analysis.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vm/src/static_analysis.rs b/packages/vm/src/static_analysis.rs index 4cff8d6402..ab11b52089 100644 --- a/packages/vm/src/static_analysis.rs +++ b/packages/vm/src/static_analysis.rs @@ -38,7 +38,7 @@ pub enum Entrypoint { // sort entrypoints by their &str representation impl PartialOrd for Entrypoint { fn partial_cmp(&self, other: &Self) -> Option { - self.as_ref().partial_cmp(other.as_ref()) + Some(self.cmp(other)) } } impl Ord for Entrypoint { From 720e6e02c762a97299a7faa9493df564d45a2c1c Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 20 Nov 2023 13:59:16 +0100 Subject: [PATCH 8/8] Add changelog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7aba9851a3..a5d8730e6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,8 @@ and this project adheres to - cosmwasm-vm: Make `instantiate` entrypoint optional. ([#1933]) - cosmwasm-std: Rename `CosmosMsg::Stargate` to `CosmosMsg::Any` and use a nested msg struct like in other messages. ([#1926]) +- cosmwasm-vm: Add `AnalysisReport::entrypoints` and make + `AnalysisReport::required_capabilities` a `BTreeSet`. ([#1949]) [#1874]: https://github.com/CosmWasm/cosmwasm/pull/1874 [#1876]: https://github.com/CosmWasm/cosmwasm/pull/1876 @@ -62,6 +64,7 @@ and this project adheres to [#1939]: https://github.com/CosmWasm/cosmwasm/pull/1939 [#1940]: https://github.com/CosmWasm/cosmwasm/pull/1940 [#1941]: https://github.com/CosmWasm/cosmwasm/pull/1941 +[#1949]: https://github.com/CosmWasm/cosmwasm/pull/1949 ### Removed