Commit ca74ef1f authored by Jay Butera's avatar Jay Butera Committed by Hero Bird

[core] Constrain invoke_runtime parameter (#302)

* Constrain invoke_runtime parameter

* Change param to a reference

* Dangling type param
parent 8bcf3813
Pipeline #73397 passed with stages
in 26 minutes and 9 seconds
......@@ -349,10 +349,9 @@ where
ext::deposit_event(topics, data);
}
fn invoke_runtime<O, V>(buffer: &mut O, call_data: &V)
fn invoke_runtime<O>(buffer: &mut O, call_data: &<Self as EnvTypes>::Call)
where
O: scale::Output + AsRef<[u8]> + Reset,
V: scale::Encode,
{
buffer.reset();
call_data.encode_to(buffer);
......
......@@ -65,6 +65,7 @@ use crate::{
},
storage::Key,
};
use scale::Encode;
thread_local! {
/// The single thread-local test environment instance.
......@@ -420,10 +421,9 @@ where
})
}
fn invoke_runtime<O, V>(_buffer: &mut O, call_data: &V)
fn invoke_runtime<O>(_buffer: &mut O, call_data: &<Self as EnvTypes>::Call)
where
O: scale::Output + AsRef<[u8]> + Reset,
V: scale::Encode,
{
// With the off-chain test environment we have no means
// to emit an event on the chain since there is no chain.
......
......@@ -147,10 +147,9 @@ pub trait Env:
Event: Topics<Self> + scale::Encode;
/// Invokes a runtime dispatchable function with the given call data.
fn invoke_runtime<O, V>(buffer: &mut O, call_data: &V)
fn invoke_runtime<O>(buffer: &mut O, call_data: &<Self as EnvTypes>::Call)
where
O: scale::Output + AsRef<[u8]> + Reset,
V: scale::Encode;
O: scale::Output + AsRef<[u8]> + Reset;
/// Restores the contract to the given address.
///
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment