From 1f0f77aa9518d0e1849e543bc4a81b9654e4247c Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 21 Dec 2022 23:07:27 +0100 Subject: [PATCH] Minor test adjustments. --- .circleci/config.yml | 1 + .../functionCall/failed_create.sol | 2 +- ...example.sol => prediction_example_eof.sol} | 19 +++++++++++-------- 3 files changed, 13 insertions(+), 9 deletions(-) rename test/libsolidity/semanticTests/salted_create/{prediction_example.sol => prediction_example_eof.sol} (65%) diff --git a/.circleci/config.yml b/.circleci/config.yml index b23ff8f9f..32bd8c2d5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1042,6 +1042,7 @@ jobs: environment: EVM: "shanghai" SOLTEST_FLAGS: "--eof-version 1" + BOOST_TEST_ARGS: "-t sem*" steps: - run: name: Build evmone based on EOF branch diff --git a/test/libsolidity/semanticTests/functionCall/failed_create.sol b/test/libsolidity/semanticTests/functionCall/failed_create.sol index cf865ff19..aacaa0e0a 100644 --- a/test/libsolidity/semanticTests/functionCall/failed_create.sol +++ b/test/libsolidity/semanticTests/functionCall/failed_create.sol @@ -17,7 +17,7 @@ contract C { // EVMVersion: >=byzantium // ---- // constructor(), 20 wei -// gas irOptimized: 184005 +// gas irOptimized: 179697 // gas legacy: 294335 // gas legacyOptimized: 173427 // f(uint256): 20 -> 0x137aa4dfc0911524504fcd4d98501f179bc13b4a diff --git a/test/libsolidity/semanticTests/salted_create/prediction_example.sol b/test/libsolidity/semanticTests/salted_create/prediction_example_eof.sol similarity index 65% rename from test/libsolidity/semanticTests/salted_create/prediction_example.sol rename to test/libsolidity/semanticTests/salted_create/prediction_example_eof.sol index fa24e3d50..7e221ae10 100644 --- a/test/libsolidity/semanticTests/salted_create/prediction_example.sol +++ b/test/libsolidity/semanticTests/salted_create/prediction_example_eof.sol @@ -10,13 +10,15 @@ function adjustContractCodeForArgSize(bytes memory x, uint16 argSize) { assembly { let memPos := add(x, 32) - let numCodeSections := shr(240, mload(add(memPos, 7))) - let dataSectionSizeOffset := add(memPos, add(10, mul(numCodeSections, 2))) - let tmp := mload(dataSectionSizeOffset) - let dataSectionSize := shr(240, tmp) - dataSectionSize := add(dataSectionSize, argSize) - if gt(dataSectionSize, 0xFFFF) { revert(0,0) } - mstore(dataSectionSizeOffset, or(shr(16, shl(16, tmp)), shl(240, dataSectionSize))) + if eq(shr(232, mload(memPos)), 0xef0001) { + let numCodeSections := shr(240, mload(add(memPos, 7))) + let dataSectionSizeOffset := add(memPos, add(10, mul(numCodeSections, 2))) + let tmp := mload(dataSectionSizeOffset) + let dataSectionSize := shr(240, tmp) + dataSectionSize := add(dataSectionSize, argSize) + if gt(dataSectionSize, 0xFFFF) { revert(0,0) } + mstore(dataSectionSizeOffset, or(shr(16, shl(16, tmp)), shl(240, dataSectionSize))) + } } } @@ -43,4 +45,5 @@ contract C { // compileViaYul: also // ---- // createDSalted(bytes32,uint256): 42, 64 -> -// gas legacy: 104365 +// gas irOptimized: 100021 +// gas legacy: 104455