mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 12:15:42 +00:00
Upgradeable validation functions (#918)
* upgrade primitives to allow changing validation function * set up storage schema for old parachains code * fix compilation errors * fix test compilation * add some tests for past code meta * most of the runtime logic for code upgrades * implement old-code pruning * add a couple tests * clean up remaining TODOs * add a whole bunch of tests for runtime functionality * remove unused function * fix runtime compilation * extract some primitives to parachain crate * add validation-code upgrades to validation params and result * extend validation params with code upgrade fields * provide maximums to validation params * port test-parachains * add a code-upgrader test-parachain and tests * fix collator tests * move test-parachains to own folder to work around compilation errors * fix test compilation * update the Cargo.lock * fix parachains tests * remove dbg! invocation * use new pool in code-upgrader * bump lockfile * link TODO to issue
This commit is contained in:
committed by
GitHub
parent
b31b52dddf
commit
10cec3b591
@@ -16,7 +16,9 @@
|
||||
|
||||
//! Utilities for writing parachain WASM.
|
||||
|
||||
use crate::UpwardMessage;
|
||||
#[cfg(any(feature = "std", all(not(feature = "std"), feature = "wasm-api")))]
|
||||
use crate::primitives::UpwardMessage;
|
||||
#[cfg(any(feature = "std", all(not(feature = "std"), feature = "wasm-api")))]
|
||||
use sp_runtime_interface::runtime_interface;
|
||||
#[cfg(feature = "std")]
|
||||
use sp_externalities::ExternalitiesExt;
|
||||
@@ -42,7 +44,9 @@ pub trait Parachain {
|
||||
/// Offset and length must have been provided by the validation
|
||||
/// function's entry point.
|
||||
#[cfg(not(feature = "std"))]
|
||||
pub unsafe fn load_params(params: *const u8, len: usize) -> crate::ValidationParams {
|
||||
pub unsafe fn load_params(params: *const u8, len: usize)
|
||||
-> crate::primitives::ValidationParams
|
||||
{
|
||||
let mut slice = sp_std::slice::from_raw_parts(params, len);
|
||||
|
||||
codec::Decode::decode(&mut slice).expect("Invalid input data")
|
||||
@@ -53,6 +57,6 @@ pub unsafe fn load_params(params: *const u8, len: usize) -> crate::ValidationPar
|
||||
/// As described in the crate docs, this is a pointer to the appended length
|
||||
/// of the vector.
|
||||
#[cfg(not(feature = "std"))]
|
||||
pub fn write_result(result: &crate::ValidationResult) -> u64 {
|
||||
pub fn write_result(result: &crate::primitives::ValidationResult) -> u64 {
|
||||
sp_core::to_substrate_wasm_fn_return_value(&result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user