Skip to content

Commit

Permalink
Merge pull request #6 from TheWaWaR/update-ckb
Browse files Browse the repository at this point in the history
chore: update ckb to v0.104.0
  • Loading branch information
TheWaWaR authored Aug 8, 2022
2 parents 7b2673b + 8699c9d commit b920932
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "ckb-x64-simulator"
description = "A simulator that allows running CKB smart contracts on x64 environment for tooling benefits"
version = "0.6.1"
version = "0.7.0"
license = "MIT"
authors = ["Nervos Core Dev <dev@nervos.org>"]
edition = "2018"
edition = "2021"
build = "build.rs"

[lib]
Expand All @@ -13,9 +13,9 @@ crate-type = ["lib", "staticlib", "cdylib"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ckb-mock-tx-types = "0.1.0"
ckb-types = "0.100.0"
faster-hex = "0.6"
ckb-mock-tx-types = "0.4.0"
ckb-types = "0.104.0"
faster-hex = "0.6.1"
lazy_static = "1.4"
serde = "1.0"
serde_derive = "1.0"
Expand Down
15 changes: 3 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ pub extern "C" fn ckb_exec_cell(
argv: *const *const u8,
) -> c_int {
assert_vm_version();
let code_hash = unsafe {
let ptr = code_hash.as_ref().expect("casting pointer");
std::slice::from_raw_parts(ptr, 32)
};
let code_hash = unsafe { std::slice::from_raw_parts(code_hash, 32) };
let mut buffer = vec![];
buffer.extend_from_slice(code_hash);
buffer.push(hash_type);
Expand Down Expand Up @@ -357,10 +354,7 @@ pub extern "C" fn ckb_dlopen2(
handle: *mut *mut c_void,
consumed_size: *mut u64,
) -> c_int {
let dep_cell_hash = unsafe {
let ptr = dep_cell_hash.as_ref().expect("casting pointer");
std::slice::from_raw_parts(ptr, 32)
};
let dep_cell_hash = unsafe { std::slice::from_raw_parts(dep_cell_hash, 32) };
let mut buffer = vec![];
buffer.extend_from_slice(dep_cell_hash);
buffer.push(hash_type);
Expand Down Expand Up @@ -642,10 +636,7 @@ fn fetch_current_script() -> Script {
fn store_data(ptr: *mut c_void, len: *mut u64, offset: u64, data: &[u8]) {
let size_ptr = unsafe { len.as_mut().expect("casting pointer") };
let size = *size_ptr;
let buffer = unsafe {
let ptr = (ptr as *mut u8).as_mut().expect("casting pointer");
std::slice::from_raw_parts_mut(ptr, size as usize)
};
let buffer = unsafe { std::slice::from_raw_parts_mut(ptr as *mut u8, size as usize) };
let data_len = data.len() as u64;
let offset = std::cmp::min(data_len, offset);
let full_size = data_len - offset;
Expand Down

0 comments on commit b920932

Please sign in to comment.