Skip to content

Commit

Permalink
V1.1.1 (#224)
Browse files Browse the repository at this point in the history
* Add marketplace pallet

* add benchmark to mainnet

* add benchmark to mainnet

* comment some benchmarks

* add correct ternoa-marketplace weights
  • Loading branch information
Leouarz authored Jul 6, 2022
1 parent 5628fab commit 9f06e27
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 24 deletions.
55 changes: 37 additions & 18 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion runtime/common/src/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::constants::currency::CENTS;

parameter_types! {
// Minimum 100 bytes/CAPS deposited (1 CENT/byte)
pub const BasicDeposit: Balance = 1000 * CENTS; // 258 bytes on-chain
pub const BasicDeposit: Balance = 10_000 * CENTS; // 258 bytes on-chain
pub const FieldDeposit: Balance = 250 * CENTS; // 66 bytes on-chain
pub const SubAccountDeposit: Balance = 200 * CENTS; // 53 bytes on-chain
pub const MaxSubAccounts: u32 = 100;
Expand Down
7 changes: 5 additions & 2 deletions runtime/mainnet/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "mainnet-runtime"
authors = [ "Ternoa" ]
version = "1.1.0"
version = "1.1.1"
edition = "2021"
build = "build.rs"

Expand Down Expand Up @@ -78,7 +78,8 @@ ternoa-runtime-common = { package = "ternoa-runtime-common", path = "../common",
ternoa-mandate = { git = "https://github.com/capsule-corp-ternoa/ternoa-pallets", rev = "v1.0.0", default-features = false }
ternoa-staking-rewards = { git = "https://github.com/capsule-corp-ternoa/ternoa-pallets", rev = "v1.0.0", default-features = false }
ternoa-bridge = { git = "https://github.com/capsule-corp-ternoa/ternoa-pallets", rev = "v1.0.1", default-features = false }
ternoa-nft = { git = "https://github.com/capsule-corp-ternoa/ternoa-pallets", rev = "v1.1.0", default-features = false }
ternoa-nft = { git = "https://github.com/capsule-corp-ternoa/ternoa-pallets", rev = "v1.1.1", default-features = false }
ternoa-marketplace = { git = "https://github.com/capsule-corp-ternoa/ternoa-pallets", rev = "v1.1.1", default-features = false }

[build-dependencies]
substrate-wasm-builder = { git = "https://github.com/capsule-corp-ternoa/substrate", branch = "ternoa-substrate-2022-03-24" }
Expand All @@ -93,6 +94,7 @@ std = [
"ternoa-staking-rewards/std",
"ternoa-bridge/std",
"ternoa-nft/std",
"ternoa-marketplace/std",
# Substrate
"parity-scale-codec/std",
"frame-election-provider-support/std",
Expand Down Expand Up @@ -176,6 +178,7 @@ runtime-benchmarks = [
"pallet-multisig/runtime-benchmarks",
"pallet-identity/runtime-benchmarks",
"ternoa-nft/runtime-benchmarks",
"ternoa-marketplace/runtime-benchmarks",
]

# try-runtime = [
Expand Down
3 changes: 3 additions & 0 deletions runtime/mainnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ construct_runtime!(
Multisig: pallet_multisig = 27,
Identity: pallet_identity = 28,
NFT: ternoa_nft = 29,
Marketplace: ternoa_marketplace = 30,
}
);

Expand Down Expand Up @@ -450,6 +451,8 @@ mod benches {
// Ternoa
[ternoa_staking_rewards, StakingRewards]
[ternoa_bridge, Bridge]
[ternoa_nft, NFT]
[ternoa_marketplace, Marketplace]
// Substrate
[pallet_babe, Babe]
[pallet_bags_list, BagsList]
Expand Down
19 changes: 18 additions & 1 deletion runtime/mainnet/src/pallets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use crate::{
Council, ElectionProviderMultiPhase, Event, Grandpa, Historical, ImOnline, Offences, Origin,
OriginCaller, PalletInfo, Preimage, Runtime, Scheduler, Session, Signature, SignedPayload,
Staking, StakingRewards, System, TechnicalCommittee, Timestamp, TransactionPayment, Treasury,
UncheckedExtrinsic, VERSION,
UncheckedExtrinsic, NFT, VERSION,
};

pub use common::babe::BABE_GENESIS_EPOCH_CONFIG;
Expand Down Expand Up @@ -613,3 +613,20 @@ impl ternoa_nft::Config for Runtime {
type CollectionOffchainDataLimit = CollectionOffchainDataLimit;
type CollectionSizeLimit = CollectionSizeLimit;
}

parameter_types! {
pub const MarketplaceInitialMintFee: Balance = 10_000_000_000_000_000_000_000;
pub const OffchainDataLimit: u32 = 150;
pub const AccountSizeLimit: u32 = 100_000;
}

impl ternoa_marketplace::Config for Runtime {
type Event = Event;
type WeightInfo = weights::ternoa_marketplace::WeightInfo<Runtime>;
type Currency = Balances;
type FeesCollector = Treasury;
type NFTExt = NFT;
type InitialMintFee = MarketplaceInitialMintFee;
type OffchainDataLimit = OffchainDataLimit;
type AccountSizeLimit = AccountSizeLimit;
}
2 changes: 1 addition & 1 deletion runtime/mainnet/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
/// Version of the runtime specification. A full-node will not attempt to use its native
/// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`,
/// `spec_version` and `authoring_version` are the same between Wasm and native.
spec_version: 4,
spec_version: 6,

/// Version of the implementation of the specification. Nodes are free to ignore this; it
/// serves only as an indication that the code is different; as long as the other two versions
Expand Down
1 change: 1 addition & 0 deletions runtime/mainnet/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ pub mod pallet_timestamp;
pub mod pallet_treasury;
pub mod pallet_utility;
pub mod ternoa_bridge;
pub mod ternoa_marketplace;
pub mod ternoa_nft;
pub mod ternoa_staking_rewards;
88 changes: 88 additions & 0 deletions runtime/mainnet/src/weights/ternoa_marketplace.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

//! Autogenerated weights for `ternoa_marketplace`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-07-06, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("mainnet-dev"), DB CACHE: 1024
// Executed Command:
// ./target/release/ternoa
// benchmark
// --chain
// mainnet-dev
// --steps=50
// --repeat=20
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./weights/
// --pallet=ternoa_marketplace

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for `ternoa_marketplace`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> ternoa_marketplace::WeightInfo for WeightInfo<T> {
// Storage: Marketplace MarketplaceMintFee (r:1 w:0)
// Storage: System Account (r:1 w:1)
// Storage: Marketplace NextMarketplaceId (r:1 w:1)
// Storage: Marketplace Marketplaces (r:0 w:1)
fn create_marketplace() -> Weight {
(162_778_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
// Storage: Marketplace Marketplaces (r:1 w:1)
fn set_marketplace_owner() -> Weight {
(56_567_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Marketplace Marketplaces (r:1 w:1)
fn set_marketplace_kind() -> Weight {
(47_009_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Marketplace Marketplaces (r:1 w:1)
fn set_marketplace_configuration() -> Weight {
(161_376_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Marketplace MarketplaceMintFee (r:0 w:1)
fn set_marketplace_mint_fee() -> Weight {
(28_414_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: NFT Nfts (r:1 w:1)
// Storage: Marketplace Marketplaces (r:1 w:0)
// Storage: Marketplace ListedNfts (r:0 w:1)
fn list_nft() -> Weight {
(63_599_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: NFT Nfts (r:1 w:1)
// Storage: Marketplace ListedNfts (r:1 w:1)
fn unlist_nft() -> Weight {
(61_156_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: NFT Nfts (r:1 w:1)
// Storage: Marketplace ListedNfts (r:1 w:1)
// Storage: Marketplace Marketplaces (r:1 w:0)
// Storage: System Account (r:2 w:2)
fn buy_nft() -> Weight {
(179_149_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
}
8 changes: 7 additions & 1 deletion scripts/benchmarks/mainnet/run_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,10 @@ echo "TERNOA STAKING REWARDS"
echo $(eval $COMMAND --pallet=ternoa_staking_rewards)

echo "TERNOA BRIDGE"
echo $(eval $COMMAND --pallet=ternoa_bridge)
echo $(eval $COMMAND --pallet=ternoa_bridge)

echo "TERNOA NFT"
echo $(eval $SHORT_COMMAND --pallet=ternoa_nft)

echo "TERNOA MARKETPLACE"
echo $(eval $COMMAND --pallet=ternoa_marketplace)

0 comments on commit 9f06e27

Please sign in to comment.