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

Improve code-substitutes for light clients #10589

Closed
bkchr opened this issue Jan 5, 2022 · 0 comments · Fixed by #10600
Closed

Improve code-substitutes for light clients #10589

bkchr opened this issue Jan 5, 2022 · 0 comments · Fixed by #10600
Assignees
Labels
I7-refactor Code needs refactoring.

Comments

@bkchr
Copy link
Member

bkchr commented Jan 5, 2022

code-substitutes can be found in the chain spec. They are used to substitute the on chain wasm code with a different wasm blob. This is useful for when there was a bug in the on chain wasm file and it can not be fixed with an upgrade because the chain stopped or for other reasons. The format is the following in the chain spec:

block_hash => code_blob

While this works for full nodes, as they know all block hashes, a light clients are "warping" to the tip of the chain. This means they will not see all blocks, because that isn't important for them. However, they may need to execute the substituted wasm at some point while warp-syncing. Currently that is not really possible, because they don't know the height of a block hash. So, the idea is to replace the block_hash with a block_number. It is not really that important that we use a block hash there, the block number will bring the same result and it will be much easier for light clients.

@bkchr bkchr added the I7-refactor Code needs refactoring. label Jan 5, 2022
@bkchr bkchr self-assigned this Jan 6, 2022
bkchr added a commit that referenced this issue Jan 6, 2022
This will make it easier for light clients to work with the code-substitute.

For more information on this see: #10589

Closes: #10589
bkchr added a commit that referenced this issue Jan 9, 2022
* code-substitute: Switch from `block_hash` to `block_number`

This will make it easier for light clients to work with the code-substitute.

For more information on this see: #10589

Closes: #10589

* FMT

* Update client/service/src/client/wasm_substitutes.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Update client/service/src/builder.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
grishasobol pushed a commit to gear-tech/substrate that referenced this issue Mar 28, 2022
…ch#10600)

* code-substitute: Switch from `block_hash` to `block_number`

This will make it easier for light clients to work with the code-substitute.

For more information on this see: paritytech#10589

Closes: paritytech#10589

* FMT

* Update client/service/src/client/wasm_substitutes.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Update client/service/src/builder.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
ark0f pushed a commit to gear-tech/substrate that referenced this issue Feb 27, 2023
…ch#10600)

* code-substitute: Switch from `block_hash` to `block_number`

This will make it easier for light clients to work with the code-substitute.

For more information on this see: paritytech#10589

Closes: paritytech#10589

* FMT

* Update client/service/src/client/wasm_substitutes.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Update client/service/src/builder.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I7-refactor Code needs refactoring.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant