Skip to content

Commit 96ce95a

Browse files
committed
Do not include code deposit gas in the total visible in test expectations
1 parent 9623386 commit 96ce95a

File tree

83 files changed

+444
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+444
-244
lines changed

test/libsolidity/SemanticTest.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ bool SemanticTest::checkGasCostExpectation(TestFunctionCall& io_test, bool _comp
570570
(m_optimiserSettings == OptimiserSettings::full() ? "Optimized" : "");
571571

572572
soltestAssert(
573-
io_test.call().expectations.gasUsed.count(setting) ==
573+
io_test.call().expectations.gasUsedExcludingCode.count(setting) ==
574574
io_test.call().expectations.gasUsedForCodeDeposit.count(setting)
575575
);
576576

@@ -584,19 +584,22 @@ bool SemanticTest::checkGasCostExpectation(TestFunctionCall& io_test, bool _comp
584584
!m_enforceGasCost ||
585585
m_gasUsed < m_enforceGasCostMinValue ||
586586
m_gasUsed >= InitialGas ||
587-
(setting == "ir" && io_test.call().expectations.gasUsed.count(setting) == 0) ||
587+
(setting == "ir" && io_test.call().expectations.gasUsedExcludingCode.count(setting) == 0) ||
588588
io_test.call().kind == FunctionCall::Kind::Builtin
589589
)
590590
return true;
591591

592592
solAssert(!m_runWithABIEncoderV1Only, "");
593593

594-
io_test.setGasCost(setting, m_gasUsed);
594+
// NOTE: Cost excluding code is unlikely to be negative but it may still be possible due to refunds.
595+
// We'll deal with it when we actually have a test case like that.
596+
solUnimplementedAssert(m_gasUsed >= m_gasUsedForCodeDeposit);
597+
io_test.setGasCostExcludingCode(setting, m_gasUsed - m_gasUsedForCodeDeposit);
595598
io_test.setCodeDepositGasCost(setting, m_gasUsedForCodeDeposit);
596599

597600
return
598-
io_test.call().expectations.gasUsed.count(setting) > 0 &&
599-
m_gasUsed == io_test.call().expectations.gasUsed.at(setting) &&
601+
io_test.call().expectations.gasUsedExcludingCode.count(setting) > 0 &&
602+
m_gasUsed - m_gasUsedForCodeDeposit == io_test.call().expectations.gasUsedExcludingCode.at(setting) &&
600603
m_gasUsedForCodeDeposit == io_test.call().expectations.gasUsedForCodeDeposit.at(setting);
601604
}
602605

test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ contract C is B {
3030
}
3131
// ----
3232
// test() -> 77
33-
// gas irOptimized: 110348
34-
// gas legacy: 151866
35-
// gas legacyOptimized: 110373
33+
// gas irOptimized: 55148
34+
// gas irOptimized code: 55200
35+
// gas legacy: 57266
36+
// gas legacy code: 94600
37+
// gas legacyOptimized: 55173
38+
// gas legacyOptimized code: 55200

test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_modifier_used_in_v1_contract.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ contract C is B {
3939
// ----
4040
// test() -> 5, 10
4141
// gas irOptimized: 87337
42-
// gas legacy: 102651
42+
// gas legacy: 66251
43+
// gas legacy code: 36400

test/libsolidity/semanticTests/arithmetics/check_var_init.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ contract D {
1616
// ----
1717
// f() -> FAILURE, hex"4e487b71", 0x11
1818
// g(), 100 wei -> 1
19-
// gas legacy: 100380
19+
// gas legacy: 76780
20+
// gas legacy code: 23600

test/libsolidity/semanticTests/array/constant_var_as_array_length.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ contract C {
88
}
99
// ----
1010
// constructor(): 1, 2, 3 ->
11-
// gas irOptimized: 139616
12-
// gas legacy: 180517
13-
// gas legacyOptimized: 150462
11+
// gas irOptimized: 124816
12+
// gas irOptimized code: 14800
13+
// gas legacy: 134317
14+
// gas legacy code: 46200
15+
// gas legacyOptimized: 127062
16+
// gas legacyOptimized code: 23400
1417
// a(uint256): 0 -> 1
1518
// a(uint256): 1 -> 2
1619
// a(uint256): 2 -> 3

test/libsolidity/semanticTests/array/copying/cleanup_during_multi_element_per_slot_copy.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ contract C {
1616
}
1717
// ----
1818
// constructor()
19-
// gas irOptimized: 226321
20-
// gas legacy: 215753
21-
// gas legacyOptimized: 181756
19+
// gas irOptimized: 89121
20+
// gas irOptimized code: 137200
21+
// gas legacy: 89553
22+
// gas legacy code: 126200
23+
// gas legacyOptimized: 83556
24+
// gas legacyOptimized code: 98200
2225
// f() -> 0

test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ contract B {
1818
}
1919
// ----
2020
// f() -> 2, 3, 4, 5, 6, 1000, 1001, 1002, 1003, 1004
21-
// gas irOptimized: 114404
22-
// gas legacy: 230001
23-
// gas legacyOptimized: 130637
21+
// gas irOptimized: 59204
22+
// gas irOptimized code: 55200
23+
// gas legacy: 68001
24+
// gas legacy code: 162000
25+
// gas legacyOptimized: 60037
26+
// gas legacyOptimized code: 70600

test/libsolidity/semanticTests/array/fixed_arrays_in_constructors.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ contract Creator {
99
}
1010
// ----
1111
// constructor(): 1, 2, 3, 4 ->
12-
// gas irOptimized: 126327
13-
// gas legacy: 174186
14-
// gas legacyOptimized: 128709
12+
// gas irOptimized: 103927
13+
// gas irOptimized code: 22400
14+
// gas legacy: 115186
15+
// gas legacy code: 59000
16+
// gas legacyOptimized: 104909
17+
// gas legacyOptimized code: 23800
1518
// r() -> 4
1619
// ch() -> 3

test/libsolidity/semanticTests/array/function_array_cross_calls.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ contract C {
4242
}
4343
// ----
4444
// test() -> 5, 6, 7
45-
// gas irOptimized: 255728
46-
// gas legacy: 440376
47-
// gas legacyOptimized: 278651
45+
// gas irOptimized: 86128
46+
// gas irOptimized code: 169600
47+
// gas legacy: 97576
48+
// gas legacy code: 342800
49+
// gas legacyOptimized: 87851
50+
// gas legacyOptimized code: 190800

test/libsolidity/semanticTests/array/reusing_memory.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ contract Main {
2424
}
2525
// ----
2626
// f(uint256): 0x34 -> 0x46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c1
27-
// gas irOptimized: 111924
28-
// gas legacy: 125154
29-
// gas legacyOptimized: 113012
27+
// gas irOptimized: 99524
28+
// gas irOptimized code: 12400
29+
// gas legacy: 101554
30+
// gas legacy code: 23600
31+
// gas legacyOptimized: 99612
32+
// gas legacyOptimized code: 13400

0 commit comments

Comments
 (0)