ronantakizawa/codereview-bench huggingface dataset:
Repository: paritytech/substrate
File: frame/contracts/src/schedule.rs (Rust)

Code before:

	/// Weight of calling `seal_hash_blake2_256`.
	pub hash_blake2_256: u64,

	/// Weight per byte hashed by `seal_hash_blake2_256`.
	pub hash_blake2_256_per_byte: u64,

	/// Weight of calling `seal_hash_blake2_128`.
	pub hash_blake2_128: u64,

	/// Weight per byte hashed by `seal_hash_blake2_128`.
	pub hash_blake2_128_per_byte: u64,

	/// Weight of calling `seal_ecdsa_recover`.
	pub ecdsa_recover: u64,

	/// Weight of calling `seal_ecdsa_to_eth_address`.
	pub ecdsa_to_eth_address: u64,

	/// Weight of calling `reentrance_count`.
	pub reentrance_count: u64,

	/// Weight of calling `account_reentrance_count`.
	pub account_reentrance_count: u64,

	/// Weight of calling `instantiation_count`.
	pub instantiation_nonce: u64,

	/// The type parameter is used in the default implementation.
	#[codec(skip)]
	pub _phantom: PhantomData<T>,
}

macro_rules! replace_token {
	($_in:tt $replacement:tt) => {
		$replacement
	};
}

macro_rules! call_zero {
	($name:ident, $( $arg:expr ),*) => {
		T::WeightInfo::$name($( replace_token!($arg 0) ),*)
	};
}

macro_rules! cost_args {
	($name:ident, $( $arg: expr ),+) => {
		(T::WeightInfo::$name($( $arg ),+).saturating_sub(call_zero!($name, $( $arg ),+))).ref_time()
	}
}


Review comment (suggestion):
```suggestion
	/// Weight of calling `instantiation_nonce`.
```

Code after:
	pub hash_sha2_256_per_byte: u64,

	/// Weight of calling `seal_hash_keccak_256`.
	pub hash_keccak_256: u64,

	/// Weight per byte hashed by `seal_hash_keccak_256`.
	pub hash_keccak_256_per_byte: u64,

	/// Weight of calling `seal_hash_blake2_256`.
	pub hash_blake2_256: u64,

	/// Weight per byte hashed by `seal_hash_blake2_256`.
	pub hash_blake2_256_per_byte: u64,

	/// Weight of calling `seal_hash_blake2_128`.
	pub hash_blake2_128: u64,

	/// Weight per byte hashed by `seal_hash_blake2_128`.
	pub hash_blake2_128_per_byte: u64,

	/// Weight of calling `seal_ecdsa_recover`.
	pub ecdsa_recover: u64,

	/// Weight of calling `seal_ecdsa_to_eth_address`.
	pub ecdsa_to_eth_address: u64,

	/// Weight of calling `reentrance_count`.
	pub reentrance_count: u64,

	/// Weight of calling `account_reentrance_count`.
	pub account_reentrance_count: u64,

	/// Weight of calling `instantiation_nonce`.
	pub instantiation_nonce: u64,

	/// The type parameter is used in the default implementation.
	#[codec(skip)]
	pub _phantom: PhantomData<T>,
}

macro_rules! replace_token {
	($_in:tt $replacement:tt) => {
		$replacement
	};
}

macro_rules! call_zero {
	($name:ident, $( $arg:expr ),*) => {
		T::WeightInfo::$name($( replace_token!($arg 0) ),*)
	};
}
Repository: paritytech/substrate
File: client/cli/src/arg_enums.rs (Rust)

Code before:
	ParityDbDeprecated,
}

impl Database {
	/// Returns all the variants of this enum to be shown in the cli.
	pub const fn variants() -> &'static [&'static str] {
		&[
			#[cfg(feature = "rocksdb")]
			"rocksdb",
			"paritydb",
			"paritydb-experimental",
			"auto",
		]
	}
}

/// Whether off-chain workers are enabled.
#[allow(missing_docs)]
#[derive(Debug, Clone, ValueEnum)]
#[value(rename_all = "kebab-case")]
pub enum OffchainWorkerEnabled {
	/// Always have offchain worker enabled.
	Always,
	/// Never enable the offchain worker.
	Never,
	/// Only enable the offchain worker when running as a validator (or collator, if this is a parachain node).
	WhenAuthority,
}

