From 9ceb5491606543f37d2ef8ee4763484f0d86b163 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 3 May 2024 11:14:12 +0200 Subject: [PATCH] Undo --- substrate/frame/contracts/README.md | 13 ------------- substrate/frame/contracts/src/benchmarking/mod.rs | 10 +++++----- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/substrate/frame/contracts/README.md b/substrate/frame/contracts/README.md index 09dc770300ca..2e70b5c5008b 100644 --- a/substrate/frame/contracts/README.md +++ b/substrate/frame/contracts/README.md @@ -34,19 +34,6 @@ calls are reverted. Assuming correct error handling by contract A, A's other cal One `ref_time` `Weight` is defined as one picosecond of execution time on the runtime's reference machine. -#### Schedule - -The `Schedule` is where, among other things, the cost of every action a contract can do is defined. These costs are derived -from the benchmarks of this pallet. Instead of looking at the raw benchmark results it is advised to look at the `Schedule` -if one wants to manually inspect the performance characteristics. The `Schedule` can be printed like this: - -```sh -RUST_LOG=runtime::contracts=info cargo run --features runtime-benchmarks --bin substrate-node -- benchmark pallet --extra -p pallet_contracts -e print_schedule -``` - -Please note that the `Schedule` will be printed multiple times. This is because we are (ab)using a benchmark to print -the struct. - ### Revert Behaviour Contract call failures are not cascading. When failures occur in a sub-call, they do not "bubble up", and the call will diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index 3ef98e9fec3a..fc94cf3285df 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -906,7 +906,7 @@ mod benchmarks { let result; #[block] { - result = BenchEnv::seal1_terminate(&mut runtime, &mut memory, 0) + result = BenchEnv::seal1_terminate(&mut runtime, &mut memory, 0); } assert!(matches!(result, Err(crate::wasm::TrapReason::Termination))); @@ -941,7 +941,7 @@ mod benchmarks { subject_len, // subject_len subject_len + 4, // output_ptr 0, // output_len_ptr - ) + ); } assert_ok!(result); @@ -975,7 +975,7 @@ mod benchmarks { topics_len, // topics_len 4 + topics_len, // data_ptr 0, // data_len - ) + ); } assert_ok!(result); @@ -1574,7 +1574,7 @@ mod benchmarks { result = BenchEnv::seal0_reentrance_count(&mut runtime, &mut memory) } - assert!(result.unwrap() == 0); + assert_eq!(result.unwrap(), 0); } #[benchmark(pov_mode = Measured)] @@ -1589,7 +1589,7 @@ mod benchmarks { result = BenchEnv::seal0_account_reentrance_count(&mut runtime, &mut memory, 0); } - assert!(result.unwrap() == 0); + assert_eq!(result.unwrap(), 0); } #[benchmark(pov_mode = Measured)]