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

Fix benchmarks #1046

Merged
merged 14 commits into from
Sep 15, 2023
Merged
6 changes: 6 additions & 0 deletions Cargo.lock

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

25 changes: 10 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,22 @@ build-bifrost-polkadot-release:
build-all-release: copy-genesis-config-release
cargo build -p node-cli --locked --features "with-all-runtime" --release

.PHONY: build-bifrost-rococo-fast-release # build bifrost rococo fast release
build-bifrost-rococo-fast-release:
cargo build -p node-cli --locked --features "with-bifrost-kusama-runtime,fast-runtime" --release


.PHONY: check-all # cargo check all runtime
check-all: format
SKIP_WASM_BUILD= cargo check -p node-cli --locked --features "with-all-runtime,runtime-benchmarks,try-runtime"

.PHONY: test-all # cargo test all runtime
test-all:
.PHONY: test-all # cargo test all
test-all: integration-test test-runtimes test-benchmarks


.PHONY: test-runtimes
test-runtimes:
SKIP_WASM_BUILD= cargo test --features "with-all-runtime" --lib

.PHONY: test-benchmarks
test-benchmarks:
cargo test --all benchmarking --features="with-all-runtime,runtime-benchmarks, polkadot" --exclude "*-integration-tests"

.PHONY: integration-test # integration test
integration-test:
SKIP_WASM_BUILD= cargo test -p *-integration-tests
Expand Down Expand Up @@ -67,10 +70,6 @@ format:
clippy:
cargo clippy --all --all-targets --features=with-all-runtime -- -D warnings

.PHONY: test-benchmarking # test with benchmarking
test-benchmarking:
cargo test --features runtime-benchmarks --features with-all-runtime --features --all benchmarking

.PHONY: benchmarking-staking # benchmarking staking pallet
benchmarking-staking:
cargo run -p node-cli --locked --features "with-bifrost-kusama-runtime,runtime-benchmarks" --release \
Expand Down Expand Up @@ -117,10 +116,6 @@ build-bifrost-polkadot-wasm:
build-bifrost-rococo-fast-wasm:
.maintain/build-wasm.sh bifrost-kusama fast

.PHONY: check-try-runtime # check try runtime
check-try-runtime:
SKIP_WASM_BUILD= cargo check --features try-runtime --features with-bifrost-runtime

.PHONY: try-kusama-runtime-upgrade # try kusama runtime upgrade
try-kusama-runtime-upgrade:
cargo run --features try-runtime --features with-bifrost-kusama-runtime --release \
Expand Down
49 changes: 49 additions & 0 deletions node/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#![cfg_attr(not(feature = "std"), no_std)]

use codec::MaxEncodedLen;
use frame_support::dispatch::Weight;
use scale_info::TypeInfo;
use sp_core::{Decode, Encode, RuntimeDebug, H160};
use sp_runtime::{
Expand Down Expand Up @@ -257,6 +258,54 @@ impl SendXcm for DoNothingRouter {
}
}

pub struct Weightless;
impl PreparedMessage for Weightless {
fn weight_of(&self) -> Weight {
Weight::default()
}
}

pub struct DoNothingExecuteXcm;
impl<Call> ExecuteXcm<Call> for DoNothingExecuteXcm {
type Prepared = Weightless;

fn prepare(_message: Xcm<Call>) -> Result<Self::Prepared, Xcm<Call>> {
Ok(Weightless)
}

fn execute(
_origin: impl Into<MultiLocation>,
_pre: Self::Prepared,
_hash: XcmHash,
_weight_credit: Weight,
) -> Outcome {
Outcome::Complete(Weight::default())
}

fn execute_xcm(
_origin: impl Into<MultiLocation>,
_message: Xcm<Call>,
_hash: XcmHash,
_weight_limit: Weight,
) -> Outcome {
Outcome::Complete(Weight::default())
}

fn execute_xcm_in_credit(
_origin: impl Into<MultiLocation>,
_message: Xcm<Call>,
_hash: XcmHash,
_weight_limit: Weight,
_weight_credit: Weight,
) -> Outcome {
Outcome::Complete(Weight::default())
}

fn charge_fees(_location: impl Into<MultiLocation>, _fees: MultiAssets) -> XcmResult {
Ok(())
}
}

#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug, TypeInfo)]
pub enum XcmOperationType {
// SALP operations
Expand Down
4 changes: 3 additions & 1 deletion node/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ where
C::Api: SalpRuntimeApi<Block, ParaId, AccountId>,
C::Api: VeMintingRuntimeApi<Block, AccountId>,
C::Api: ZenlinkProtocolRuntimeApi<Block, AccountId, AssetId>,
C::Api: StablePoolRuntimeApi<Block>,
C::Api: BlockBuilder<Block>,
P: TransactionPool + Sync + Send + 'static,
{
Expand All @@ -144,7 +145,8 @@ where
module.merge(FlexibleFeeRpc::new(client.clone()).into_rpc())?;
module.merge(SalpRpc::new(client.clone()).into_rpc())?;
module.merge(VeMintingRpc::new(client.clone()).into_rpc())?;
module.merge(ZenlinkProtocol::new(client).into_rpc())?;
module.merge(ZenlinkProtocol::new(client.clone()).into_rpc())?;
module.merge(StablePoolRpc::new(client).into_rpc())?;

Ok(module)
}
Loading
Loading