Skip to content

Commit

Permalink
Extend benchmark list (#1170)
Browse files Browse the repository at this point in the history
* Add orderbook and parimutuel pallets to benchmark list

* Rename orderbook-v1 to orderbook
  • Loading branch information
sea212 authored Oct 26, 2023
1 parent fe1dfa6 commit 76d6a23
Show file tree
Hide file tree
Showing 19 changed files with 96 additions and 93 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ default-members = [
"zrml/liquidity-mining",
"zrml/market-commons",
"zrml/neo-swaps",
"zrml/orderbook-v1",
"zrml/orderbook",
"zrml/parimutuel",
"zrml/prediction-markets",
"zrml/prediction-markets/runtime-api",
Expand All @@ -34,8 +34,8 @@ members = [
"zrml/liquidity-mining",
"zrml/market-commons",
"zrml/neo-swaps",
"zrml/orderbook-v1",
"zrml/orderbook-v1/fuzz",
"zrml/orderbook",
"zrml/orderbook/fuzz",
"zrml/parimutuel",
"zrml/prediction-markets",
"zrml/prediction-markets/fuzz",
Expand Down Expand Up @@ -234,7 +234,7 @@ zrml-global-disputes = { path = "zrml/global-disputes", default-features = false
zrml-liquidity-mining = { path = "zrml/liquidity-mining", default-features = false }
zrml-market-commons = { path = "zrml/market-commons", default-features = false }
zrml-neo-swaps = { path = "zrml/neo-swaps", default-features = false }
zrml-orderbook-v1 = { path = "zrml/orderbook-v1", default-features = false }
zrml-orderbook = { path = "zrml/orderbook", default-features = false }
zrml-parimutuel = { path = "zrml/parimutuel", default-features = false }
zrml-prediction-markets = { path = "zrml/prediction-markets", default-features = false }
zrml-prediction-markets-runtime-api = { path = "zrml/prediction-markets/runtime-api", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ _anything_.
- [neo-swaps](./zrml/neo-swaps) - An implementation of the Logarithmic Market
Scoring Rule as constant function market maker, tailor-made for decentralized
combinatorial markets and Futarchy.
- [orderbook-v1](./zrml/orderbook-v1) - A naive orderbook implementation that's
- [orderbook](./zrml/orderbook) - A naive orderbook implementation that's
only part of Zeitgeist's PoC. Will be replaced by a v2 orderbook that uses
0x-style hybrid on-chain and off-chain trading.
- [parimutuel](./zrml/parimutuel) - A straightforward parimutuel market maker
Expand Down
8 changes: 4 additions & 4 deletions runtime/battery-station/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ zrml-global-disputes = { workspace = true, optional = true }
zrml-liquidity-mining = { workspace = true }
zrml-market-commons = { workspace = true }
zrml-neo-swaps = { workspace = true }
zrml-orderbook-v1 = { workspace = true }
zrml-orderbook = { workspace = true }
zrml-parimutuel = { workspace = true }
zrml-prediction-markets = { workspace = true }
zrml-rikiddo = { workspace = true }
Expand Down Expand Up @@ -218,7 +218,7 @@ runtime-benchmarks = [
"zrml-global-disputes/runtime-benchmarks",
"zrml-styx/runtime-benchmarks",
"zrml-swaps/runtime-benchmarks",
"zrml-orderbook-v1/runtime-benchmarks",
"zrml-orderbook/runtime-benchmarks",
]
std = [
"frame-executive/std",
Expand Down Expand Up @@ -335,7 +335,7 @@ std = [
"zrml-styx/std",
"zrml-swaps-runtime-api/std",
"zrml-swaps/std",
"zrml-orderbook-v1/std",
"zrml-orderbook/std",
]
try-runtime = [
"frame-executive/try-runtime",
Expand Down Expand Up @@ -390,7 +390,7 @@ try-runtime = [
"zrml-global-disputes/try-runtime",
"zrml-styx/try-runtime",
"zrml-swaps/try-runtime",
"zrml-orderbook-v1/try-runtime",
"zrml-orderbook/try-runtime",

# Parachain
"pallet-author-inherent?/try-runtime",
Expand Down
22 changes: 11 additions & 11 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ macro_rules! create_runtime {
Styx: zrml_styx::{Call, Event<T>, Pallet, Storage} = 58,
GlobalDisputes: zrml_global_disputes::{Call, Event<T>, Pallet, Storage} = 59,
NeoSwaps: zrml_neo_swaps::{Call, Event<T>, Pallet, Storage} = 60,
Orderbook: zrml_orderbook_v1::{Call, Event<T>, Pallet, Storage} = 61,
Orderbook: zrml_orderbook::{Call, Event<T>, Pallet, Storage} = 61,
Parimutuel: zrml_parimutuel::{Call, Event<T>, Pallet, Storage} = 62,

$($additional_pallets)*
Expand Down Expand Up @@ -863,9 +863,9 @@ macro_rules! impl_config_traits {
c,
RuntimeCall::Swaps(zrml_swaps::Call::swap_exact_amount_in { .. })
| RuntimeCall::Swaps(zrml_swaps::Call::swap_exact_amount_out { .. })
| RuntimeCall::Orderbook(zrml_orderbook_v1::Call::place_order { .. })
| RuntimeCall::Orderbook(zrml_orderbook_v1::Call::fill_order { .. })
| RuntimeCall::Orderbook(zrml_orderbook_v1::Call::remove_order { .. })
| RuntimeCall::Orderbook(zrml_orderbook::Call::place_order { .. })
| RuntimeCall::Orderbook(zrml_orderbook::Call::fill_order { .. })
| RuntimeCall::Orderbook(zrml_orderbook::Call::remove_order { .. })
),
ProxyType::HandleAssets => matches!(
c,
Expand All @@ -885,9 +885,9 @@ macro_rules! impl_config_traits {
| RuntimeCall::PredictionMarkets(
zrml_prediction_markets::Call::deploy_swap_pool_and_additional_liquidity { .. }
)
| RuntimeCall::Orderbook(zrml_orderbook_v1::Call::place_order { .. })
| RuntimeCall::Orderbook(zrml_orderbook_v1::Call::fill_order { .. })
| RuntimeCall::Orderbook(zrml_orderbook_v1::Call::remove_order { .. })
| RuntimeCall::Orderbook(zrml_orderbook::Call::place_order { .. })
| RuntimeCall::Orderbook(zrml_orderbook::Call::fill_order { .. })
| RuntimeCall::Orderbook(zrml_orderbook::Call::remove_order { .. })
),
}
}
Expand Down Expand Up @@ -1267,12 +1267,12 @@ macro_rules! impl_config_traits {
type PalletId = NeoSwapsPalletId;
}

impl zrml_orderbook_v1::Config for Runtime {
impl zrml_orderbook::Config for Runtime {
type AssetManager = AssetManager;
type RuntimeEvent = RuntimeEvent;
type MarketCommons = MarketCommons;
type PalletId = OrderbookPalletId;
type WeightInfo = zrml_orderbook_v1::weights::WeightInfo<Runtime>;
type WeightInfo = zrml_orderbook::weights::WeightInfo<Runtime>;
}

impl zrml_parimutuel::Config for Runtime {
Expand Down Expand Up @@ -1392,7 +1392,7 @@ macro_rules! create_runtime_api {
list_benchmark!(list, extra, zrml_court, Court);
list_benchmark!(list, extra, zrml_simple_disputes, SimpleDisputes);
list_benchmark!(list, extra, zrml_global_disputes, GlobalDisputes);
list_benchmark!(list, extra, zrml_orderbook_v1, Orderbook);
list_benchmark!(list, extra, zrml_orderbook, Orderbook);
list_benchmark!(list, extra, zrml_parimutuel, Parimutuel);
#[cfg(not(feature = "parachain"))]
list_benchmark!(list, extra, zrml_prediction_markets, PredictionMarkets);
Expand Down Expand Up @@ -1496,7 +1496,7 @@ macro_rules! create_runtime_api {
add_benchmark!(params, batches, zrml_court, Court);
add_benchmark!(params, batches, zrml_simple_disputes, SimpleDisputes);
add_benchmark!(params, batches, zrml_global_disputes, GlobalDisputes);
add_benchmark!(params, batches, zrml_orderbook_v1, Orderbook);
add_benchmark!(params, batches, zrml_orderbook, Orderbook);
add_benchmark!(params, batches, zrml_parimutuel, Parimutuel);
#[cfg(not(feature = "parachain"))]
add_benchmark!(params, batches, zrml_prediction_markets, PredictionMarkets);
Expand Down
8 changes: 4 additions & 4 deletions runtime/zeitgeist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ zrml-global-disputes = { workspace = true, optional = true }
zrml-liquidity-mining = { workspace = true }
zrml-market-commons = { workspace = true }
zrml-neo-swaps = { workspace = true }
zrml-orderbook-v1 = { workspace = true }
zrml-orderbook = { workspace = true }
zrml-parimutuel = { workspace = true }
zrml-prediction-markets = { workspace = true }
zrml-rikiddo = { workspace = true }
Expand Down Expand Up @@ -216,7 +216,7 @@ runtime-benchmarks = [
"zrml-global-disputes/runtime-benchmarks",
"zrml-styx/runtime-benchmarks",
"zrml-swaps/runtime-benchmarks",
"zrml-orderbook-v1/runtime-benchmarks",
"zrml-orderbook/runtime-benchmarks",
]
std = [
"frame-executive/std",
Expand Down Expand Up @@ -325,7 +325,7 @@ std = [
"zrml-swaps-runtime-api/std",
"zrml-styx/std",
"zrml-swaps/std",
"zrml-orderbook-v1/std",
"zrml-orderbook/std",
]
try-runtime = [
"frame-executive/try-runtime",
Expand Down Expand Up @@ -380,7 +380,7 @@ try-runtime = [
"zrml-global-disputes/try-runtime",
"zrml-styx/try-runtime",
"zrml-swaps/try-runtime",
"zrml-orderbook-v1/try-runtime",
"zrml-orderbook/try-runtime",

# Parachain
"pallet-author-inherent?/try-runtime",
Expand Down
2 changes: 1 addition & 1 deletion scripts/benchmarks/configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export ORML_WEIGHT_TEMPLATE="./misc/orml_weight_template.hbs"

export ZEITGEIST_PALLETS=(
zrml_authorized zrml_court zrml_global_disputes zrml_liquidity_mining zrml_neo_swaps \
zrml_prediction_markets zrml_swaps zrml_styx \
zrml_orderbook zrml_parimutuel zrml_prediction_markets zrml_swaps zrml_styx \
)
export ZEITGEIST_PALLETS_RUNS="${ZEITGEIST_PALLETS_RUNS:-1000}"
export ZEITGEIST_PALLETS_STEPS="${ZEITGEIST_PALLETS_STEPS:-10}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/tests/fuzz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ cargo fuzz run --release --fuzz-dir zrml/swaps/fuzz pool_exit_with_exact_pool_am
cargo fuzz run --release --fuzz-dir zrml/swaps/fuzz pool_exit -- -runs=$(($(($RUNS * $POOL_EXIT_FACT)) / $BASE))

# --- Orderbook-v1 Pallet fuzz tests ---
cargo fuzz run --release --fuzz-dir zrml/orderbook-v1/fuzz orderbook_v1_full_workflow -- -runs=$RUNS
cargo fuzz run --release --fuzz-dir zrml/orderbook/fuzz orderbook_v1_full_workflow -- -runs=$RUNS

# --- Rikiddo Pallet fuzz tests ---
# Profile release is required here since it triggers debug assertions otherwise
Expand Down
4 changes: 2 additions & 2 deletions zrml/orderbook-v1/Cargo.toml → zrml/orderbook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ zrml-market-commons = { workspace = true, optional = true }

[dev-dependencies]
test-case = { workspace = true }
zrml-orderbook-v1 = { workspace = true, features = ["mock", "default"] }
zrml-orderbook = { workspace = true, features = ["mock", "default"] }

[features]
default = ["std"]
Expand Down Expand Up @@ -53,5 +53,5 @@ try-runtime = [
[package]
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition = "2021"
name = "zrml-orderbook-v1"
name = "zrml-orderbook"
version = "0.4.1"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ arbitrary = { workspace = true, features = ["derive"] }
frame-system = { workspace = true, features = ["default"] }
libfuzzer-sys = { workspace = true }
zeitgeist-primitives = { workspace = true, features = ["default"] }
zrml-orderbook-v1 = { workspace = true, features = ["default", "mock"] }
zrml-orderbook = { workspace = true, features = ["default", "mock"] }

[package]
authors = ["Automatically generated"]
edition = "2021"
name = "zrml-orderbook-v1-fuzz"
name = "zrml-orderbook-fuzz"
publish = false
version = "0.0.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

use libfuzzer_sys::fuzz_target;
use zeitgeist_primitives::types::{Asset, ScalarPosition, SerdeWrapper};
use zrml_orderbook_v1::{
use zrml_orderbook::{
mock::{ExtBuilder, Orderbook, RuntimeOrigin},
types::OrderSide,
};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 76d6a23

Please sign in to comment.