mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 08:47:57 +00:00
WASM executor: add OutputExceedsBounds variant to Error (#13841)
* WASM executor: add `OutputExceedsBounds` variant to `Error` Previously this was a `WasmError`, which is intended for runtime construction errors. However this led to confusion as output-exceeds-bounds occurs due to execution of `validate_block`. * Fix warning
This commit is contained in:
@@ -22,7 +22,7 @@ mod linux;
|
||||
use assert_matches::assert_matches;
|
||||
use codec::{Decode, Encode};
|
||||
use sc_executor_common::{
|
||||
error::{Error, WasmError},
|
||||
error::Error,
|
||||
runtime_blob::RuntimeBlob,
|
||||
wasm_runtime::{HeapAllocStrategy, WasmModule},
|
||||
};
|
||||
@@ -819,9 +819,8 @@ fn return_huge_len(wasm_method: WasmExecutionMethod) {
|
||||
Error::Runtime => {
|
||||
assert_matches!(wasm_method, WasmExecutionMethod::Interpreted);
|
||||
},
|
||||
Error::RuntimeConstruction(WasmError::Other(error)) => {
|
||||
Error::OutputExceedsBounds => {
|
||||
assert_matches!(wasm_method, WasmExecutionMethod::Compiled { .. });
|
||||
assert_eq!(error, "output exceeds bounds of wasm memory");
|
||||
},
|
||||
error => panic!("unexpected error: {:?}", error),
|
||||
}
|
||||
@@ -849,9 +848,8 @@ fn return_max_memory_offset_plus_one(wasm_method: WasmExecutionMethod) {
|
||||
Error::Runtime => {
|
||||
assert_matches!(wasm_method, WasmExecutionMethod::Interpreted);
|
||||
},
|
||||
Error::RuntimeConstruction(WasmError::Other(error)) => {
|
||||
Error::OutputExceedsBounds => {
|
||||
assert_matches!(wasm_method, WasmExecutionMethod::Compiled { .. });
|
||||
assert_eq!(error, "output exceeds bounds of wasm memory");
|
||||
},
|
||||
error => panic!("unexpected error: {:?}", error),
|
||||
}
|
||||
@@ -866,9 +864,8 @@ fn return_overflow(wasm_method: WasmExecutionMethod) {
|
||||
Error::Runtime => {
|
||||
assert_matches!(wasm_method, WasmExecutionMethod::Interpreted);
|
||||
},
|
||||
Error::RuntimeConstruction(WasmError::Other(error)) => {
|
||||
Error::OutputExceedsBounds => {
|
||||
assert_matches!(wasm_method, WasmExecutionMethod::Compiled { .. });
|
||||
assert_eq!(error, "output exceeds bounds of wasm memory");
|
||||
},
|
||||
error => panic!("unexpected error: {:?}", error),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user