Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Running try-runtime with try-state option doesn't fail #13837

Closed
2 tasks done
liamaharon opened this issue Apr 6, 2023 · 5 comments
Closed
2 tasks done

Running try-runtime with try-state option doesn't fail #13837

liamaharon opened this issue Apr 6, 2023 · 5 comments
Assignees
Labels
I3-bug The node fails to follow expected behavior. U1-asap No need to stop dead in your tracks, however issue should be addressed as soon as possible.

Comments

@liamaharon
Copy link
Contributor

liamaharon commented Apr 6, 2023

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

Using the try-runtime --try-state <PALLET> flag appears to break the try-state checks in the pallet.

Originally reported in this SE question.

Steps to reproduce

No response

@liamaharon liamaharon added the I3-bug The node fails to follow expected behavior. label Apr 6, 2023
@liamaharon liamaharon self-assigned this Apr 6, 2023
@Szegoo
Copy link
Contributor

Szegoo commented Apr 8, 2023

After doing some testing myself I realized that running try-runtime with try-state option does actually fail.

When running try-state for some specific pallet we execute the following code:

Select::Only(ref pallet_names) => {
	let try_state_fns: &[(
		&'static str,
		fn(BlockNumber, Select) -> Result<(), &'static str>,
	)] = &[for_tuples!(
		#( (<Tuple as crate::traits::PalletInfoAccess>::name(), Tuple::try_state) ),*
	)];
	let mut result = Ok(());
	for (name, try_state_fn) in try_state_fns {
		if pallet_names.iter().any(|n| n == name.as_bytes()) {
			result = result.and(try_state_fn(n.clone(), targets.clone()));
		}
	}
	result
},

The reason it did not fail is that the Collective pallet was not found anywhere inside try_state_fns, so the try-state for the Collective was never actually run.

Tbh I am not entirely sure why the Collective pallet was not found in try_state_fns since the kitchensink runtime does implement the pallet it three instances(CouncilCollective, TechnicalCollective, AllianceCollective).

I have opened a PR that adds a warning message in case the pallet provided to try-state was not found since that could save some time in the future for someone in scenarios like this. #13858

@liamaharon
Copy link
Contributor Author

Nice catch.

To confirm, were you able to get try-state working when you used it with the name of an instantiated pallet like --try-state CouncilCollective?

@Szegoo
Copy link
Contributor

Szegoo commented Apr 8, 2023

To confirm, were you able to get try-state working when you used it with the name of an instantiated pallet like --try-state CouncilCollective?

No, it did not work.

@liamaharon liamaharon added the U1-asap No need to stop dead in your tracks, however issue should be addressed as soon as possible. label Apr 12, 2023
@liamaharon
Copy link
Contributor Author

liamaharon commented Apr 14, 2023

Hey @Szegoo, I made a typo in my earlier comment and meant to say Council instead of CouncilCollective.

I wasn't able to replicate this on this branch using the correct name for the pallet: https://github.com/paritytech/substrate/tree/try-state-works-collective

  1. substrate --dev
  2. cargo run --features=try-runtime try-runtime --runtime=existing follow-chain --uri ws://localhost:9944 --try-state=Council

Screenshot 2023-04-14 at 12 27 14

The name of the pallet passed to --try-state needs to match how it's specified in construct_runtime!:

Screenshot 2023-04-14 at 12 26 08

Let me know if you're able to reproduce the issue using the name of the pallet as defined in construct_runtime! and I'll reopen this issue.

@Szegoo
Copy link
Contributor

Szegoo commented Apr 14, 2023

@liamaharon Yes, it was my fault. For some reason, I was testing with CouncilCollective 🤦.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I3-bug The node fails to follow expected behavior. U1-asap No need to stop dead in your tracks, however issue should be addressed as soon as possible.
Projects
Status: Done
Development

No branches or pull requests

2 participants