Skip to content

Commit

Permalink
Split multiple crates
Browse files Browse the repository at this point in the history
  • Loading branch information
mpapierski committed Jul 12, 2024
1 parent 199dc0c commit 921e356
Show file tree
Hide file tree
Showing 72 changed files with 1,371 additions and 1,276 deletions.
281 changes: 112 additions & 169 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@ members = [
"utils/global-state-update-gen",
"utils/validation",
"binary_port",
"vm",
"vm-common",
"smart_contracts/sdk",
"smart_contracts/sdk-codegen",
"smart_contracts/sdk-sys",
"smart_contracts/macros",
"cargo-casper",
# "utils/highway-rewards-analysis",
# "utils/highway-state-grapher",
"executor/wasm-common",
"executor/wasm-interface",
"executor/wasm-host",
"executor/wasmer-backend",
"executor/wasm",
]

default-members = [
Expand All @@ -38,8 +41,6 @@ default-members = [
"utils/global-state-update-gen",
"utils/validation",
"binary_port",
"vm",
"vm-common",
"smart_contracts/sdk",
"smart_contracts/sdk-sys",
"smart_contracts/sdk-codegen",
Expand Down
4 changes: 2 additions & 2 deletions vm-common/Cargo.toml → executor/wasm-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "vm-common"
name = "casper-executor-wasm-common"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bitflags = "2.4.1"
casper-sdk-sys = { path = "../smart_contracts/sdk-sys"}
casper-sdk-sys = { path = "../../smart_contracts/sdk-sys"}
borsh = { version = "1.2.0", features = ["derive"] }
num-traits = "0.2.19"
num-derive = "0.4.2"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions executor/wasm-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//! A crate that shares common types and utilities between the Wasm executor and the Wasm interface.
pub mod flags;
pub mod keyspace;
pub mod leb128;
pub mod manifest;
pub mod selector;
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions executor/wasm-host/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "casper-executor-wasm-host"
version = "0.1.0"
edition = "2021"

[dependencies]
num-traits = "0.2.18"
num-derive = "0.4.2"
casper-storage = { path = "../../storage" }
casper-types = { path = "../../types" }
safe-transmute = "0.11.2"
tracing = "0.1.40"
casper-executor-wasm-common = { path = "../wasm-common" }
casper-executor-wasm-interface = { path = "../wasm-interface" }
bytes = "1.6.0"
parking_lot = "0.12.3"
thiserror = "1.0.61"
File renamed without changes.
29 changes: 29 additions & 0 deletions executor/wasm-host/src/context.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use std::sync::Arc;

use bytes::Bytes;
use casper_executor_wasm_interface::executor::Executor;
use casper_storage::{global_state::GlobalStateReader, AddressGenerator, TrackingCopy};
use casper_types::{account::AccountHash, Key, TransactionHash};
use parking_lot::RwLock;

/// Container that holds all relevant modules necessary to process an execution request.
pub struct Context<S: GlobalStateReader, E: Executor> {
/// The address of the account that initiated the contract or session code.
pub initiator: AccountHash,
/// The address of the addressable entity that is currently executing the contract or session
/// code.
pub caller: Key,
/// The address of the addressable entity that is being called.
pub callee: Key,
/// The state of the global state at the time of the call based on the currently executing
/// contract or session address.
// pub state_address: Address,
/// The amount of tokens that were send to the contract's purse at the time of the call.
pub value: u128,
pub tracking_copy: TrackingCopy<S>,
pub executor: E, // TODO: This could be part of the caller
pub transaction_hash: TransactionHash,
pub address_generator: Arc<RwLock<AddressGenerator>>,
pub chain_name: Arc<str>,
pub input: Bytes,
}
Loading

0 comments on commit 921e356

Please sign in to comment.