Skip to content

Conversation

@shamil-gadelshin
Copy link
Contributor

@shamil-gadelshin shamil-gadelshin commented Sep 11, 2020

Our current network configuration has unexpected side-effect. In the list of validator who get reward-points for participating in network activities we have special account 5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM in each era.

Example of rewards points for an era:

{
  total: 12,198,
  individual: {
    5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM: 66,
    5D5E3egY12qYrWP7tiAQHYTBzTVfUfFeV68EsKYSQz9FWadN: 6,236,
    5Gmi8oxKM4oV18RmUDyL7HVg494zNDdCE2HGAA12Vewp6ykw: 5,896
  }

}

Also neither Kusama nor Polkadot networks have same effects. In those networks all validators got 20xN points where N is blocks for a validator.

This behavior could affect validator payouts but appears to not cause any problems in the network itself.

After an investigation we found out that 5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM is '0x0' account (zero) and it got rewarded by uncle verification only.

0x0 is a outcome of using Default::default() for account in case of any errors.

in some cases, 0x0 is because the node cannot determine an author() of the uncle block, which in turn is set by ImOnline EventHandler implementation.

Further investigation shows that both Kusama and Polkadot have a different configuration.

parameter_types! {
	pub const UncleGenerations: u32 = 0;
}

// TODO: substrate#2986 implement this properly
impl authorship::Trait for Runtime {
	type FindAuthor = session::FindAccountFromAuthorIndex<Self, Babe>;
	type UncleGenerations = UncleGenerations;
	type FilterUncle = ();
	type EventHandler = (Staking, ImOnline);
}

Having set this configuration for our network we eliminate the issue.

Copy link
Member

@mnaamani mnaamani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
Just minor request: bump the runtime spec version.

Copy link
Collaborator

@bwhm bwhm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like these changes are in line with the values from kusama and polkadot, so I'm happy :)

@mnaamani
Copy link
Member

Clearly omitting ImOnline module as an EventHandler for the authorship module was a mistake in the past.

With respect to the UncleGenerations which is described as:

	/// The number of blocks back we should accept uncles.
	/// This means that we will deal with uncle-parents that are
	/// `UncleGenerations + 1` before `now`.

I can't claim to fully understand the significance of 5 vs 0 so selecting the same value used in polkadot and kusama production networks is fine by me.

@mnaamani mnaamani merged commit 42e1f44 into Joystream:iznik Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants