w3f/polkadot-spec

Signature payload clarifications

radkomih opened this issue · 3 comments

https://spec.polkadot.network/#sect-version-four ar Definition 145. Extrinsic Signature

What do you mean by:
Rv: a UINT32 containing the specification version of 14. - by Rv does it mean runtime version, since specification version of 14 is not very clear?

Same here Fv: a UINT32 containing the format version of 2. - does it mean extrinsic format version?
format version of 2. is a bit confusing

Hi, sorry for the delay.

So I double checked the source code and I really don't know/remember where those values come from (it's possible that this was changed via an runtime upgrade)... Basically, it wants the values spec_version and transaction_version respectively, from the RuntimeVersion type (see substrate docs), implemented in Polkadot as:

=> https://github.com/paritytech/polkadot/blob/master/runtime/polkadot/src/lib.rs#L110

// Polkadot version identifier;
/// Runtime version (Polkadot).
#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
	spec_name: create_runtime_str!("polkadot"),
	impl_name: create_runtime_str!("parity-polkadot"),
	authoring_version: 0,
	spec_version: 9370,
	impl_version: 0,
	#[cfg(not(feature = "disable-runtime-api"))]
	apis: RUNTIME_API_VERSIONS,
	#[cfg(feature = "disable-runtime-api")]
	apis: sp_version::create_apis_vec![[]],
	transaction_version: 20,
	state_version: 0,
};

Those can change with every runtime update and varies based on chain (Kusama, etc.). Will update this.

Also, you can check the source ("source") of those types:

https://paritytech.github.io/substrate/master/frame_system/struct.CheckTxVersion.html#method.additional_signed
https://paritytech.github.io/substrate/master/frame_system/struct.CheckSpecVersion.html#method.additional_signed

For the full SignedExtra:

=> https://github.com/paritytech/polkadot/blob/master/runtime/polkadot/src/lib.rs#L1586

pub type SignedExtra = (
	frame_system::CheckNonZeroSender<Runtime>,
	frame_system::CheckSpecVersion<Runtime>,
	frame_system::CheckTxVersion<Runtime>,
	frame_system::CheckGenesis<Runtime>,
	frame_system::CheckMortality<Runtime>,
	frame_system::CheckNonce<Runtime>,
	frame_system::CheckWeight<Runtime>,
	pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
	claims::PrevalidateAttests<Runtime>,
);

NOTE that most of those types use an empty value (i.e. ()) in their additional_signed method.

👍