Don't pack Substrate ctor module

This commit is contained in:
holygits 2019-01-24 10:18:18 +13:00
parent c47adc1bd4
commit 4f81bbc506
2 changed files with 12 additions and 12 deletions

View File

@ -102,17 +102,21 @@ pub fn build(
)?;
}
if has_ctor(&ctor_module, target_runtime) {
if !skip_optimization {
optimize(&mut ctor_module, vec![target_runtime.symbols().create])?;
}
let ctor_module = pack_instance(
if !has_ctor(&ctor_module, target_runtime) {
return Ok((module, None))
}
if !skip_optimization {
optimize(&mut ctor_module, vec![target_runtime.symbols().create])?;
}
if let TargetRuntime::PWasm(_) = target_runtime {
ctor_module = pack_instance(
parity_wasm::serialize(module.clone()).map_err(Error::Encoding)?,
ctor_module.clone(),
target_runtime,
)?;
Ok((module, Some(ctor_module)))
} else {
Ok((module, None))
}
Ok((module, Some(ctor_module)))
}

View File

@ -195,10 +195,6 @@ pub fn pack_instance(raw_module: Vec<u8>, mut ctor_module: elements::Module, tar
])).build()
.build()
.build();
if let TargetRuntime::Substrate(_) = target {
return Ok(new_module)
}
for section in new_module.sections_mut() {
if let &mut Section::Export(ref mut export_section) = section {