/// Syncing mode.
#[derive(Debug, Clone, Copy, ValueEnum, PartialEq)]
#[value(rename_all = "kebab-case")]
pub enum SyncMode {
	/// Full sync. Download end verify all blocks.
	Full,
	/// Download blocks without executing them. Download latest state with proofs.
	Fast,
	/// Download blocks without executing them. Download latest state without proofs.
	FastUnsafe,
	/// Prove finality and download the latest state.
	Warp,
}

impl Into<sc_network::config::SyncMode> for SyncMode {
	fn into(self) -> sc_network::config::SyncMode {
		match self {
			SyncMode::Full => sc_network::config::SyncMode::Full,
			SyncMode::Fast =>
				sc_network::config::SyncMode::Fast { skip_proofs: false, storage_chain_mode: false },
			SyncMode::FastUnsafe =>
				sc_network::config::SyncMode::Fast { skip_proofs: true, storage_chain_mode: false },

Review comment (suggestion):
```suggestion
	/// Only enable the offchain worker when running as a validator (or collator, if this is a
	/// parachain node).
```

Code after:
	ParityDbDeprecated,
}

impl Database {
	/// Returns all the variants of this enum to be shown in the cli.
	pub const fn variants() -> &'static [&'static str] {
		&[
			#[cfg(feature = "rocksdb")]
			"rocksdb",
			"paritydb",
			"paritydb-experimental",
			"auto",
		]
	}
}

/// Whether off-chain workers are enabled.
#[allow(missing_docs)]
#[derive(Debug, Clone, ValueEnum)]
#[value(rename_all = "kebab-case")]
pub enum OffchainWorkerEnabled {
	/// Always have offchain worker enabled.
	Always,
	/// Never enable the offchain worker.
	Never,
	/// Only enable the offchain worker when running as a validator (or collator, if this is a
	/// parachain node).
	WhenAuthority,
}

/// Syncing mode.
#[derive(Debug, Clone, Copy, ValueEnum, PartialEq)]
#[value(rename_all = "kebab-case")]
pub enum SyncMode {
	/// Full sync. Download end verify all blocks.
	Full,
	/// Download blocks without executing them. Download latest state with proofs.
	Fast,
	/// Download blocks without executing them. Download latest state without proofs.
	FastUnsafe,
	/// Prove finality and download the latest state.
	Warp,
}

impl Into<sc_network::config::SyncMode> for SyncMode {
	fn into(self) -> sc_network::config::SyncMode {
		match self {
			SyncMode::Full => sc_network::config::SyncMode::Full,
			SyncMode::Fast =>
				sc_network::config::SyncMode::Fast { skip_proofs: false, storage_chain_mode: false },
			SyncMode::FastUnsafe =>
Repository: paritytech/substrate
File: client/beefy/src/tests.rs (Rust)

Code before:
		// make sure genesis is the only block in network, so we can insert genesis at he beginning
		// of hashes, otherwise indexing would be broken
		assert!(self.peer(0).client().as_backend().blockchain().hash(1).unwrap().is_none());

		// push genesis to make indexing human readable (index equals to block number)
		all_hashes.push(self.peer(0).client().info().genesis_hash);

		let mut built_hashes = self.peer(0).generate_blocks(count, BlockOrigin::File, |builder| {
			let mut block = builder.build().unwrap().block;

			if include_mmr_digest {
				let block_num = *block.header.number();
				let num_byte = block_num.to_le_bytes().into_iter().next().unwrap();
				let mmr_root = MmrRootHash::repeat_byte(num_byte);
				add_mmr_digest(&mut block.header, mmr_root);
			}

			if *block.header.number() % session_length == 0 {
				add_auth_change_digest(&mut block.header, validator_set.clone());
			}

			block
		});
		runtime.block_on(self.wait_until_sync());

		all_hashes.append(&mut built_hashes);
		all_hashes
	}
}

impl TestNetFactory for BeefyTestNet {
	type Verifier = PassThroughVerifier;
	type BlockImport = BeefyBlockImport;
	type PeerData = PeerData;

	fn make_verifier(&self, _client: PeersClient, _: &PeerData) -> Self::Verifier {
		PassThroughVerifier::new(false) // use non-instant finality.
	}

