Skip to content

Commit

Permalink
basic setup (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
xlc authored May 22, 2024
1 parent 1a8af4d commit 496ef9e
Show file tree
Hide file tree
Showing 21 changed files with 190 additions and 85 deletions.
79 changes: 25 additions & 54 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 27 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
[workspace.package]
authors = ["Acala Developers <hello@acala.network>"]
edition = "2021"
repository = "https://github.com/open-web3-stack/XCQ"
license = "Apache-2.0"
version = "0.1.0"

[workspace]
resolver = "2"
members = [
"poc/host",
"poc/runtime",
"poc/executor",
"xcq-executor",

"xcq-api",
"xcq-extension",
"xcq-executor",
"xcq-extension-core",
"xcq-extension-fungibles",
"xcq-extension",
"xcq-primitives",
"xcq-runtime-api",
"xcq-types",
"xcq-test-runner",
"xcq-types",

"examples/example-fungibles",
"examples/example-helloworld",
]
Expand All @@ -23,6 +33,20 @@ panic = "unwind"
opt-level = 3

[workspace.dependencies]
xcq-api = { path = "xcq-api", default-features = false }
xcq-executor = { path = "xcq-executor", default-features = false }
xcq-extension-core = { path = "xcq-extension-core", default-features = false }
xcq-extension-fungibles = { path = "xcq-extension-fungibles", default-features = false }
xcq-extension = { path = "xcq-extension", default-features = false }
xcq-primitives = { path = "xcq-primitives", default-features = false }
xcq-runtime-api = { path = "xcq-runtime-api", default-features = false }
xcq-test-runner = { path = "xcq-test-runner", default-features = false }
xcq-types = { path = "xcq-types", default-features = false }

env_logger = { version = "0.11.3" }
parity-scale-codec = { version = "3.6.12", default-features = false }
scale-info = { version = "2.11.3", default-features = false }

polkavm = { path = "vendor/polkavm/crates/polkavm", default-features = false }

sp-api = { version = "29.0.0", default-features = false }
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ fmt:
cargo fmt --all -- --check

check:
cargo check --no-default-features --target=wasm32-unknown-unknown -p poc-executor
SKIP_WASM_BUILD= cargo check --no-default-features --target=wasm32-unknown-unknown
SKIP_WASM_BUILD= cargo check
cd poc/guest; cargo check

clippy:
cargo clippy --no-default-features --target=wasm32-unknown-unknown -p poc-executor
SKIP_WASM_BUILD= cargo clippy -- -D warnings
cd poc/guest; cargo clippy

Expand Down
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.78.0"
12 changes: 10 additions & 2 deletions xcq-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
[package]
name = "xcq-api"
version = "0.1.0"
edition = "2021"
description = "API between XCQ host and guest program"
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]

[features]
default = ["std"]
std = []
2 changes: 2 additions & 0 deletions xcq-api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]

pub fn add(left: usize, right: usize) -> usize {
left + right
}
Expand Down
12 changes: 10 additions & 2 deletions xcq-executor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
[package]
name = "xcq-executor"
version = "0.1.0"
edition = "2021"
description = "XCQ program executor"
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]

[features]
default = ["std"]
std = []
2 changes: 2 additions & 0 deletions xcq-executor/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]

pub fn add(left: usize, right: usize) -> usize {
left + right
}
Expand Down
12 changes: 10 additions & 2 deletions xcq-extension-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
[package]
name = "xcq-extension-core"
version = "0.1.0"
edition = "2021"
description = "Core extension for XCQ"
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]

[features]
default = ["std"]
std = []
2 changes: 2 additions & 0 deletions xcq-extension-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]

pub fn add(left: usize, right: usize) -> usize {
left + right
}
Expand Down
12 changes: 10 additions & 2 deletions xcq-extension-fungibles/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
[package]
name = "xcq-extension-fungibles"
version = "0.1.0"
edition = "2021"
description = "Fungibles extension for XCQ"
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]

[features]
default = ["std"]
std = []
2 changes: 2 additions & 0 deletions xcq-extension-fungibles/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]

pub fn add(left: usize, right: usize) -> usize {
left + right
}
Expand Down
12 changes: 10 additions & 2 deletions xcq-extension/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
[package]
name = "xcq-extension"
version = "0.1.0"
edition = "2021"
description = "Extension system for XCQ"
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]

[features]
default = ["std"]
std = []
2 changes: 2 additions & 0 deletions xcq-extension/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]

pub fn add(left: usize, right: usize) -> usize {
left + right
}
Expand Down
16 changes: 16 additions & 0 deletions xcq-primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "xcq-primitives"
description = "Primitives for XCQ"
authors.workspace = true
edition.workspace = true
repository.workspace = true
license.workspace = true
version.workspace = true

[dependencies]
parity-scale-codec = { workspace = true }
scale-info = { workspace = true }

[features]
default = ["std"]
std = ["parity-scale-codec/std", "scale-info/std"]
16 changes: 16 additions & 0 deletions xcq-primitives/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

use alloc::{string::String, vec::Vec};
use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;

pub type XcqResponse = Vec<u8>;

#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode, TypeInfo)]
pub enum XcqError {
Custom(String),
}

pub type XcqResult = Result<XcqResponse, XcqError>;
18 changes: 16 additions & 2 deletions xcq-runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
[package]
name = "xcq-runtime-api"
version = "0.1.0"
edition = "2021"
description = "Runtime API for XCQ"
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]
xcq-primitives = { workspace = true }

sp-api = { workspace = true }

[features]
default = ["std"]
std = [
"xcq-primitives/std",
"sp-api/std",
]
Loading

0 comments on commit 496ef9e

Please sign in to comment.