Repository: scs/substrate-api-client (language: rust)

Issue:
Activate disabled extrinsic tests
Re-activate the two tests that were disabled due to breaking binary format after enabling the metadata check (See #776)
- `xt_hash_matches_substrate_impl()`
- `xt_hash_matches_substrate_impl_large_xt()`


Discussion / hints:

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index 12271b37b..0ace275a4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -120,6 +120,7 @@ dependencies = [
 name = "ac-primitives"
 version = "0.18.0"
 dependencies = [
+ "frame-metadata-hash-extension",
  "frame-system",
  "impl-serde",
  "pallet-assets",
diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml
index eecde9b60..562cb2b4d 100644
--- a/primitives/Cargo.toml
+++ b/primitives/Cargo.toml
@@ -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" }
diff --git a/primitives/src/extrinsics/mod.rs b/primitives/src/extrinsics/mod.rs
index 897bbc7ec..31e76d4cd 100644
--- a/primitives/src/extrinsics/mod.rs
+++ b/primitives/src/extrinsics/mod.rs
@@ -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,
@@ -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.
@@ -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(
@@ -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"[..];
@@ -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(),
diff --git a/primitives/src/extrinsics/solochain_template_runtime.wasm b/primitives/src/extrinsics/solochain_template_runtime.wasm
new file mode 100755
index 000000000..bf0f87410
Binary files /dev/null and b/primitives/src/extrinsics/solochain_template_runtime.wasm differ
diff --git a/src/api/api_client.rs b/src/api/api_client.rs
index 017076cc6..68052c003 100644
--- a/src/api/api_client.rs
+++ b/src/api/api_client.rs
@@ -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;


Test patch:
diff --git a/primitives/src/extrinsics/test-runtime.compact.wasm b/primitives/src/extrinsics/test-runtime.compact.wasm
deleted file mode 100644
index 8549c4338..000000000
Binary files a/primitives/src/extrinsics/test-runtime.compact.wasm and /dev/null differ