Skip to content

Commit

Permalink
chore(runtime): update weights (#3876)
Browse files Browse the repository at this point in the history
Co-authored-by: StackOverflowExcept1on <[email protected]>
Co-authored-by: Dmitrii Novikov <[email protected]>
  • Loading branch information
3 people authored Apr 15, 2024
1 parent 0ed4c5a commit d9cfd99
Show file tree
Hide file tree
Showing 13 changed files with 3,704 additions and 3,491 deletions.
377 changes: 181 additions & 196 deletions pallets/gear-builtin/src/weights.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pallets/gear/src/benchmarking/tests/syscalls_integrity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1031,8 +1031,8 @@ where
run_tester::<T, _, _, T::AccountId>(|_, _| {
// Expected to burn not more than 750_000_000
// Provided gas in the test by default is 50_000_000_000
let lower = 50_000_000_000 - 1_000_000_000;
let upper = 50_000_000_000 - 200_000_000;
let lower = 50_000_000_000 - 750_000_000;
let upper = 50_000_000_000 - 150_000_000;
let mp = vec![Kind::GasAvailable(lower, upper)].encode().into();

(TestCall::send_message(mp), None::<DefaultPostCheck>)
Expand Down
10 changes: 5 additions & 5 deletions pallets/gear/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn calculate_reply_for_handle_works() {

// Out of gas panic case.
let res =
Gear::calculate_reply_for_handle(USER_1, ping_pong, b"PING".to_vec(), 1_000_000_000, 0)
Gear::calculate_reply_for_handle(USER_1, ping_pong, b"PING".to_vec(), 333_333_333, 0)
.expect("Failed to query reply");

assert_eq!(
Expand Down Expand Up @@ -6650,7 +6650,7 @@ fn test_create_program_simple() {
RuntimeOrigin::signed(USER_1),
factory_id,
CreateProgram::Custom(
vec![(child_code_hash, b"some_data".to_vec(), 300_000)] // too little gas
vec![(child_code_hash, b"some_data".to_vec(), 150_000)] // too little gas
)
.encode(),
10_000_000_000,
Expand Down Expand Up @@ -6686,8 +6686,8 @@ fn test_create_program_simple() {
RuntimeOrigin::signed(USER_1),
factory_id,
CreateProgram::Custom(vec![
(child_code_hash, b"salt3".to_vec(), 300_000), // too little gas
(child_code_hash, b"salt4".to_vec(), 300_000), // too little gas
(child_code_hash, b"salt3".to_vec(), 150_000), // too little gas
(child_code_hash, b"salt4".to_vec(), 150_000), // too little gas
])
.encode(),
50_000_000_000,
Expand Down Expand Up @@ -6985,7 +6985,7 @@ fn test_create_program_miscellaneous() {
CreateProgram::Custom(vec![
// init fail (not enough gas) and reply generated (+2 dequeued, +1 dispatched),
// handle message is processed, but not executed, reply generated (+2 dequeued, +1 dispatched)
(child2_code_hash, b"salt1".to_vec(), 300_000),
(child2_code_hash, b"salt1".to_vec(), 150_000),
// one successful init with one handle message (+2 dequeued, +1 dispatched, +1 successful init)
(child2_code_hash, b"salt2".to_vec(), 200_000_000),
])
Expand Down
2,926 changes: 1,465 additions & 1,461 deletions pallets/gear/src/weights.rs

Large diffs are not rendered by default.

108 changes: 54 additions & 54 deletions runtime/vara/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn instruction_weights_heuristics_test() {
br: 3_300,
br_if: 6_000,
br_table: 10_900,
br_table_per_entry: 300,
br_table_per_entry: 100,

call: 4_900,
call_per_local: 0,
Expand All @@ -50,18 +50,18 @@ fn instruction_weights_heuristics_test() {
local_get: 900,
local_set: 1_900,
local_tee: 2_500,
global_get: 2_000,
global_set: 3_000,
global_get: 700,
global_set: 1_000,
memory_current: 14_200,

i64clz: 6_100,
i32clz: 6_100,
i64ctz: 6_700,
i32ctz: 6_700,
i64popcnt: 1_000,
i32popcnt: 800,
i64eqz: 4_000,
i32eqz: 2_400,
i32popcnt: 350,
i64eqz: 1_300,
i32eqz: 1_200,
i32extend8s: 800,
i32extend16s: 800,
i64extend8s: 800,
Expand All @@ -70,60 +70,60 @@ fn instruction_weights_heuristics_test() {
i64extendsi32: 800,
i64extendui32: 400,
i32wrapi64: 300,
i64eq: 4_200,
i32eq: 2_200,
i64ne: 4_200,
i32ne: 2_200,

i64lts: 4_000,
i32lts: 2_000,
i64ltu: 4_000,
i32ltu: 2_000,
i64gts: 4_000,
i32gts: 2_000,
i64gtu: 4_000,
i32gtu: 2_000,
i64les: 4_000,
i32les: 2_000,
i64leu: 4_000,
i32leu: 2_000,

i64ges: 4_000,
i32ges: 2_000,
i64geu: 4_000,
i32geu: 2_000,
i64add: 2_500,
i64eq: 1_800,
i32eq: 1_100,
i64ne: 1_700,
i32ne: 1_000,

i64lts: 1_200,
i32lts: 1_000,
i64ltu: 1_200,
i32ltu: 1_000,
i64gts: 1_200,
i32gts: 1_000,
i64gtu: 1_200,
i32gtu: 1_000,
i64les: 1_200,
i32les: 1_000,
i64leu: 1_200,
i32leu: 1_000,

i64ges: 1_300,
i32ges: 1_000,
i64geu: 1_300,
i32geu: 1_000,
i64add: 1_300,
i32add: 1_000,
i64sub: 3_000,
i64sub: 1_300,
i32sub: 1_000,
i64mul: 4_000,
i32mul: 2_300,
i64divs: 4_800,
i32divs: 3_800,

i64divu: 5_200,
i32divu: 4_200,
i64rems: 21_100,
i32rems: 15_100,
i64remu: 4_300,
i32remu: 4_300,
i64and: 3_000,
i64mul: 2_000,
i32mul: 2_000,
i64divs: 3_500,
i32divs: 3_500,

i64divu: 3_500,
i32divu: 3_500,
i64rems: 10_000,
i32rems: 10_000,
i64remu: 3_500,
i32remu: 3_500,
i64and: 1_000,
i32and: 1_000,
i64or: 3_000,
i64or: 1_000,
i32or: 1_000,
i64xor: 3_000,
i64xor: 1_000,
i32xor: 1_000,

i64shl: 2_500,
i32shl: 1_000,
i64shrs: 2_500,
i32shrs: 1_000,
i64shru: 2_500,
i32shru: 1_000,
i64rotl: 2_000,
i32rotl: 1_000,
i64rotr: 2_500,
i32rotr: 1_000,
i64shl: 1_000,
i32shl: 800,
i64shrs: 1_000,
i32shrs: 800,
i64shru: 1_000,
i32shru: 800,
i64rotl: 1_500,
i32rotl: 800,
i64rotr: 1_000,
i32rotr: 800,
};

check_instructions_weights(weights, expected_weights);
Expand Down
90 changes: 45 additions & 45 deletions runtime/vara/src/weights/frame_system.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d9cfd99

Please sign in to comment.