Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update runtime (#1323)
* Update weight files & Runtime enum

* Use workspace metadata

* Always use serde serialization for asset types

* Make battery station standalone runtime compilable

* Make benchmark and try-runtime feature compilable

* Make BS build with all features

* Make parachain tests compile

* Partially fix xcm tests

* Use safe xcm version 2

* Update Zeitgeist runtime (except xcm tests)

* Format code

* Remove deprecated comment
  • Loading branch information
sea212 authored Apr 29, 2024
commit c5c31debe24984866abf0f241021d46135be46b1
4 changes: 4 additions & 0 deletions Cargo.lock

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

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[workspace.package]
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition = "2021"
homepage = "https://zeitgeist.pm/"
license = "GPL-3.0"
repository = "https://github.com/zeitgeistpm/zeitgeist"

[workspace]
default-members = [
"macros",
Expand Down Expand Up @@ -217,6 +224,7 @@ polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch
polkadot-test-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }

# Polkadot / XCM (wasm)
pallet-message-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
polkadot-parachain-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition = "2021"
edition.workspace = true
name = "zeitgeist-macros"
version = "0.5.2"
2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ with-zeitgeist-runtime = ["zeitgeist-runtime"]
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
build = "build.rs"
description = "An evolving blockchain for prediction markets and futarchy."
edition = "2021"
edition.workspace = true
homepage = "https://zeitgeist.pm"
name = "zeitgeist-node"
version = "0.5.2"
Expand Down
6 changes: 3 additions & 3 deletions primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ orml-currencies = { workspace = true }
orml-tokens = { workspace = true }
orml-traits = { workspace = true }
parity-scale-codec = { workspace = true, features = ["derive", "max-encoded-len"] }
scale-info = { workspace = true, features = ["derive"] }
serde = { workspace = true, features = ["derive"], optional = true }
scale-info = { workspace = true, features = ["derive", "serde"] }
serde = { workspace = true, features = ["alloc", "derive", "rc"] }
sp-arithmetic = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
Expand Down Expand Up @@ -38,6 +38,6 @@ std = [

[package]
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition = "2021"
edition.workspace = true
name = "zeitgeist-primitives"
version = "0.5.2"
17 changes: 14 additions & 3 deletions primitives/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,22 @@ mod tests;
/// meaning that they think the outcome will be closer to the upper bound
/// or a `Short` position meaning that they think the outcome will be closer
/// to the lower bound.
#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[derive(
Clone, Copy, Debug, Decode, Eq, Encode, MaxEncodedLen, Ord, PartialEq, PartialOrd, TypeInfo,
Clone,
Copy,
Debug,
Decode,
Eq,
Encode,
MaxEncodedLen,
Ord,
PartialEq,
PartialOrd,
TypeInfo,
serde::Deserialize,
serde::Serialize,
)]
#[serde(rename_all = "camelCase")]
pub enum ScalarPosition {
Long,
Short,
Expand Down
5 changes: 3 additions & 2 deletions primitives/src/assets/all_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ use super::*;
/// # Types
///
/// * `MI`: Market Id
#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[derive(
Clone,
Copy,
Expand All @@ -52,7 +50,10 @@ use super::*;
PartialEq,
PartialOrd,
TypeInfo,
serde::Deserialize,
serde::Serialize,
)]
#[serde(rename_all = "camelCase")]
pub enum Asset<MI: MaxEncodedLen + HasCompact> {
#[codec(index = 0)]
CategoricalOutcome(MI, CategoryIndex),
Expand Down
18 changes: 15 additions & 3 deletions primitives/src/assets/campaign_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,23 @@ use super::*;
/// The `CampaignAsset` tuple struct represents all campaign assets.
/// Campaign assets can have special properties, such as the capability
/// to pay fees.
#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[derive(
Clone, CompactAs, Copy, Debug, Decode, Default, Eq, Encode, MaxEncodedLen, PartialEq, TypeInfo,
Clone,
CompactAs,
Copy,
Debug,
Decode,
Eq,
Encode,
MaxEncodedLen,
Ord,
PartialEq,
PartialOrd,
TypeInfo,
serde::Deserialize,
serde::Serialize,
)]
#[serde(rename_all = "camelCase")]
pub struct CampaignAssetClass(#[codec(compact)] pub CampaignAssetId);

impl From<Compact<CampaignAssetId>> for CampaignAssetClass {
Expand Down
17 changes: 14 additions & 3 deletions primitives/src/assets/currencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,22 @@ use super::*;

/// The `CurrencyClass` enum represents all non-ztg currencies
// used in orml-tokens
#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[derive(
Clone, Copy, Debug, Decode, Eq, Encode, MaxEncodedLen, Ord, PartialEq, PartialOrd, TypeInfo,
Clone,
Copy,
Debug,
Decode,
Eq,
Encode,
MaxEncodedLen,
Ord,
PartialEq,
PartialOrd,
TypeInfo,
serde::Deserialize,
serde::Serialize,
)]
#[serde(rename_all = "camelCase")]
pub enum CurrencyClass<MI> {
// All Outcome and Share variants will be removed once the lazy migration from
// orml-tokens to pallet-assets is complete
Expand Down
18 changes: 15 additions & 3 deletions primitives/src/assets/custom_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,23 @@
use super::*;

/// The `CustomAsset` tuple struct represents all custom assets.
#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[derive(
Clone, CompactAs, Copy, Debug, Decode, Default, Eq, Encode, MaxEncodedLen, PartialEq, TypeInfo,
Clone,
CompactAs,
Copy,
Debug,
Decode,
Eq,
Encode,
MaxEncodedLen,
Ord,
PartialEq,
PartialOrd,
TypeInfo,
serde::Deserialize,
serde::Serialize,
)]
#[serde(rename_all = "camelCase")]
pub struct CustomAssetClass(#[codec(compact)] pub CustomAssetId);

impl From<Compact<CustomAssetId>> for CustomAssetClass {
Expand Down
17 changes: 14 additions & 3 deletions primitives/src/assets/market_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,22 @@ use super::*;
/// # Types
///
/// * `MI`: Market Id
#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[derive(
Clone, Copy, Debug, Decode, Eq, Encode, MaxEncodedLen, PartialEq, PartialOrd, Ord, TypeInfo,
Clone,
Copy,
Debug,
Decode,
Eq,
Encode,
MaxEncodedLen,
Ord,
PartialEq,
PartialOrd,
TypeInfo,
serde::Deserialize,
serde::Serialize,
)]
#[serde(rename_all = "camelCase")]
pub enum MarketAssetClass<MI: HasCompact + MaxEncodedLen> {
#[codec(index = 0)]
CategoricalOutcome(MI, CategoryIndex),
Expand Down
20 changes: 17 additions & 3 deletions primitives/src/assets/subsets/base_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,23 @@ use super::*;

/// The `BaseAssetClass` enum represents all assets that can be used as collateral in
/// prediction markets.
#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Decode, Default, Eq, Encode, MaxEncodedLen, PartialEq, TypeInfo)]
#[derive(
Clone,
Copy,
Debug,
Decode,
Default,
Eq,
Encode,
MaxEncodedLen,
Ord,
PartialEq,
PartialOrd,
TypeInfo,
serde::Deserialize,
serde::Serialize,
)]
#[serde(rename_all = "camelCase")]
pub enum BaseAssetClass {
#[codec(index = 4)]
#[default]
Expand Down
19 changes: 16 additions & 3 deletions primitives/src/assets/subsets/parimutuel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,22 @@
use super::*;

/// The `ParimutuelAssetClass` enum represents all assets that are specific to parimutuel markets.
#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Decode, Eq, Encode, MaxEncodedLen, PartialEq, TypeInfo)]
#[derive(
Clone,
Copy,
Debug,
Decode,
Eq,
Encode,
MaxEncodedLen,
Ord,
PartialEq,
PartialOrd,
TypeInfo,
serde::Deserialize,
serde::Serialize,
)]
#[serde(rename_all = "camelCase")]
pub enum ParimutuelAssetClass<MI> {
#[codec(index = 6)]
Share(MI, CategoryIndex),
Expand Down
20 changes: 17 additions & 3 deletions primitives/src/assets/subsets/xcm_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,23 @@
use super::*;

/// The `XcmAssetClass` enum represents all assets that can be transferred via XCM.
#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Decode, Default, Eq, Encode, MaxEncodedLen, PartialEq, TypeInfo)]
#[derive(
Clone,
Copy,
Debug,
Decode,
Default,
Eq,
Encode,
MaxEncodedLen,
Ord,
PartialEq,
PartialOrd,
TypeInfo,
serde::Deserialize,
serde::Serialize,
)]
#[serde(rename_all = "camelCase")]
pub enum XcmAssetClass {
#[codec(index = 4)]
#[default]
Expand Down
2 changes: 1 addition & 1 deletion primitives/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub type XcmAsset = XcmAssetClass;
pub type TxPaymentAssetId = u32;

/// Index of a transaction in the chain.
pub type Index = u64;
pub type Nonce = u64;

/// A hash of some data used by the chain.
pub type Hash = sp_core::H256;
Expand Down
6 changes: 5 additions & 1 deletion runtime/battery-station/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ orml-asset-registry = { workspace = true, optional = true }
orml-unknown-tokens = { workspace = true, optional = true }
orml-xcm-support = { workspace = true, optional = true }
orml-xtokens = { workspace = true, optional = true }
pallet-message-queue = { workspace = true, optional = true }
pallet-xcm = { workspace = true, optional = true }
polkadot-runtime-parachains = { workspace = true, optional = true }
rococo-runtime = { workspace = true, optional = true }
Expand Down Expand Up @@ -127,6 +128,7 @@ zrml-swaps = { workspace = true }
zrml-swaps-runtime-api = { workspace = true }

[dev-dependencies]
env_logger = { workspace = true }
sp-io = { workspace = true, features = ["default"] }
test-case = { workspace = true }
xcm-simulator = { workspace = true }
Expand Down Expand Up @@ -162,6 +164,7 @@ parachain = [
"orml-unknown-tokens",
"orml-xcm-support",
"orml-xtokens",
"pallet-message-queue",
"pallet-xcm",
"polkadot-runtime-parachains",
"rococo-runtime",
Expand Down Expand Up @@ -319,6 +322,7 @@ std = [
"orml-unknown-tokens?/std",
"orml-xcm-support?/std",
"orml-xtokens?/std",
"pallet-message-queue?/std",
"pallet-xcm?/std",
"polkadot-runtime-parachains?/std",
"rococo-runtime?/std",
Expand Down Expand Up @@ -428,7 +432,7 @@ force-debug = ["sp-debug-derive/force-debug"]

[package]
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition = "2021"
edition.workspace = true
name = "battery-station-runtime"
version = "0.5.2"

Expand Down
Loading