-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
We only need the key signing a report transaction to be an account key so that it can pay some fee, right? We've no existing mechanism for actions signed by session keys to change their controller account fees yet? We could maybe permit free reports by the grandpa ed25519 key if the deduplication works well enough, not so universally applicable though. We can chat about this when you like. :) |
…ctually make it work Squashed commit of the following: commit dc8d71c Author: Tomasz Drwięga <[email protected]> Date: Tue Dec 3 16:29:33 2019 +0100 Split the method to avoid confusing type error message. commit 0c4c037 Author: Tomasz Drwięga <[email protected]> Date: Tue Dec 3 16:19:55 2019 +0100 Make accounts optional, fix logic. commit d715f64 Author: Tomasz Drwięga <[email protected]> Date: Tue Dec 3 10:06:20 2019 +0100 Remove warning. commit 3f38218 Merge: f85b890 368318c Author: Tomasz Drwięga <[email protected]> Date: Tue Dec 3 07:08:05 2019 +0100 Merge branch 'master' into td-signed-transactions commit f85b890 Merge: f8c9540 d8d5da2 Author: Tomasz Drwięga <[email protected]> Date: Mon Dec 2 13:57:25 2019 +0100 Merge branch 'master' into td-signed-transactions commit f8c9540 Author: Tomasz Drwięga <[email protected]> Date: Mon Nov 25 17:34:52 2019 +0100 Forgotten import. commit a645b90 Author: Tomasz Drwięga <[email protected]> Date: Mon Nov 25 17:32:10 2019 +0100 Fix naming and bounds. commit bc28c60 Author: Tomasz Drwięga <[email protected]> Date: Mon Nov 25 17:01:05 2019 +0100 Add documentation to signed transactions and actually make them work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just took a look at all commits since my last review. LGTM!
#[repr(u8)] | ||
pub enum ReportEquivocationValidityError { | ||
/// The proof provided in the report is not valid. | ||
InvalidEquivocationProof = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These errors should be unique for the whole runtime.
Now, it could happen that they overlap and will be useless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where should they go then? Or do I just look for the next free u8
?
pallet-staking = { version = "2.0.0-dev", path = "../../../frame/staking" } | ||
pallet-authority-discovery = { version = "2.0.0-dev", path = "../../../frame/authority-discovery" } | ||
pallet-staking = { version = "2.0.0-dev", path = "../../../frame/staking" } | ||
pallet-grandpa = { version = "2.0.0-dev", path = "../../../frame/grandpa" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in dev-dependencies
, pallet-grandpa
just used in tests.
This PR adds equivocation reporting for GRANDPA. Equivocation detection is implemented in finality-grandpa crate and exposed through
Environment
hooks (prevote_equivocation
andprecommit_equivocation
).The GRANDPA runtime module is extended with a
report_equivocation
method that takes an equivocation proof and a session membership proof. This method validates the membership proof using an abstractKeyOwnerProofSystem
(historical session module currently) and the equivocation proof (different vote targets, valid signatures, etc.), if both are valid an offence is reported to an abstractReportOffence
type (offences module currently). Additionally, the methodsubmit_report_equivocation_extrinsic
creates and submits a signed transaction for reporting an equivocation.From the node-side, when we want to report an equivocation we need to create the session membership proof. In particular, the membership proof can only be created at a block when the given validator is part of the current session. We figure out the last block at which the current set id is active in a given chain by looking at previously signalled authority changes and create the membership proof at that block. We then call
submit_report_equivocation_extrinsic
at the best block.Important
In order to report an equivocation we need to send a signed transaction, therefore we need to have some key available for this, taking into account that this is also the account that will be potentially rewarded. I created a new app-specific crypto ("fish") that should be used for all equivocation reporting tasks (this will also be used for BABE later on). Any comments on this?
The current implementation for generating membership proofs requires having state available for the block on which the session where the equivocation happened was valid. This is not problematic right now since we require validators to run as archive. A future implementation could leverage offchain workers for generating full membership proof tries when a session ends and storing them locally.
TODO:
submit_report_equivocation_extrinsic
call (needs to be offchain context but it's not easy to use that now outside of actual offchain workers)()
to disable reporting, needed to integrate in node-template)polkadot companion: paritytech/polkadot#1000