	fn make_block_import(
		&self,
		client: PeersClient,
	) -> (
		BlockImportAdapter<Self::BlockImport>,
		Option<BoxJustificationImport<Block>>,
		Self::PeerData,
	) {
		let inner = BlockImportAdapter::new(client.clone());
		let (block_import, voter_links, rpc_links) = beefy_block_import_and_links(
			inner,
			client.as_backend(),

Review comment (suggestion):
```suggestion
		all_hashes.extend(built_hashes);
```

Code after:
				let mmr_root = MmrRootHash::repeat_byte(num_byte);
				add_mmr_digest(&mut block.header, mmr_root);
			}

			if *block.header.number() % session_length == 0 {
				add_auth_change_digest(&mut block.header, validator_set.clone());
			}

			block
		});
		all_hashes.extend(built_hashes);
		self.run_until_sync().await;

		all_hashes
	}
}

impl TestNetFactory for BeefyTestNet {
	type Verifier = PassThroughVerifier;
	type BlockImport = BeefyBlockImport;
	type PeerData = PeerData;

	fn make_verifier(&self, _client: PeersClient, _: &PeerData) -> Self::Verifier {
		PassThroughVerifier::new(false) // use non-instant finality.
	}

	fn make_block_import(
		&self,
		client: PeersClient,
	) -> (
		BlockImportAdapter<Self::BlockImport>,
		Option<BoxJustificationImport<Block>>,
		Self::PeerData,
	) {
		let inner = BlockImportAdapter::new(client.clone());
		let (block_import, voter_links, rpc_links) = beefy_block_import_and_links(
			inner,
			client.as_backend(),
			Arc::new(two_validators::TestApi {}),
		);
		let peer_data = PeerData {
			beefy_rpc_links: Mutex::new(Some(rpc_links)),
			beefy_voter_links: Mutex::new(Some(voter_links)),
			..Default::default()
		};
		(BlockImportAdapter::new(block_import), None, peer_data)
	}

