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

Explicit versioning of PVF execution environment #917

Open
pepyakin opened this issue Nov 3, 2021 · 4 comments · Fixed by paritytech/polkadot#6161
Open

Explicit versioning of PVF execution environment #917

pepyakin opened this issue Nov 3, 2021 · 4 comments · Fixed by paritytech/polkadot#6161
Assignees

Comments

@pepyakin
Copy link
Contributor

pepyakin commented Nov 3, 2021

Currently, there is no explicit versioning of the PVF execution environment.

The execution environment (EE) includes (non-exhaustive probably):

  • the set of available host functions for the PVF during execution, as well as their behavior.
  • the shape of the ValidationParams and ValidationOutputs.
  • the validity constraints on those, including time constraints
  • the set of available features for wasm. (i.e. extensions like multi-value, multiple memories, simd, etc).

As soon as we release a new version of node with a different EE we will have a window of time, where there is previous and last version of EE is available at the same time. In case there is a candidate that is valid on newer version of EE and invalid on the previous version, it can lead to disputes.

One potential way to avoid that is to introduce explicit versioning of EE. A version of an EE is an integer. This integer is stored on-chain and can be retrieved via runtime API. To simplify matters, we can put this version into the HostConfiguration which would tie changing this version to session boundaries: all candidates produced within the session will have to be validated with EE of the same version.

Whenever the node version with newer EE has been deployed widely, we can bump the EE version on chain. Validators that do not support the new EE version should abstain in backing, approvals and pre-checking. In that case, they will not receive rewards which should incentivise them to update ASAP.

@rphmeier
Copy link
Contributor

rphmeier commented Nov 3, 2021

Yeah, that's a good idea! The candidate receipt should commit to the EE somehow - PersistedValidationData? If you're a node in session N and you have a candidate to execute from N-K, you'd want a way to check which EE to use

@pepyakin
Copy link
Contributor Author

Yes, that's one way to do this.

However, PersistedValidationData is primarily used as input to a PVF. Also, PersistedValidationData is unique for each relay-parent1. It is also stored in the availability data. On the other hand, the execution environment data2 stays the same within the session and is shared between parachain.

That observation made me wonder if storing the execution environment SessionInfo is a good idea. This way, the execution environment data does not clutter the availability data and is stored only once on-chain. That is a generally valuable construction that allows us to create a side table with relevant information for the historical candidate validation.

To pull this off, the runtime API that provides the execution environment parametrization needs to know the session index to extract the configuration. An obvious way to solve this problem is to stash the session index at which the candidate was included in the candidate receipt. The candidate receipt already stores the relay parent, so maybe it is already possible to extract the session index?

Footnotes

  1. One thing that stands out in PersistedValidationData is max_pov_size. It is only changed with the configuration, thus each session boundary. Maybe a candidate to pull it out? Although cumulus might be using this field.

  2. A little aside: I figured the execution environment should be more expressive than just a version number. That has to do with the fact that we have several networks. We may have different parameter changes for various features, similar to a schedule in parity-ethereum. Those features can graduate throughout the networks at a different pace. In other words, we cannot say that e.g., Kusama will have a less version number than rococo.

@s0me0ne-unkn0wn
Copy link
Contributor

It's not the time to close it yet, botty. We've got parametrization but not versioning yet.

@Polkadot-Forum
Copy link

This issue has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/ux-implications-of-pvf-executor-environment-versioning/2519/1

@Sophia-Gold Sophia-Gold transferred this issue from paritytech/polkadot Aug 24, 2023
@the-right-joyce the-right-joyce moved this to In Progress in parachains team board Oct 18, 2023
claravanstaden pushed a commit to Snowfork/polkadot-sdk that referenced this issue Dec 8, 2023
* Add create_channel & some refactor

* Fix test

* Not allow origin as relaychain?

* handle error

* Fix breaking tests

* Create/Update channel & Disable inbound channel

* Revamp tests remove the relaychain case

* Update weight with cumulus

* Revert "Create/Update channel & Disable inbound channel"

* Add smoke tests for xcm based control extrinsic

* Scripts and tests for set_operation_mode

* Use template node for xcm tests

* Update cumulus

* Revamp test with customize xcm call

* Add constraint only allow origin from Parachain

* Fix lint error

* Some polish

* Update parachain/pallets/control/src/lib.rs

Co-authored-by: Vincent Geddes <vincent@snowfork.com>

* Some improvement

* Explicit only allow ParaId as origin for all extrinsic

* Update cumulus(ControlOrigin allow from sibling only)

* Revert "Explicit only allow ParaId as origin for all extrinsic"

---------

Co-authored-by: Vincent Geddes <vincent@snowfork.com>
helin6 pushed a commit to boolnetwork/polkadot-sdk that referenced this issue Feb 5, 2024
* fix mapping-sync sync_genesis_block

* fix lint

* use legacy current_block before api version v2

* empty commit
bkchr pushed a commit that referenced this issue Apr 10, 2024
* Add properties to chainspec.

* Update bin/millau/node/src/chain_spec.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

4 participants