Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Introduce code_substitute #8898

Merged
1 commit merged into from
May 25, 2021
Merged

Introduce code_substitute #8898

1 commit merged into from
May 25, 2021

Conversation

bkchr
Copy link
Member

@bkchr bkchr commented May 24, 2021

This introduces a new field code_substitute into the chain spec. This
can be used to substitute the on-chain wasm starting from a given block
until there is another wasm on chain (determined through the
spec_version). This can be used to fix broken on chain wasm runtimes.

polkadot companion: paritytech/polkadot#3093

This introduces a new field `code_substitute` into the chain spec. This
can be used to substitute the on-chain wasm starting from a given block
until there is another wasm on chain (determined through the
`spec_version`). This can be used to fix broken on chain wasm runtimes.
@bkchr bkchr added A0-please_review Pull request needs code review. B5-clientnoteworthy D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels May 24, 2021
/// The given `wasm_code` will be used to substitute the on-chain wasm code from the given
/// block hash onwards.
#[serde(default)]
code_substitutes: HashMap<String, Bytes>,
Copy link
Member Author

Choose a reason for hiding this comment

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

In a future pr I would like to replace String with something that directly checks that we got here some hex value.

@gavofyork
Copy link
Member

gavofyork commented May 24, 2021

would be better if this were a simple code_hash -> alt_code_blob mapping. block number is easy to get wrong.

@bkchr
Copy link
Member Author

bkchr commented May 24, 2021

This is using block hashes?

Copy link
Contributor

@andresilva andresilva left a comment

Choose a reason for hiding this comment

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

Changes LGTM, but let's hold off on merging until we decide whether we use block hashes or code hash to do the replacement.

Copy link
Contributor

@rphmeier rphmeier left a comment

Choose a reason for hiding this comment

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

Seems fine, but due to use of block hash any repeat of the same consensus issue would require another override in the chain spec.

@andresilva
Copy link
Contributor

bot merge

@ghost
Copy link

ghost commented May 25, 2021

Trying merge.

@ghost ghost merged commit 85fa0ab into master May 25, 2021
@ghost ghost deleted the bkchr-wasm-substitute branch May 25, 2021 14:07
Comment on lines +194 to +195
/// Map of WASM runtime substitute starting at the child of the given block until the runtime
/// version doesn't match anymore.
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be good to point out that the wasm_runtime_overrides trumps the wasm_runtime_substitutes?

nazar-pc pushed a commit to autonomys/substrate that referenced this pull request Aug 8, 2021
This introduces a new field `code_substitute` into the chain spec. This
can be used to substitute the on-chain wasm starting from a given block
until there is another wasm on chain (determined through the
`spec_version`). This can be used to fix broken on chain wasm runtimes.
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants