mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 10:47:55 +00:00
Run cargo fmt on the whole code base (#9394)
* Run cargo fmt on the whole code base * Second run * Add CI check * Fix compilation * More unnecessary braces * Handle weights * Use --all * Use correct attributes... * Fix UI tests * AHHHHHHHHH * 🤦 * Docs * Fix compilation * 🤷 * Please stop * 🤦 x 2 * More * make rustfmt.toml consistent with polkadot Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -16,9 +16,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::{TestExternalities, call_in_wasm};
|
||||
use crate::WasmExecutionMethod;
|
||||
use crate::test_wasm_execution;
|
||||
use super::{call_in_wasm, TestExternalities};
|
||||
use crate::{test_wasm_execution, WasmExecutionMethod};
|
||||
|
||||
use codec::Encode;
|
||||
|
||||
@@ -27,7 +26,8 @@ fn sandbox_should_work(wasm_method: WasmExecutionMethod) {
|
||||
let mut ext = TestExternalities::default();
|
||||
let mut ext = ext.ext();
|
||||
|
||||
let code = wat::parse_str(r#"
|
||||
let code = wat::parse_str(
|
||||
r#"
|
||||
(module
|
||||
(import "env" "assert" (func $assert (param i32)))
|
||||
(import "env" "inc_counter" (func $inc_counter (param i32) (result i32)))
|
||||
@@ -46,17 +46,12 @@ fn sandbox_should_work(wasm_method: WasmExecutionMethod) {
|
||||
call $assert
|
||||
)
|
||||
)
|
||||
"#).unwrap().encode();
|
||||
"#,
|
||||
)
|
||||
.unwrap()
|
||||
.encode();
|
||||
|
||||
assert_eq!(
|
||||
call_in_wasm(
|
||||
"test_sandbox",
|
||||
&code,
|
||||
wasm_method,
|
||||
&mut ext,
|
||||
).unwrap(),
|
||||
true.encode(),
|
||||
);
|
||||
assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext,).unwrap(), true.encode(),);
|
||||
}
|
||||
|
||||
test_wasm_execution!(sandbox_trap);
|
||||
@@ -64,7 +59,8 @@ fn sandbox_trap(wasm_method: WasmExecutionMethod) {
|
||||
let mut ext = TestExternalities::default();
|
||||
let mut ext = ext.ext();
|
||||
|
||||
let code = wat::parse_str(r#"
|
||||
let code = wat::parse_str(
|
||||
r#"
|
||||
(module
|
||||
(import "env" "assert" (func $assert (param i32)))
|
||||
(func (export "call")
|
||||
@@ -72,17 +68,11 @@ fn sandbox_trap(wasm_method: WasmExecutionMethod) {
|
||||
call $assert
|
||||
)
|
||||
)
|
||||
"#).unwrap();
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
call_in_wasm(
|
||||
"test_sandbox",
|
||||
&code,
|
||||
wasm_method,
|
||||
&mut ext,
|
||||
).unwrap(),
|
||||
vec![0],
|
||||
);
|
||||
assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext,).unwrap(), vec![0],);
|
||||
}
|
||||
|
||||
test_wasm_execution!(start_called);
|
||||
@@ -90,7 +80,8 @@ fn start_called(wasm_method: WasmExecutionMethod) {
|
||||
let mut ext = TestExternalities::default();
|
||||
let mut ext = ext.ext();
|
||||
|
||||
let code = wat::parse_str(r#"
|
||||
let code = wat::parse_str(
|
||||
r#"
|
||||
(module
|
||||
(import "env" "assert" (func $assert (param i32)))
|
||||
(import "env" "inc_counter" (func $inc_counter (param i32) (result i32)))
|
||||
@@ -115,17 +106,12 @@ fn start_called(wasm_method: WasmExecutionMethod) {
|
||||
call $assert
|
||||
)
|
||||
)
|
||||
"#).unwrap().encode();
|
||||
"#,
|
||||
)
|
||||
.unwrap()
|
||||
.encode();
|
||||
|
||||
assert_eq!(
|
||||
call_in_wasm(
|
||||
"test_sandbox",
|
||||
&code,
|
||||
wasm_method,
|
||||
&mut ext,
|
||||
).unwrap(),
|
||||
true.encode(),
|
||||
);
|
||||
assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext,).unwrap(), true.encode(),);
|
||||
}
|
||||
|
||||
test_wasm_execution!(invoke_args);
|
||||
@@ -133,7 +119,8 @@ fn invoke_args(wasm_method: WasmExecutionMethod) {
|
||||
let mut ext = TestExternalities::default();
|
||||
let mut ext = ext.ext();
|
||||
|
||||
let code = wat::parse_str(r#"
|
||||
let code = wat::parse_str(
|
||||
r#"
|
||||
(module
|
||||
(import "env" "assert" (func $assert (param i32)))
|
||||
|
||||
@@ -154,15 +141,13 @@ fn invoke_args(wasm_method: WasmExecutionMethod) {
|
||||
)
|
||||
)
|
||||
)
|
||||
"#).unwrap().encode();
|
||||
"#,
|
||||
)
|
||||
.unwrap()
|
||||
.encode();
|
||||
|
||||
assert_eq!(
|
||||
call_in_wasm(
|
||||
"test_sandbox_args",
|
||||
&code,
|
||||
wasm_method,
|
||||
&mut ext,
|
||||
).unwrap(),
|
||||
call_in_wasm("test_sandbox_args", &code, wasm_method, &mut ext,).unwrap(),
|
||||
true.encode(),
|
||||
);
|
||||
}
|
||||
@@ -172,7 +157,8 @@ fn return_val(wasm_method: WasmExecutionMethod) {
|
||||
let mut ext = TestExternalities::default();
|
||||
let mut ext = ext.ext();
|
||||
|
||||
let code = wat::parse_str(r#"
|
||||
let code = wat::parse_str(
|
||||
r#"
|
||||
(module
|
||||
(func (export "call") (param $x i32) (result i32)
|
||||
(i32.add
|
||||
@@ -181,15 +167,13 @@ fn return_val(wasm_method: WasmExecutionMethod) {
|
||||
)
|
||||
)
|
||||
)
|
||||
"#).unwrap().encode();
|
||||
"#,
|
||||
)
|
||||
.unwrap()
|
||||
.encode();
|
||||
|
||||
assert_eq!(
|
||||
call_in_wasm(
|
||||
"test_sandbox_return_val",
|
||||
&code,
|
||||
wasm_method,
|
||||
&mut ext,
|
||||
).unwrap(),
|
||||
call_in_wasm("test_sandbox_return_val", &code, wasm_method, &mut ext,).unwrap(),
|
||||
true.encode(),
|
||||
);
|
||||
}
|
||||
@@ -199,22 +183,21 @@ fn unlinkable_module(wasm_method: WasmExecutionMethod) {
|
||||
let mut ext = TestExternalities::default();
|
||||
let mut ext = ext.ext();
|
||||
|
||||
let code = wat::parse_str(r#"
|
||||
let code = wat::parse_str(
|
||||
r#"
|
||||
(module
|
||||
(import "env" "non-existent" (func))
|
||||
|
||||
(func (export "call")
|
||||
)
|
||||
)
|
||||
"#).unwrap().encode();
|
||||
"#,
|
||||
)
|
||||
.unwrap()
|
||||
.encode();
|
||||
|
||||
assert_eq!(
|
||||
call_in_wasm(
|
||||
"test_sandbox_instantiate",
|
||||
&code,
|
||||
wasm_method,
|
||||
&mut ext,
|
||||
).unwrap(),
|
||||
call_in_wasm("test_sandbox_instantiate", &code, wasm_method, &mut ext,).unwrap(),
|
||||
1u8.encode(),
|
||||
);
|
||||
}
|
||||
@@ -228,12 +211,7 @@ fn corrupted_module(wasm_method: WasmExecutionMethod) {
|
||||
let code = vec![0u8, 0, 0, 0, 1, 0, 0, 0].encode();
|
||||
|
||||
assert_eq!(
|
||||
call_in_wasm(
|
||||
"test_sandbox_instantiate",
|
||||
&code,
|
||||
wasm_method,
|
||||
&mut ext,
|
||||
).unwrap(),
|
||||
call_in_wasm("test_sandbox_instantiate", &code, wasm_method, &mut ext,).unwrap(),
|
||||
1u8.encode(),
|
||||
);
|
||||
}
|
||||
@@ -243,7 +221,8 @@ fn start_fn_ok(wasm_method: WasmExecutionMethod) {
|
||||
let mut ext = TestExternalities::default();
|
||||
let mut ext = ext.ext();
|
||||
|
||||
let code = wat::parse_str(r#"
|
||||
let code = wat::parse_str(
|
||||
r#"
|
||||
(module
|
||||
(func (export "call")
|
||||
)
|
||||
@@ -253,15 +232,13 @@ fn start_fn_ok(wasm_method: WasmExecutionMethod) {
|
||||
|
||||
(start $start)
|
||||
)
|
||||
"#).unwrap().encode();
|
||||
"#,
|
||||
)
|
||||
.unwrap()
|
||||
.encode();
|
||||
|
||||
assert_eq!(
|
||||
call_in_wasm(
|
||||
"test_sandbox_instantiate",
|
||||
&code,
|
||||
wasm_method,
|
||||
&mut ext,
|
||||
).unwrap(),
|
||||
call_in_wasm("test_sandbox_instantiate", &code, wasm_method, &mut ext,).unwrap(),
|
||||
0u8.encode(),
|
||||
);
|
||||
}
|
||||
@@ -271,7 +248,8 @@ fn start_fn_traps(wasm_method: WasmExecutionMethod) {
|
||||
let mut ext = TestExternalities::default();
|
||||
let mut ext = ext.ext();
|
||||
|
||||
let code = wat::parse_str(r#"
|
||||
let code = wat::parse_str(
|
||||
r#"
|
||||
(module
|
||||
(func (export "call")
|
||||
)
|
||||
@@ -282,15 +260,13 @@ fn start_fn_traps(wasm_method: WasmExecutionMethod) {
|
||||
|
||||
(start $start)
|
||||
)
|
||||
"#).unwrap().encode();
|
||||
"#,
|
||||
)
|
||||
.unwrap()
|
||||
.encode();
|
||||
|
||||
assert_eq!(
|
||||
call_in_wasm(
|
||||
"test_sandbox_instantiate",
|
||||
&code,
|
||||
wasm_method,
|
||||
&mut ext,
|
||||
).unwrap(),
|
||||
call_in_wasm("test_sandbox_instantiate", &code, wasm_method, &mut ext,).unwrap(),
|
||||
2u8.encode(),
|
||||
);
|
||||
}
|
||||
@@ -300,19 +276,18 @@ fn get_global_val_works(wasm_method: WasmExecutionMethod) {
|
||||
let mut ext = TestExternalities::default();
|
||||
let mut ext = ext.ext();
|
||||
|
||||
let code = wat::parse_str(r#"
|
||||
let code = wat::parse_str(
|
||||
r#"
|
||||
(module
|
||||
(global (export "test_global") i64 (i64.const 500))
|
||||
)
|
||||
"#).unwrap().encode();
|
||||
"#,
|
||||
)
|
||||
.unwrap()
|
||||
.encode();
|
||||
|
||||
assert_eq!(
|
||||
call_in_wasm(
|
||||
"test_sandbox_get_global_val",
|
||||
&code,
|
||||
wasm_method,
|
||||
&mut ext,
|
||||
).unwrap(),
|
||||
call_in_wasm("test_sandbox_get_global_val", &code, wasm_method, &mut ext,).unwrap(),
|
||||
500i64.encode(),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user