mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
Introduce original_storage and original_storage_hash (#2211)
Both functions will ignore any overlayed changes and access the backend directly.
This commit is contained in:
@@ -54,13 +54,13 @@ fn fetch_cached_runtime_version<'a, E: Externalities<Blake2Hasher>>(
|
||||
default_heap_pages: Option<u64>,
|
||||
) -> Result<(&'a WasmModuleInstanceRef, &'a Option<RuntimeVersion>)> {
|
||||
|
||||
let code_hash = match ext.storage_hash(well_known_keys::CODE) {
|
||||
let code_hash = match ext.original_storage_hash(well_known_keys::CODE) {
|
||||
Some(code_hash) => code_hash,
|
||||
None => return Err(ErrorKind::InvalidCode(vec![]).into()),
|
||||
};
|
||||
let maybe_runtime_preproc = cache.borrow_mut().entry(code_hash.into())
|
||||
.or_insert_with(|| {
|
||||
let code = match ext.storage(well_known_keys::CODE) {
|
||||
let code = match ext.original_storage(well_known_keys::CODE) {
|
||||
Some(code) => code,
|
||||
None => return RuntimePreproc::InvalidCode,
|
||||
};
|
||||
@@ -86,7 +86,7 @@ fn fetch_cached_runtime_version<'a, E: Externalities<Blake2Hasher>>(
|
||||
});
|
||||
match maybe_runtime_preproc {
|
||||
RuntimePreproc::InvalidCode => {
|
||||
let code = ext.storage(well_known_keys::CODE).unwrap_or(vec![]);
|
||||
let code = ext.original_storage(well_known_keys::CODE).unwrap_or(vec![]);
|
||||
Err(ErrorKind::InvalidCode(code).into())
|
||||
},
|
||||
RuntimePreproc::ValidCode(m, v) => {
|
||||
|
||||
Reference in New Issue
Block a user