Skip to content

Commit 2d4aac7

Browse files
committed
Replace parity-wasm with wasmparser
1 parent 0e48309 commit 2d4aac7

File tree

7 files changed

+262
-145
lines changed

7 files changed

+262
-145
lines changed

Cargo.lock

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vm/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ cosmwasm-std = { path = "../std", version = "1.3.0", default-features = false }
4343
cosmwasm-crypto = { path = "../crypto", version = "1.3.0" }
4444
derivative = "2"
4545
hex = "0.4"
46-
parity-wasm = { version = "0.45", features = ["sign_ext"] }
4746
schemars = "0.8.3"
4847
serde = { version = "1.0.103", default-features = false, features = ["derive", "alloc"] }
4948
serde_json = "1.0.40"

packages/vm/src/cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::filesystem::mkdir_p;
1515
use crate::instance::{Instance, InstanceOptions};
1616
use crate::modules::{CachedModule, FileSystemCache, InMemoryCache, PinnedMemoryCache};
1717
use crate::size::Size;
18-
use crate::static_analysis::{deserialize_wasm, has_ibc_entry_points};
18+
use crate::static_analysis::{deserialize_exports, has_ibc_entry_points};
1919
use crate::wasm_backend::{compile, make_store_with_engine};
2020

2121
const STATE_DIR: &str = "state";
@@ -244,7 +244,7 @@ where
244244
pub fn analyze(&self, checksum: &Checksum) -> VmResult<AnalysisReport> {
245245
// Here we could use a streaming deserializer to slightly improve performance. However, this way it is DRYer.
246246
let wasm = self.load_wasm(checksum)?;
247-
let module = deserialize_wasm(&wasm)?;
247+
let module = deserialize_exports(&wasm)?;
248248
Ok(AnalysisReport {
249249
has_ibc_entry_points: has_ibc_entry_points(&module),
250250
required_capabilities: required_capabilities_from_module(&module),

packages/vm/src/capabilities.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn capabilities_from_csv(csv: &str) -> HashSet<String> {
1515

1616
/// Implementation for check_wasm, based on static analysis of the bytecode.
1717
/// This is used for code upload, to perform check before compiling the Wasm.
18-
pub fn required_capabilities_from_module(module: &impl ExportInfo) -> HashSet<String> {
18+
pub fn required_capabilities_from_module(module: impl ExportInfo) -> HashSet<String> {
1919
module
2020
.exported_function_names(Some(REQUIRES_PREFIX))
2121
.into_iter()
@@ -33,7 +33,7 @@ pub fn required_capabilities_from_module(module: &impl ExportInfo) -> HashSet<St
3333
#[cfg(test)]
3434
mod tests {
3535
use super::*;
36-
use crate::static_analysis::deserialize_wasm;
36+
use crate::static_analysis::deserialize_exports;
3737

3838
#[test]
3939
fn capabilities_from_csv_works() {
@@ -73,7 +73,7 @@ mod tests {
7373
)"#,
7474
)
7575
.unwrap();
76-
let module = deserialize_wasm(&wasm).unwrap();
76+
let module = deserialize_exports(&wasm).unwrap();
7777

7878
let required_capabilities = required_capabilities_from_module(&module);
7979
assert_eq!(required_capabilities.len(), 3);
@@ -85,7 +85,7 @@ mod tests {
8585
#[test]
8686
fn required_capabilities_from_module_works_without_exports_section() {
8787
let wasm = wat::parse_str(r#"(module)"#).unwrap();
88-
let module = deserialize_wasm(&wasm).unwrap();
88+
let module = deserialize_exports(&wasm).unwrap();
8989
let required_capabilities = required_capabilities_from_module(&module);
9090
assert_eq!(required_capabilities.len(), 0);
9191
}

0 commit comments

Comments
 (0)