Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A more comprehensive model for PoV-Blocks and Candidate receipts #843

Merged
merged 38 commits into from Feb 25, 2020

Conversation

@rphmeier
Copy link
Member

rphmeier commented Feb 14, 2020

In order to validate a parachain block in Polkadot, 3 things are needed:

  • The block's head-data
  • A PoVBlock: The BlockData, witness data proving the state transition of the block.
  • Various pieces of temporal relay-chain state: fee schedules, previous parachain head-data, etc.

The main thing that this PR changes is that the temporal relay-chain state is duplicated and included in a CandidateReceipt, so that re-validation of the candidate can be done without requiring access to the old relay-chain state. This will allow state-pruning nodes to effectively fish against old blocks.

However, since the CandidateReceipts are all duplicating relay-chain state, it doesn't make sense to include that when we submit CandidateReceipts to the chain. So we introduce an AbridgedCandidateReceipt type which omits that data. The relay-chain can generate the omitted data, and reconstruct the full CandidateReceipts. In fact, AbridgedCandidateReceipts are what is sent over the network. The AbridgedCandidateReceipt and CandidateReceipt have also gained a relay_parent field, which is the hash of the relay-chain block in whose context they should be executed. Given that execution state is derived from the relay_parent hash, the AbridgedCandidateReceipt's own hash fully and uniquely describes the parachain block and its expected execution parameters.

This also requires some small changes to availability - AbridgedCandidateReceipts are available from the blockchain. But the omitted data needs to be kept available as well. So another change that this PR makes is for the availability store to keep it available alongside the PoVBlock in an AvailableData struct. The erasure-coding is computed over AvailableData.

When we move into XCMP implementation, the duplicated relay-chain state will begin to include message-passing fees and data about which channels are currently open. The AvailableData will be extended to include the outgoing messages of the parachain.

@rphmeier rphmeier marked this pull request as ready for review Feb 19, 2020
@rphmeier rphmeier requested a review from bkchr Feb 19, 2020
@rphmeier

This comment has been minimized.

Copy link
Member Author

rphmeier commented Feb 19, 2020

cc @bkchr This will require some changes in Cumulus, but hopefully not too much.

rphmeier added 3 commits Feb 19, 2020
Copy link
Member

montekki left a comment

Other than these nits: the changes to availability-store look ok.

network/src/legacy/mod.rs Show resolved Hide resolved
network/src/protocol.rs Outdated Show resolved Hide resolved
primitives/src/parachain.rs Show resolved Hide resolved
@rphmeier

This comment has been minimized.

Copy link
Member Author

rphmeier commented Feb 24, 2020

Grumbles should be addressed @montekki

@bkchr
bkchr approved these changes Feb 25, 2020
Copy link
Contributor

bkchr left a comment

Looks good as far as I can tell.

availability-store/src/store.rs Show resolved Hide resolved
availability-store/src/store.rs Show resolved Hide resolved
availability-store/src/store.rs Outdated Show resolved Hide resolved
collator/src/lib.rs Show resolved Hide resolved
validation/src/pipeline.rs Outdated Show resolved Hide resolved
rphmeier added 2 commits Feb 25, 2020
@rphmeier rphmeier merged commit b94febb into master Feb 25, 2020
5 checks passed
5 checks passed
ci/gitlab/843 Pipeline passed on GitLab
Details
continuous-integration/gitlab-check-line-width Build stage: test; status: success
Details
continuous-integration/gitlab-check-runtime Build stage: test; status: success
Details
continuous-integration/gitlab-check-web-wasm Build stage: test; status: success
Details
continuous-integration/gitlab-test-linux-stable Build stage: test; status: success
Details
@rphmeier rphmeier deleted the rh-comprehensive-pov branch Feb 25, 2020
General-Beck added a commit to General-Beck/polkadot that referenced this pull request Mar 19, 2020
…itytech#843)

* encode the candidate statement as only the hash

* refactor CandidateReceipt and CollationInfo

* introduce an abridged candidate receipt type

* erasure coding stores candidate receipt

* store omitted data instead and introduce AvailableData type

* refactor availability-store schema

* tweak schema and APIs a bit more

* get availability-store tests passing

* accept AbridgedCandidateReceipt in `set_heads`

* change statement type in primitives to be hash-only

* fix parachains runtime tests

* fix bad merge

* rewrite validation pipeline

* remove evaluation module

* use abridged candidate hash as canonical

* statement table uses abridged candidate receipts

* kill availability_store::Data struct

* port shared table to new validation pipelines

* extract full validation pipeline to helper

* remove old validation pipeline from collation module

* polkadot-validation compiles

* polkadot-validation tests compile

* make local collation available in validation service

* port legacy network code

* polkadot-network fully ported

* network: ensure fresh statement is propagated

* remove pov_block_hash from LocalValidationData

* remove candidate_hash field from AttestedCandidate and update runtime

* port runtimes to new ParachainHost definition

* port over polkadot-collator

* fix test compilation

* better fix

* remove unrelated validation work dispatch fix

* address grumbles

* fix equality check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.