use parity_wasm::{builder, elements::Module};
use casper_types::contracts::DEFAULT_ENTRY_POINT_NAME;
use crate::shared::wasm_prep::{PreprocessingError, Preprocessor};
pub fn do_nothing_bytes() -> Vec<u8> {
let module = builder::module()
.function()
.signature()
.build()
.body()
.build()
.build()
.export()
.field(DEFAULT_ENTRY_POINT_NAME)
.build()
.memory()
.build()
.build();
parity_wasm::serialize(module).expect("should serialize")
}
pub fn do_nothing_module(preprocessor: &Preprocessor) -> Result<Module, PreprocessingError> {
let do_nothing_bytes = do_nothing_bytes();
preprocessor.preprocess(&do_nothing_bytes)
}