From be16078d747b14b67616e4a64fe2df54949b97f7 Mon Sep 17 00:00:00 2001 From: rodiazet Date: Wed, 18 Dec 2024 16:15:29 +0100 Subject: [PATCH 1/3] eof: Make `GasTest` inherits from `EVMVersionRestricted` --- test/libsolidity/GasTest.cpp | 6 +----- test/libsolidity/GasTest.h | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/test/libsolidity/GasTest.cpp b/test/libsolidity/GasTest.cpp index 14722535e446..39b0e6681abe 100644 --- a/test/libsolidity/GasTest.cpp +++ b/test/libsolidity/GasTest.cpp @@ -37,7 +37,7 @@ using namespace solidity; using namespace boost::unit_test; GasTest::GasTest(std::string const& _filename): - TestCase(_filename) + EVMVersionRestrictedTestCase(_filename) { m_source = m_reader.source(); m_optimise = m_reader.boolSetting("optimize", false); @@ -114,10 +114,6 @@ void GasTest::setupCompiler(CompilerStack& _compiler) } settings.expectedExecutionsPerDeployment = m_optimiseRuns; _compiler.setOptimiserSettings(settings); - - // Intentionally ignoring EVM version specified on the command line. - // Gas expectations are only valid for the default version. - _compiler.setEVMVersion(EVMVersion{}); } TestCase::TestResult GasTest::run(std::ostream& _stream, std::string const& _linePrefix, bool _formatted) diff --git a/test/libsolidity/GasTest.h b/test/libsolidity/GasTest.h index 1337ae3f6f07..998411abf863 100644 --- a/test/libsolidity/GasTest.h +++ b/test/libsolidity/GasTest.h @@ -32,7 +32,7 @@ namespace solidity::frontend::test { -class GasTest: AnalysisFramework, public TestCase +class GasTest: AnalysisFramework, public EVMVersionRestrictedTestCase { public: static std::unique_ptr create(Config const& _config) From da7e1bc2f7125d1c9b03e3ff5894374aeac22a9e Mon Sep 17 00:00:00 2001 From: rodiazet Date: Wed, 18 Dec 2024 16:50:16 +0100 Subject: [PATCH 2/3] eof: Enable disabled earlier `gasTests` in `soltest.sh` --- .circleci/soltest.sh | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.circleci/soltest.sh b/.circleci/soltest.sh index 940ff1122aa9..71c2a952adac 100755 --- a/.circleci/soltest.sh +++ b/.circleci/soltest.sh @@ -56,18 +56,6 @@ EOF_EXCLUDES=( --run_test='!SolidityInlineAssembly/Analysis/large_constant' --run_test='!SolidityInlineAssembly/Analysis/staticcall' --run_test='!ViewPureChecker/assembly_staticcall' - --run_test='!gasTests/abiv2' - --run_test='!gasTests/abiv2_optimised' - --run_test='!gasTests/data_storage' - --run_test='!gasTests/dispatch_large' - --run_test='!gasTests/dispatch_large_optimised' - --run_test='!gasTests/dispatch_medium' - --run_test='!gasTests/dispatch_medium_optimised' - --run_test='!gasTests/dispatch_small' - --run_test='!gasTests/dispatch_small_optimised' - --run_test='!gasTests/exp' - --run_test='!gasTests/exp_optimized' - --run_test='!gasTests/storage_costs' --run_test='!yulStackLayout/literal_loop' ) From 586d31473d8d4fdbf41392f345a5ffd80ffff738 Mon Sep 17 00:00:00 2001 From: rodiazet Date: Wed, 18 Dec 2024 21:32:16 +0100 Subject: [PATCH 3/3] eof: Update `gasTests` tests --- test/libsolidity/gasTests/abiv2.sol | 3 +++ test/libsolidity/gasTests/abiv2_optimised.sol | 2 ++ test/libsolidity/gasTests/data_storage.sol | 3 +++ test/libsolidity/gasTests/dispatch_large.sol | 3 +++ test/libsolidity/gasTests/dispatch_large_optimised.sol | 2 ++ test/libsolidity/gasTests/dispatch_medium.sol | 3 +++ test/libsolidity/gasTests/dispatch_medium_optimised.sol | 3 +++ test/libsolidity/gasTests/dispatch_small.sol | 3 +++ test/libsolidity/gasTests/dispatch_small_optimised.sol | 2 ++ test/libsolidity/gasTests/exp.sol | 2 ++ test/libsolidity/gasTests/exp_optimized.sol | 2 ++ test/libsolidity/gasTests/storage_costs.sol | 2 ++ 12 files changed, 30 insertions(+) diff --git a/test/libsolidity/gasTests/abiv2.sol b/test/libsolidity/gasTests/abiv2.sol index 6fa822fade47..95c30ac645db 100644 --- a/test/libsolidity/gasTests/abiv2.sol +++ b/test/libsolidity/gasTests/abiv2.sol @@ -12,6 +12,9 @@ contract C { function f7(uint[31] memory, string[20] memory, C, address) public returns (bytes[] memory, uint16[] memory) {} function f8(uint[32] memory, string[] memory, uint32, address) public returns (uint[] memory, uint16[] memory) {} } +// ==== +// EVMVersion: =current +// bytecodeFormat: legacy // ---- // creation: // codeDepositCost: 1208000 diff --git a/test/libsolidity/gasTests/abiv2_optimised.sol b/test/libsolidity/gasTests/abiv2_optimised.sol index 2989c1acd8f9..e23a7bff2562 100644 --- a/test/libsolidity/gasTests/abiv2_optimised.sol +++ b/test/libsolidity/gasTests/abiv2_optimised.sol @@ -13,6 +13,8 @@ contract C { function f8(uint[32] memory, string[] memory, uint32, address) public returns (uint[] memory, uint16[] memory) {} } // ==== +// EVMVersion: =current +// bytecodeFormat: legacy // optimize: true // optimize-yul: true // ---- diff --git a/test/libsolidity/gasTests/data_storage.sol b/test/libsolidity/gasTests/data_storage.sol index 0d24ef505273..d9cacf5caf44 100644 --- a/test/libsolidity/gasTests/data_storage.sol +++ b/test/libsolidity/gasTests/data_storage.sol @@ -11,6 +11,9 @@ contract C { require(false, "12345678901234567890123456789012123456789012345678901234567890123"); } } +// ==== +// EVMVersion: =current +// bytecodeFormat: legacy // ---- // creation: // codeDepositCost: 377800 diff --git a/test/libsolidity/gasTests/dispatch_large.sol b/test/libsolidity/gasTests/dispatch_large.sol index e1cce4acd764..2b7822f5f855 100644 --- a/test/libsolidity/gasTests/dispatch_large.sol +++ b/test/libsolidity/gasTests/dispatch_large.sol @@ -22,6 +22,9 @@ contract Large { function g9(uint x) public payable returns (uint) { b[uint8(msg.data[8])] = x; } function g0(uint x) public payable returns (uint) { require(x > 10); } } +// ==== +// EVMVersion: =current +// bytecodeFormat: legacy // ---- // creation: // codeDepositCost: 618400 diff --git a/test/libsolidity/gasTests/dispatch_large_optimised.sol b/test/libsolidity/gasTests/dispatch_large_optimised.sol index 83e55c1a9c1e..5ab62e892285 100644 --- a/test/libsolidity/gasTests/dispatch_large_optimised.sol +++ b/test/libsolidity/gasTests/dispatch_large_optimised.sol @@ -23,6 +23,8 @@ contract Large { function g0(uint x) public payable returns (uint) { require(x > 10); } } // ==== +// EVMVersion: =current +// bytecodeFormat: legacy // optimize: true // optimize-runs: 2 // ---- diff --git a/test/libsolidity/gasTests/dispatch_medium.sol b/test/libsolidity/gasTests/dispatch_medium.sol index 6bf8f89394fa..aedbec0b081f 100644 --- a/test/libsolidity/gasTests/dispatch_medium.sol +++ b/test/libsolidity/gasTests/dispatch_medium.sol @@ -9,6 +9,9 @@ contract Medium { function g9(uint x) public payable returns (uint) { b[uint8(msg.data[8])] = x; } function g0(uint x) public payable returns (uint) { require(x > 10); } } +// ==== +// EVMVersion: =current +// bytecodeFormat: legacy // ---- // creation: // codeDepositCost: 259600 diff --git a/test/libsolidity/gasTests/dispatch_medium_optimised.sol b/test/libsolidity/gasTests/dispatch_medium_optimised.sol index e921fcf125ba..2ea33955e9c8 100644 --- a/test/libsolidity/gasTests/dispatch_medium_optimised.sol +++ b/test/libsolidity/gasTests/dispatch_medium_optimised.sol @@ -10,6 +10,9 @@ contract Medium { function g0(uint x) public payable returns (uint) { require(x > 10); } } // ==== +// EVMVersion: =current +// bytecodeFormat: legacy +// ==== // optimize: true // optimize-runs: 2 // ---- diff --git a/test/libsolidity/gasTests/dispatch_small.sol b/test/libsolidity/gasTests/dispatch_small.sol index d2c391582ed5..d198fd9927f1 100644 --- a/test/libsolidity/gasTests/dispatch_small.sol +++ b/test/libsolidity/gasTests/dispatch_small.sol @@ -4,6 +4,9 @@ contract Small { function f1(uint x) public returns (uint) { a = x; b[uint8(msg.data[0])] = x; } fallback () external payable {} } +// ==== +// EVMVersion: =current +// bytecodeFormat: legacy // ---- // creation: // codeDepositCost: 103800 diff --git a/test/libsolidity/gasTests/dispatch_small_optimised.sol b/test/libsolidity/gasTests/dispatch_small_optimised.sol index e20e1d982427..b59bdafc2780 100644 --- a/test/libsolidity/gasTests/dispatch_small_optimised.sol +++ b/test/libsolidity/gasTests/dispatch_small_optimised.sol @@ -5,8 +5,10 @@ contract Small { fallback () external payable {} } // ==== +// EVMVersion: =current // optimize: true // optimize-runs: 2 +// bytecodeFormat: legacy // ---- // creation: // codeDepositCost: 58200 diff --git a/test/libsolidity/gasTests/exp.sol b/test/libsolidity/gasTests/exp.sol index 6ad4dd3bee43..40ef138136cd 100644 --- a/test/libsolidity/gasTests/exp.sol +++ b/test/libsolidity/gasTests/exp.sol @@ -15,6 +15,8 @@ contract C { } } // ==== +// EVMVersion: =current +// bytecodeFormat: legacy // optimize: false // optimize-yul: false // ---- diff --git a/test/libsolidity/gasTests/exp_optimized.sol b/test/libsolidity/gasTests/exp_optimized.sol index 982fcd28feb9..fae9a24fd757 100644 --- a/test/libsolidity/gasTests/exp_optimized.sol +++ b/test/libsolidity/gasTests/exp_optimized.sol @@ -15,6 +15,8 @@ contract C { } } // ==== +// EVMVersion: =current +// bytecodeFormat: legacy // optimize: true // optimize-yul: true // ---- diff --git a/test/libsolidity/gasTests/storage_costs.sol b/test/libsolidity/gasTests/storage_costs.sol index afb442ed7f97..871c15eab388 100644 --- a/test/libsolidity/gasTests/storage_costs.sol +++ b/test/libsolidity/gasTests/storage_costs.sol @@ -11,8 +11,10 @@ contract C { } } // ==== +// EVMVersion: =current // optimize: true // optimize-yul: true +// bytecodeFormat: legacy // ---- // creation: // codeDepositCost: 25600