Skip to content

Commit

Permalink
remove std::io
Browse files Browse the repository at this point in the history
  • Loading branch information
ajen committed Mar 20, 2023
1 parent 0d62a0d commit 629c9f2
Show file tree
Hide file tree
Showing 20 changed files with 19 additions and 1,333 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ num-bigint = "0.4.0"

sha2 = "0.9.3"

better_any = "0.1.1" # impl Traits for Mutex/RwLock, may not be a problem if not used;
acid_io = { version = "0.1.0", features = ["alloc"] }

# std::error::Error
anyhow = "1.0.52"

better_any = "0.1.1" # impl Traits for Mutex/RwLock, may not be a problem if not used;
fail = "0.4.0"
[profile.bench]
debug = true
Expand Down
1 change: 1 addition & 0 deletions language/move-binary-format/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ variant_count.workspace = true
move-core-types = { path = "../move-core/types" }
serde.workspace = true
hashbrown.workspace = true
acid_io.workspace = true
arbitrary = { version = "1.1.7", optional = true, features = ["derive"] }
proptest = { version = "1.0.0", optional = true }
proptest-derive = { version = "0.3.0", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions language/move-binary-format/src/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use move_core_types::{
account_address::AccountAddress, identifier::Identifier, metadata::Metadata, state::VMState,
vm_status::StatusCode,
};
use std::io::Read;
use acid_io::Read;

impl CompiledScript {
/// Deserializes a &[u8] slice into a `CompiledScript` instance.
Expand Down Expand Up @@ -949,7 +949,7 @@ fn load_signature_tokens(cursor: &mut VersionedCursor) -> BinaryLoaderResult<Vec

#[cfg(test)]
pub fn load_signature_token_test_entry(
cursor: std::io::Cursor<&[u8]>,
cursor: acid_io::Cursor<&[u8]>,
) -> BinaryLoaderResult<SignatureToken> {
load_signature_token(&mut VersionedCursor::new_for_test(VERSION_MAX, cursor))
}
Expand Down
14 changes: 9 additions & 5 deletions language/move-binary-format/src/file_format_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
//! It's used to compress mostly indexes into the main binary tables.
use crate::file_format::Bytecode;
use crate::no_std::prelude::*;
use acid_io::{Cursor, Read};
use anyhow::{bail, Result};
use core::mem::size_of;
use std::io::{Cursor, Read};

/// Constant values for the binary format header.
///
Expand Down Expand Up @@ -338,13 +338,17 @@ pub(crate) fn write_u256(

pub fn read_u8(cursor: &mut Cursor<&[u8]>) -> Result<u8> {
let mut buf = [0; 1];
cursor.read_exact(&mut buf)?;
cursor
.read_exact(&mut buf)
.map_err(|e| anyhow::format_err!("{e}"))?;
Ok(buf[0])
}

pub fn read_u32(cursor: &mut Cursor<&[u8]>) -> Result<u32> {
let mut buf = [0; 4];
cursor.read_exact(&mut buf)?;
cursor
.read_exact(&mut buf)
.map_err(|e| anyhow::format_err!("{e}"))?;
Ok(u32::from_le_bytes(buf))
}

Expand Down Expand Up @@ -413,8 +417,8 @@ pub const VERSION_MIN: u32 = VERSION_5;

pub(crate) mod versioned_data {
use crate::{errors::*, file_format_common::*};
use acid_io::{Cursor, Read};
use move_core_types::vm_status::StatusCode;
use std::io::{Cursor, Read};
pub struct VersionedBinary<'a> {
version: u32,
binary: &'a [u8],
Expand Down Expand Up @@ -535,7 +539,7 @@ pub(crate) mod versioned_data {
}

impl<'a> Read for VersionedCursor<'a> {
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
fn read(&mut self, buf: &mut [u8]) -> acid_io::Result<usize> {
self.cursor.read(buf)
}
}
Expand Down
2 changes: 1 addition & 1 deletion language/move-borrow-graph/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use crate::{
no_std::prelude::*,
paths::{self, Path, PathSlice},
paths::{self, Path},
references::*,
};
use alloc::collections::{BTreeMap, BTreeSet};
Expand Down
2 changes: 1 addition & 1 deletion language/move-bytecode-verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ move-core-types = { path = "../move-core/types" }

[dev-dependencies]
hex-literal = "0.3.4"
invalid-mutations = { path = "invalid-mutations" }
#invalid-mutations = { path = "invalid-mutations" }

[features]
default = []
3 changes: 0 additions & 3 deletions language/move-bytecode-verifier/fuzz/.gitignore

This file was deleted.

39 changes: 0 additions & 39 deletions language/move-bytecode-verifier/fuzz/Cargo.toml

This file was deleted.

4 changes: 0 additions & 4 deletions language/move-bytecode-verifier/fuzz/README.md

This file was deleted.

83 changes: 0 additions & 83 deletions language/move-bytecode-verifier/fuzz/fuzz_targets/code_unit.rs

This file was deleted.

This file was deleted.

97 changes: 0 additions & 97 deletions language/move-bytecode-verifier/fuzz/fuzz_targets/mixed.rs

This file was deleted.

18 changes: 0 additions & 18 deletions language/move-bytecode-verifier/invalid-mutations/Cargo.toml

This file was deleted.

Loading

0 comments on commit 629c9f2

Please sign in to comment.