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

Fix wasm module reuse #2051

@tomusdrw

Description

@tomusdrw

CC: @pepyakin

Seems that the original cause for #2022 is somewhere in wasm module re-use.

diff --git a/core/executor/src/native_executor.rs b/core/executor/src/native_executor.rs
index 0944cbdb..f0793af3 100644
--- a/core/executor/src/native_executor.rs
+++ b/core/executor/src/native_executor.rs
@@ -58,6 +58,7 @@ fn fetch_cached_runtime_version<'a, E: Externalities<Blake2Hasher>>(
                Some(code_hash) => code_hash,
                None => return Err(ErrorKind::InvalidCode(vec![]).into()),
        };
+       cache.borrow_mut().remove(&code_hash[..]);
        let maybe_runtime_preproc = cache.borrow_mut().entry(code_hash.into())
                .or_insert_with(|| {
                        let code = match ext.storage(well_known_keys::CODE) {

This change causes the issue to disappear.

See branch https://github.com/paritytech/substrate/tree/td-debugging it's forked off from the #1800 that introduced spin::Once, but contains all the fixes that allow to reproduce currently using deployed version of https://polkadot.js.org/apps

Note that last commit is the patch above, so revert if you want to reproduce the issue:

  1. Send one transaction from any account
  2. Send 1-2 more transactions form the same account, they will fail with InvalidTransaction

Metadata

Metadata

Assignees

Labels

I3-bugThe node fails to follow expected behavior.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions