mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 13:07:56 +00:00
Fix error handling in sandboxing/contracts modules (#744)
* Fix error handling in sandboxing/contracts modules * Add some docs. * Add some tests. * grammar
This commit is contained in:
committed by
Gav Wood
parent
400a22ebe5
commit
488830e81a
@@ -81,6 +81,16 @@ impl_stubs!(
|
||||
);
|
||||
let ok = if let Ok(sandbox::ReturnValue::Value(sandbox::TypedValue::I32(0x1337))) = result { true } else { false };
|
||||
[ok as u8].to_vec()
|
||||
},
|
||||
test_sandbox_instantiate NO_DECODE => |code: &[u8]| {
|
||||
let env_builder = sandbox::EnvironmentDefinitionBuilder::new();
|
||||
let code = match sandbox::Instance::new(code, &env_builder, &mut ()) {
|
||||
Ok(_) => 0,
|
||||
Err(sandbox::Error::Module) => 1,
|
||||
Err(sandbox::Error::Execution) => 2,
|
||||
Err(sandbox::Error::OutOfBounds) => 3,
|
||||
};
|
||||
[code].to_vec()
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user