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

Reactivate extrinsic creation unit tests #805

Merged
merged 3 commits into from
Sep 19, 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
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pallet-contracts = { optional = true, git = "https://github.com/paritytech/polka
pallet-staking = { optional = true, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }

[dev-dependencies]
frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
solochain-template-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
sp-keyring = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
Expand Down
9 changes: 4 additions & 5 deletions primitives/src/extrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ mod tests {
use super::*;
use crate::AssetRuntimeConfig;
use extrinsic_params::{GenericAdditionalParams, GenericExtrinsicParams, PlainTip};
use frame_metadata_hash_extension::CheckMetadataHash;
use frame_system::{
CheckEra, CheckGenesis, CheckNonZeroSender, CheckNonce, CheckSpecVersion, CheckTxVersion,
CheckWeight,
Expand Down Expand Up @@ -325,8 +326,6 @@ mod tests {
assert_eq!(call, call1);
}

// Currently does not with available version of substrate extrinsic
#[cfg(not(feature = "disable-metadata-hash-check"))]
#[test]
fn xt_hash_matches_substrate_impl() {
// Define extrinsic params.
Expand All @@ -353,6 +352,7 @@ mod tests {
CheckNonce::<Runtime>::from(nonce),
CheckWeight::<Runtime>::new(),
ChargeTransactionPayment::<Runtime>::from(fee),
CheckMetadataHash::<Runtime>::new(false),
);

let substrate_extrinsic = UncheckedExtrinsic::new_signed(
Expand Down Expand Up @@ -386,13 +386,11 @@ mod tests {
)
}

// Currently does not work with stored bytes. Need to create a new version
#[cfg(not(feature = "disable-metadata-hash-check"))]
#[test]
fn xt_hash_matches_substrate_impl_large_xt() {
// Define xt parameters,
let alice = MultiAddress::Id(AccountKeyring::Alice.to_account_id());
let code: Vec<u8> = include_bytes!("test-runtime.compact.wasm").to_vec();
let code: Vec<u8> = include_bytes!("solochain_template_runtime.wasm").to_vec();
let call = RuntimeCall::System(SystemCall::set_code { code });

let msg = &b"test-message"[..];
Expand All @@ -412,6 +410,7 @@ mod tests {
CheckNonce::<Runtime>::from(nonce),
CheckWeight::<Runtime>::new(),
ChargeTransactionPayment::<Runtime>::from(fee),
CheckMetadataHash::<Runtime>::new(false),
);
let substrate_extrinsic = UncheckedExtrinsic::new_signed(
call.clone(),
Expand Down
Binary file not shown.
Binary file removed primitives/src/extrinsics/test-runtime.compact.wasm
Binary file not shown.
3 changes: 1 addition & 2 deletions src/api/api_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ mod tests {
use super::*;
use crate::rpc::mocks::RpcClientMock;
use ac_primitives::{
AssetRuntimeConfig, DefaultRuntimeConfig, GenericAdditionalParams, GenericExtrinsicParams,
PlainTip,
DefaultRuntimeConfig, GenericAdditionalParams, GenericExtrinsicParams, PlainTip,
};
use frame_metadata::{v14::ExtrinsicMetadata, RuntimeMetadata};
use scale_info::form::PortableForm;
Expand Down