	fn peer(&mut self, i: usize) -> &mut BeefyPeer {
		&mut self.peers[i]
	}
Repository: paritytech/substrate
File: frame/contracts/src/wasm/mod.rs (Rust)

Code before:
		debug_buffer: Vec<u8>,
		ecdsa_recover: RefCell<Vec<([u8; 65], [u8; 32])>>,
		code_hashes: Vec<CodeHash<Test>>,
	}

	/// The call is mocked and just returns this hardcoded value.
	fn call_return_data() -> Vec<u8> {
		vec![0xDE, 0xAD, 0xBE, 0xEF]
	}

	impl Default for MockExt {
		fn default() -> Self {
			Self {
				code_hashes: Default::default(),
				storage: Default::default(),
				instantiates: Default::default(),
				terminations: Default::default(),
				calls: Default::default(),
				code_calls: Default::default(),
				transfers: Default::default(),
				events: Default::default(),
				runtime_calls: Default::default(),
				schedule: Default::default(),
				gas_meter: GasMeter::new(
					Weight::from_ref_time(10_000_000_000).set_proof_size(10 * 1024 * 1024),
				),
				debug_buffer: Default::default(),
				ecdsa_recover: Default::default(),
			}
		}
	}

	impl Ext for MockExt {
		type T = Test;

		fn call(
			&mut self,
			_gas_limit: Weight,
			to: AccountIdOf<Self::T>,
			value: u64,
			data: Vec<u8>,
			allows_reentry: bool,
		) -> Result<ExecReturnValue, ExecError> {
			self.calls.push(CallEntry { to, value, data, allows_reentry });
			Ok(ExecReturnValue { flags: ReturnFlags::empty(), data: call_return_data() })
		}
		fn delegate_call(
			&mut self,
			code_hash: CodeHash<Self::T>,
			data: Vec<u8>,
		) -> Result<ExecReturnValue, ExecError> {

Review comment (suggestion):
```suggestion
				gas_meter: GasMeter::new(
					Weight::from_parts(10_000_000_000, 10 * 1024 * 1024),
				),
```

Code after:
		ecdsa_recover: RefCell<Vec<([u8; 65], [u8; 32])>>,
		code_hashes: Vec<CodeHash<Test>>,
	}

	/// The call is mocked and just returns this hardcoded value.
	fn call_return_data() -> Vec<u8> {
		vec![0xDE, 0xAD, 0xBE, 0xEF]
	}

	impl Default for MockExt {
		fn default() -> Self {
			Self {
				code_hashes: Default::default(),
				storage: Default::default(),
				instantiates: Default::default(),
				terminations: Default::default(),
				calls: Default::default(),
				code_calls: Default::default(),
				transfers: Default::default(),
				events: Default::default(),
				runtime_calls: Default::default(),
				schedule: Default::default(),
				gas_meter: GasMeter::new(Weight::from_parts(10_000_000_000, 10 * 1024 * 1024)),
				debug_buffer: Default::default(),
				ecdsa_recover: Default::default(),
			}
		}
	}

	impl Ext for MockExt {
		type T = Test;

		fn call(
			&mut self,
			_gas_limit: Weight,
			to: AccountIdOf<Self::T>,
			value: u64,
			data: Vec<u8>,
			allows_reentry: bool,
		) -> Result<ExecReturnValue, ExecError> {
			self.calls.push(CallEntry { to, value, data, allows_reentry });
			Ok(ExecReturnValue { flags: ReturnFlags::empty(), data: call_return_data() })
		}
		fn delegate_call(
			&mut self,
			code_hash: CodeHash<Self::T>,
			data: Vec<u8>,
		) -> Result<ExecReturnValue, ExecError> {
			self.code_calls.push(CallCodeEntry { code_hash, data });
			Ok(ExecReturnValue { flags: ReturnFlags::empty(), data: call_return_data() })
		}
Repository: paritytech/substrate
File: frame/contracts/src/tests.rs (Rust)

Code before:
		.result
		.unwrap()
		.account_id;

		let addr_callee = Contracts::bare_instantiate(
			ALICE,
			min_balance * 100,
			GAS_LIMIT,
			None,
			Code::Upload(callee_code),
			vec![],
			vec![1],
			false,
		)
		.result
		.unwrap()
		.account_id;

		// Call something trivial with a huge gas limit so that we can observe the effects
		// of pre-charging. This should create a difference between consumed and required.
		let call = RuntimeCall::Contracts(crate::Call::call {
			dest: addr_callee,
			value: 0,
			gas_limit: GAS_LIMIT
				.set_ref_time(GAS_LIMIT.ref_time() / 3)
				.set_proof_size(GAS_LIMIT.proof_size() / 3),
			storage_deposit_limit: None,
			data: vec![],
		});
		let result = Contracts::bare_call(
			ALICE,
			addr_caller.clone(),
			0,
			GAS_LIMIT,
			None,
			call.encode(),
			false,
			Determinism::Deterministic,
		);
		// contract encodes the result of the dispatch runtime
		let outcome = u32::decode(&mut result.result.unwrap().data.as_ref()).unwrap();
		assert_eq!(outcome, 0);
		assert!(result.gas_required.ref_time() > result.gas_consumed.ref_time());

		// Make the same call using the required gas. Should succeed.
		assert_ok!(
			Contracts::bare_call(
				ALICE,
				addr_caller,
				0,
				result.gas_required,

Review comment (suggestion):
`Weight` should implement `Div`.

```suggestion
			gas_limit: GAS_LIMIT / 3,
```

Code after:
		.result
		.unwrap()
		.account_id;

		let addr_callee = Contracts::bare_instantiate(
			ALICE,
			min_balance * 100,
			GAS_LIMIT,
			None,
			Code::Upload(callee_code),
			vec![],
			vec![1],
			false,
		)
		.result
		.unwrap()
		.account_id;

		// Call something trivial with a huge gas limit so that we can observe the effects
		// of pre-charging. This should create a difference between consumed and required.
		let call = RuntimeCall::Contracts(crate::Call::call {
			dest: addr_callee,
			value: 0,
			gas_limit: GAS_LIMIT / 3,
			storage_deposit_limit: None,
			data: vec![],
		});
		let result = Contracts::bare_call(
			ALICE,
			addr_caller.clone(),
			0,
			GAS_LIMIT,
			None,
			call.encode(),
			false,
			Determinism::Deterministic,
		);
		// contract encodes the result of the dispatch runtime
		let outcome = u32::decode(&mut result.result.unwrap().data.as_ref()).unwrap();
		assert_eq!(outcome, 0);
		assert!(result.gas_required.ref_time() > result.gas_consumed.ref_time());

		// Make the same call using the required gas. Should succeed.
		assert_ok!(
			Contracts::bare_call(
				ALICE,
				addr_caller,
				0,
				result.gas_required,
				None,
				call.encode(),
Repository: paritytech/substrate
File: frame/contracts/src/schedule.rs (Rust)

Code before:
macro_rules! cost {
	($name:ident) => {
		cost_args!($name, 1)
	};
}

macro_rules! cost_batched {
	($name:ident) => {
		cost_batched_args!($name, 1)
	};
}

macro_rules! cost_byte {
	($name:ident) => {
		cost_byte_args!($name, 1)
	};
}

macro_rules! cost_byte_batched {
	($name:ident) => {
		cost_byte_batched_args!($name, 1)
	};
}

macro_rules! to_weight {
	($ref_time:expr $(, $proof_time:expr )?) => {
		Weight::from_ref_time($ref_time)$(.set_proof_size($proof_time))?
	};
}

impl Default for Limits {
	fn default() -> Self {
		Self {
			event_topics: 4,
			globals: 256,
			locals: 1024,
			parameters: 128,
			memory_pages: 16,
			// 4k function pointers (This is in count not bytes).
			table_size: 4096,
			br_table_size: 256,
			subject_len: 32,
			call_depth: 32,
			payload_len: 16 * 1024,
		}
	}
}

impl<T: Config> Default for InstructionWeights<T> {
	fn default() -> Self {
		let max_pages = Limits::default().memory_pages;

Review comment (suggestion):
```suggestion
	($ref_time:expr $(, $proof_size:expr )?) => {
```

Code after:
macro_rules! cost {
	($name:ident) => {
		cost_args!($name, 1)
	};
}

macro_rules! cost_batched {
	($name:ident) => {
		cost_batched_args!($name, 1)
	};
}

macro_rules! cost_byte {
	($name:ident) => {
		cost_byte_args!($name, 1)
	};
}

macro_rules! cost_byte_batched {
	($name:ident) => {
		cost_byte_batched_args!($name, 1)
	};
}

macro_rules! to_weight {
	($ref_time:expr $(, $proof_size:expr )?) => {
		Weight::from_ref_time($ref_time)$(.set_proof_size($proof_size))?
	};
}

impl Default for Limits {
	fn default() -> Self {
		Self {
			event_topics: 4,
			globals: 256,
			locals: 1024,
			parameters: 128,
			memory_pages: 16,
			// 4k function pointers (This is in count not bytes).
			table_size: 4096,
			br_table_size: 256,
			subject_len: 32,
			call_depth: 32,
			payload_len: 16 * 1024,
		}
	}
}

impl<T: Config> Default for InstructionWeights<T> {
	fn default() -> Self {
		let max_pages = Limits::default().memory_pages;
Repository: paritytech/substrate
File: frame/contracts/src/schedule.rs (Rust)

Code before:
	($name:ident) => {
		cost_args!($name, 1)
	};
}

macro_rules! cost_batched {
	($name:ident) => {
		cost_batched_args!($name, 1)
	};
}

macro_rules! cost_byte {
	($name:ident) => {
		cost_byte_args!($name, 1)
	};
}

macro_rules! cost_byte_batched {
	($name:ident) => {
		cost_byte_batched_args!($name, 1)
	};
}

macro_rules! to_weight {
	($ref_time:expr $(, $proof_time:expr )?) => {
		Weight::from_ref_time($ref_time)$(.set_proof_size($proof_time))?
	};
}

impl Default for Limits {
	fn default() -> Self {
		Self {
			event_topics: 4,
			globals: 256,
			locals: 1024,
			parameters: 128,
			memory_pages: 16,
			// 4k function pointers (This is in count not bytes).
			table_size: 4096,
			br_table_size: 256,
			subject_len: 32,
			call_depth: 32,
			payload_len: 16 * 1024,
		}
	}
}

impl<T: Config> Default for InstructionWeights<T> {
	fn default() -> Self {
		let max_pages = Limits::default().memory_pages;
		Self {

Review comment (suggestion):
```suggestion
		Weight::from_ref_time($ref_time)$(.set_proof_size($proof_size))?
```

Code after:
	($name:ident) => {
		cost_args!($name, 1)
	};
}

macro_rules! cost_batched {
	($name:ident) => {
		cost_batched_args!($name, 1)
	};
}

macro_rules! cost_byte {
	($name:ident) => {
		cost_byte_args!($name, 1)
	};
}

macro_rules! cost_byte_batched {
	($name:ident) => {
		cost_byte_batched_args!($name, 1)
	};
}

macro_rules! to_weight {
	($ref_time:expr $(, $proof_size:expr )?) => {
		Weight::from_ref_time($ref_time)$(.set_proof_size($proof_size))?
	};
}

impl Default for Limits {
	fn default() -> Self {
		Self {
			event_topics: 4,
			globals: 256,
			locals: 1024,
			parameters: 128,
			memory_pages: 16,
			// 4k function pointers (This is in count not bytes).
			table_size: 4096,
			br_table_size: 256,
			subject_len: 32,
			call_depth: 32,
			payload_len: 16 * 1024,
		}
	}
}

impl<T: Config> Default for InstructionWeights<T> {
	fn default() -> Self {
		let max_pages = Limits::default().memory_pages;
		Self {
Repository: paritytech/substrate
File: client/service/test/src/client/mod.rs (Rust)

Code before:
	let mut b1 = client.new_block_at(&BlockId::Number(0), Default::default(), false).unwrap();

	// b1 is created, but not imported
	b1.push_transfer(Transfer {
		from: AccountKeyring::Alice.into(),
		to: AccountKeyring::Ferdie.into(),
		amount: 1,
		nonce: 0,
	})
	.unwrap();
	let b1 = b1.build().unwrap().block;

	let check_block_a1 = BlockCheckParams {
		hash: a1.hash(),
		number: 0,
		parent_hash: *a1.header().parent_hash(),
		allow_missing_state: false,
		allow_missing_parent: false,
		import_existing: false,
	};

	assert_eq!(
		block_on(client.check_block(check_block_a1.clone())).unwrap(),
		ImportResult::imported(false),
	);
	assert_eq!(client.block_status(check_block_a1.hash).unwrap(), BlockStatus::Unknown,);

	block_on(client.import_as_final(BlockOrigin::Own, a1.clone())).unwrap();

	assert_eq!(
		block_on(client.check_block(check_block_a1.clone())).unwrap(),
		ImportResult::AlreadyInChain,
	);
	assert_eq!(client.block_status(check_block_a1.hash).unwrap(), BlockStatus::InChainWithState,);

	let a2 = client
		.new_block_at(&BlockId::Hash(a1.hash()), Default::default(), false)
		.unwrap()
		.build()
		.unwrap()
		.block;
	block_on(client.import_as_final(BlockOrigin::Own, a2.clone())).unwrap();

	let check_block_a2 = BlockCheckParams {
		hash: a2.hash(),
		number: 1,
		parent_hash: *a1.header().parent_hash(),
		allow_missing_state: false,
		allow_missing_parent: false,
		import_existing: false,
	};

Review comment (suggestion):
```suggestion
	assert_eq!(client.block_status(check_block_a1.hash).unwrap(), BlockStatus::Unknown);
```

Code after:
	let mut b1 = client.new_block_at(&BlockId::Number(0), Default::default(), false).unwrap();

	// b1 is created, but not imported
	b1.push_transfer(Transfer {
		from: AccountKeyring::Alice.into(),
		to: AccountKeyring::Ferdie.into(),
		amount: 1,
		nonce: 0,
	})
	.unwrap();
	let b1 = b1.build().unwrap().block;

	let check_block_a1 = BlockCheckParams {
		hash: a1.hash(),
		number: 0,
		parent_hash: *a1.header().parent_hash(),
		allow_missing_state: false,
		allow_missing_parent: false,
		import_existing: false,
	};

	assert_eq!(
		block_on(client.check_block(check_block_a1.clone())).unwrap(),
		ImportResult::imported(false),
	);
	assert_eq!(client.block_status(check_block_a1.hash).unwrap(), BlockStatus::Unknown);

	block_on(client.import_as_final(BlockOrigin::Own, a1.clone())).unwrap();

	assert_eq!(
		block_on(client.check_block(check_block_a1.clone())).unwrap(),
		ImportResult::AlreadyInChain,
	);
	assert_eq!(client.block_status(check_block_a1.hash).unwrap(), BlockStatus::InChainWithState);

	let a2 = client
		.new_block_at(&BlockId::Hash(a1.hash()), Default::default(), false)
		.unwrap()
		.build()
		.unwrap()
		.block;
	block_on(client.import_as_final(BlockOrigin::Own, a2.clone())).unwrap();

	let check_block_a2 = BlockCheckParams {
		hash: a2.hash(),
		number: 1,
		parent_hash: *a1.header().parent_hash(),
		allow_missing_state: false,
		allow_missing_parent: false,
		import_existing: false,
	};