Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marko/wasm #104

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ bounded-collections = { version = "0.2", default-features = false }
scale-info = { version = "2", default-features = false, features = ["derive"] }

# Polkadot SDK
sp-io = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch-8", default-features = false }
binary-merkle-tree = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch-8", default-features = false }
sp-arithmetic = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch-8", default-features = false }
sp-core = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch-8", default-features = false }
sp-io = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch-8", default-features = false }
sp-std = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch-8", default-features = false }
sp-trie = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch-8", default-features = false }
sp-runtime = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch-8", default-features = false }
Expand Down
9 changes: 7 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ authors = []
edition = "2021"
license = "Apache-2.0"

# Target Dependencies
[target.'cfg(target_arch = "wasm32")'.dependencies]
sp-io = { workspace = true, features = ["disable_panic_handler"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
sp-io = { workspace = true }

[dependencies]
# Others
derive_more.workspace = true
Expand All @@ -23,11 +30,9 @@ bounded-collections.workspace = true
codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info.workspace = true

# Polkadot SDK
frame-support = { workspace = true, optional = true }
sp-arithmetic.workspace = true
sp-core.workspace = true
sp-io.workspace = true
sp-runtime = { workspace = true, optional = true }
sp-runtime-interface = { workspace = true, optional = true }
sp-std.workspace = true
Expand Down
13 changes: 9 additions & 4 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![deny(clippy::arithmetic_side_effects)]

use core::fmt::Debug;

use codec::{Decode, Encode, MaxEncodedLen};
use derive_more::{Add, Constructor, Deref, Display, Into, Mul};
use derive_more::{Add, Constructor, Deref, Into, Mul};
use scale_info::TypeInfo;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -88,11 +90,16 @@ pub enum InvalidTransactionCustomId {
Into,
MaxEncodedLen,
RuntimeDebug,
Display,
)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct AppId(#[codec(compact)] pub u32);

impl core::fmt::Display for AppId {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.0)
}
}

impl Zero for AppId {
fn zero() -> Self {
AppId(Zero::zero())
Expand All @@ -119,7 +126,6 @@ impl Zero for AppId {
Into,
Constructor,
MaxEncodedLen,
Display,
Default,
)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize, Debug))]
Expand All @@ -143,7 +149,6 @@ pub struct BlockLengthColumns(#[codec(compact)] pub u32);
Ord,
Into,
Constructor,
Display,
Default,
)]
#[mul(forward)]
Expand Down
Loading