subscan-essentials icon indicating copy to clipboard operation
subscan-essentials copied to clipboard

Inter link between para block and relay blocks

Open hackfisher opened this issue 3 years ago • 0 comments

Follow-up suggestions for improving some parachain related functions.

In Polkadot, you can often see some parainclusion (CandidateIncluded) events, which record that a parachain block para_block is included by the relay chain. For this para_block, there are some relay chain related blocks, including relay_parent, backed_relay_block, included_relay_block, you can Consider doing some association via hyperlinks. (It happens that the parachain bridge also needs to do a related data, maybe use subquery indexing)

  • It is recommended that the parachain display para_id, or make some associations between para_id and its related parachain block header hashes in some Polkadot events.

  • Reverse para chain -> relay chain can also be linked and displayed, consider referring to this subql: https://github.com/darwinia-network/bridger/pull/437

/// A unique descriptor of the candidate receipt.
#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)]
#[cfg_attr(feature = "std", derive(Hash, MallocSizeOf))]
pub struct CandidateDescriptor<H = Hash> {
	/// The ID of the para this is a candidate for.
	pub para_id: Id,
	/// The hash of the relay-chain block this is executed in the context of.
	pub relay_parent: H,
	/// The collator's sr25519 public key.
	pub collator: CollatorId,
	/// The blake2-256 hash of the persisted validation data. This is extra data derived from
	/// relay-chain state which may vary based on bitfields included before the candidate.
	/// Thus it cannot be derived entirely from the relay-parent.
	pub persisted_validation_data_hash: Hash,
	/// The blake2-256 hash of the PoV.
	pub pov_hash: Hash,
	/// The root of a block's erasure encoding Merkle tree.
	pub erasure_root: Hash,
	/// Signature on blake2-256 of components of this receipt:
	/// The parachain index, the relay parent, the validation data hash, and the `pov_hash`.
	pub signature: CollatorSignature,
	/// Hash of the para header that is being generated by this candidate.
	pub para_head: Hash,
	/// The blake2-256 hash of the validation code bytes.
	pub validation_code_hash: ValidationCodeHash,
}

hackfisher avatar Apr 02 '22 09:04 hackfisher