runtime-api: add validation_code_hash API (#4629)

This is the first step to close
https://github.com/paritytech/polkadot/issues/4524
This commit is contained in:
Sergei Shulepov
2021-12-28 21:16:03 +01:00
committed by GitHub
parent b49291dc76
commit 91aff5d341
13 changed files with 153 additions and 0 deletions
@@ -160,6 +160,9 @@ where
PvfsRequirePrecheck(relay_parent, pvfs) =>
self.requests_cache.cache_pvfs_require_precheck(relay_parent, pvfs),
SubmitPvfCheckStatement(_, _, _, ()) => {},
ValidationCodeHash(relay_parent, para_id, assumption, hash) => self
.requests_cache
.cache_validation_code_hash((relay_parent, para_id, assumption), hash),
}
}
@@ -249,6 +252,9 @@ where
// This request is side-effecting and thus cannot be cached.
Some(request)
},
Request::ValidationCodeHash(para, assumption, sender) =>
query!(validation_code_hash(para, assumption), sender)
.map(|sender| Request::ValidationCodeHash(para, assumption, sender)),
}
}
@@ -486,6 +492,8 @@ where
Request::PvfsRequirePrecheck(sender) => {
query!(PvfsRequirePrecheck, pvfs_require_precheck(), ver = 2, sender)
},
Request::ValidationCodeHash(para, assumption, sender) =>
query!(ValidationCodeHash, validation_code_hash(para, assumption), ver = 2, sender),
}
}