diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_empty_string.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_empty_string.sol index a4202fab3..7497d3c35 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_empty_string.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_empty_string.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { function f1() public returns (bytes memory) { return abi.encode(""); diff --git a/test/libsolidity/semanticTests/abiEncoderV1/bool_out_of_bounds.sol b/test/libsolidity/semanticTests/abiEncoderV1/bool_out_of_bounds.sol index 575d8012c..92ca61f12 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/bool_out_of_bounds.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/bool_out_of_bounds.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { function f(bool b) public pure returns (bool) { return b; } } diff --git a/test/libsolidity/semanticTests/abiEncoderV1/cleanup/cleanup.sol b/test/libsolidity/semanticTests/abiEncoderV1/cleanup/cleanup.sol index a97ad107d..3a671486f 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/cleanup/cleanup.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/cleanup/cleanup.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { function f(uint16 a, int16 b, address c, bytes3 d, bool e) public pure returns (uint v, uint w, uint x, uint y, uint z) { diff --git a/test/libsolidity/semanticTests/abiEncoderV1/enums.sol b/test/libsolidity/semanticTests/abiEncoderV1/enums.sol index ad69e268f..b3f32d01e 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/enums.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/enums.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { enum E { A, B } function f(E e) public pure returns (uint x) { diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol index 5a1ed846a..82f04c0a7 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol @@ -1,5 +1,5 @@ ==== Source: A ==== -pragma abicoder v2; +pragma abicoder v2; struct Data { uint a; @@ -19,6 +19,8 @@ contract B { } } ==== Source: B ==== +pragma abicoder v1; + import "A"; contract C is B { @@ -31,5 +33,5 @@ contract C is B { // ---- // test() -> 77 // gas irOptimized: 133635 -// gas legacy: 156573 -// gas legacyOptimized: 112940 +// gas legacy: 156449 +// gas legacyOptimized: 112943 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_modifier_used_in_v1_contract.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_modifier_used_in_v1_contract.sol index d5eb7b2c5..09b9b3afa 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_modifier_used_in_v1_contract.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_modifier_used_in_v1_contract.sol @@ -1,5 +1,5 @@ ==== Source: A ==== -pragma abicoder v2; +pragma abicoder v2; struct Data { uint value; @@ -23,6 +23,8 @@ contract B { } } ==== Source: B ==== +pragma abicoder v1; + import "A"; contract C is B { @@ -39,4 +41,4 @@ contract C is B { // ---- // test() -> 5, 10 // gas irOptimized: 92624 -// gas legacy: 100441 +// gas legacy: 100237 diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_empty_string.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_empty_string_v1.sol similarity index 93% rename from test/libsolidity/semanticTests/abiencodedecode/abi_encode_empty_string.sol rename to test/libsolidity/semanticTests/abiencodedecode/abi_encode_empty_string_v1.sol index 335843f23..b35266ced 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_empty_string.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_empty_string_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; // Tests that this will not end up using a "bytes0" type // (which would assert) contract C { diff --git a/test/libsolidity/semanticTests/arithmetics/checked_add_v1.sol b/test/libsolidity/semanticTests/arithmetics/checked_add_v1.sol index 34b9e74e7..600ddee07 100644 --- a/test/libsolidity/semanticTests/arithmetics/checked_add_v1.sol +++ b/test/libsolidity/semanticTests/arithmetics/checked_add_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { // Input is still not checked - this needs ABIEncoderV2! function f(uint16 a, uint16 b) public returns (uint16) { diff --git a/test/libsolidity/semanticTests/cleanup/bool_conversion.sol b/test/libsolidity/semanticTests/cleanup/bool_conversion_v1.sol similarity index 95% rename from test/libsolidity/semanticTests/cleanup/bool_conversion.sol rename to test/libsolidity/semanticTests/cleanup/bool_conversion_v1.sol index 20f594764..531f4d05c 100644 --- a/test/libsolidity/semanticTests/cleanup/bool_conversion.sol +++ b/test/libsolidity/semanticTests/cleanup/bool_conversion_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { function f(bool _b) public returns (uint256) { if (_b) return 1; diff --git a/test/libsolidity/semanticTests/cleanup/cleanup_address_types.sol b/test/libsolidity/semanticTests/cleanup/cleanup_address_types_v1.sol similarity index 96% rename from test/libsolidity/semanticTests/cleanup/cleanup_address_types.sol rename to test/libsolidity/semanticTests/cleanup/cleanup_address_types_v1.sol index c94cfc776..7c71d8bd6 100644 --- a/test/libsolidity/semanticTests/cleanup/cleanup_address_types.sol +++ b/test/libsolidity/semanticTests/cleanup/cleanup_address_types_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; // Checks that address types are properly cleaned before they are compared. contract C { function f(address a) public returns (uint256) { diff --git a/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types.sol b/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_v1.sol similarity index 95% rename from test/libsolidity/semanticTests/cleanup/cleanup_bytes_types.sol rename to test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_v1.sol index 32b90748e..ac085cd56 100644 --- a/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types.sol +++ b/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; // Checks that bytesXX types are properly cleaned before they are compared. contract C { function f(bytes2 a, uint16 x) public returns (uint256) { diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_signed.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_signed_v1.sol similarity index 98% rename from test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_signed.sol rename to test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_signed_v1.sol index df0570cb7..4e1779d27 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_signed.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_signed_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { function f(int8 a, uint8 b) public returns (int256) { assembly { diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_v1.sol similarity index 94% rename from test/libsolidity/semanticTests/operators/shifts/shift_right_garbled.sol rename to test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_v1.sol index c0d6be8bd..8649871a0 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { function f(uint8 a, uint8 b) public returns (uint256) { assembly { diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int16.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int16_v1.sol similarity index 97% rename from test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int16.sol rename to test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int16_v1.sol index daa1ffb5f..8200f69cf 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int16.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int16_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { function f(int16 a, uint16 b) public returns (int16) { return a >> b; diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int32.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int32_v1.sol similarity index 97% rename from test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int32.sol rename to test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int32_v1.sol index 4070fe7e1..245925b3d 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int32.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int32_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { function f(int32 a, uint32 b) public returns (int32) { return a >> b; diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int8.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int8_v1.sol similarity index 96% rename from test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int8.sol rename to test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int8_v1.sol index 95d983dcd..4b557fccc 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int8.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int8_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { function f(int8 a, uint8 b) public returns (int8) { return a >> b; diff --git a/test/libsolidity/semanticTests/revertStrings/calldata_too_short.sol b/test/libsolidity/semanticTests/revertStrings/calldata_too_short_v1.sol similarity index 94% rename from test/libsolidity/semanticTests/revertStrings/calldata_too_short.sol rename to test/libsolidity/semanticTests/revertStrings/calldata_too_short_v1.sol index fea9fe72c..e9fc7e331 100644 --- a/test/libsolidity/semanticTests/revertStrings/calldata_too_short.sol +++ b/test/libsolidity/semanticTests/revertStrings/calldata_too_short_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { function d(bytes memory _data) public pure returns (uint8) { return abi.decode(_data, (uint8)); diff --git a/test/libsolidity/semanticTests/revertStrings/enum.sol b/test/libsolidity/semanticTests/revertStrings/enum_v1.sol similarity index 92% rename from test/libsolidity/semanticTests/revertStrings/enum.sol rename to test/libsolidity/semanticTests/revertStrings/enum_v1.sol index db3f9f7e2..ebf042653 100644 --- a/test/libsolidity/semanticTests/revertStrings/enum.sol +++ b/test/libsolidity/semanticTests/revertStrings/enum_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { enum E {X, Y} function f(E[] calldata arr) external { diff --git a/test/libsolidity/semanticTests/revertStrings/enum_v2.sol b/test/libsolidity/semanticTests/revertStrings/enum_v2.sol new file mode 100644 index 000000000..6952dc0ce --- /dev/null +++ b/test/libsolidity/semanticTests/revertStrings/enum_v2.sol @@ -0,0 +1,13 @@ +pragma abicoder v2; +contract C { + enum E {X, Y} + function f(E[] calldata arr) external { + arr[1]; + } +} +// ==== +// EVMVersion: >=byzantium +// compileViaYul: also +// revertStrings: debug +// ---- +// f(uint8[]): 0x20, 2, 3, 3 -> FAILURE diff --git a/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1.sol b/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1.sol index e10cb267c..2a57f728b 100644 --- a/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1.sol +++ b/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1.sol @@ -4,6 +4,7 @@ contract C { } // ==== // EVMVersion: >=byzantium +// ABIEncoderV1Only: true // compileViaYul: false // revertStrings: debug // ---- diff --git a/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1_abiv2.sol b/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1_abiv2.sol deleted file mode 100644 index 92e0cc70c..000000000 --- a/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1_abiv2.sol +++ /dev/null @@ -1,10 +0,0 @@ -pragma abicoder v2; -contract C { - function t(uint) public pure {} -} -// ==== -// EVMVersion: >=byzantium -// compileViaYul: also -// revertStrings: debug -// ---- -// t(uint256) -> FAILURE, hex"08c379a0", 0x20, 34, "ABI decoding: tuple data too sho", "rt" diff --git a/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v2.sol b/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v2.sol index 4072db952..92e0cc70c 100644 --- a/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v2.sol +++ b/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v2.sol @@ -1,9 +1,10 @@ +pragma abicoder v2; contract C { function t(uint) public pure {} } // ==== // EVMVersion: >=byzantium -// compileViaYul: true +// compileViaYul: also // revertStrings: debug // ---- // t(uint256) -> FAILURE, hex"08c379a0", 0x20, 34, "ABI decoding: tuple data too sho", "rt" diff --git a/test/libsolidity/semanticTests/revertStrings/invalid_abi_decoding_calldata_v1.sol b/test/libsolidity/semanticTests/revertStrings/invalid_abi_decoding_calldata_v1.sol index 3468bfc07..a74af7c1c 100644 --- a/test/libsolidity/semanticTests/revertStrings/invalid_abi_decoding_calldata_v1.sol +++ b/test/libsolidity/semanticTests/revertStrings/invalid_abi_decoding_calldata_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { function d(bytes memory _data) public pure returns (uint8) { return abi.decode(_data, (uint8)); diff --git a/test/libsolidity/semanticTests/revertStrings/invalid_abi_decoding_memory_v1.sol b/test/libsolidity/semanticTests/revertStrings/invalid_abi_decoding_memory_v1.sol index 68981a3cb..3f4c8cb3b 100644 --- a/test/libsolidity/semanticTests/revertStrings/invalid_abi_decoding_memory_v1.sol +++ b/test/libsolidity/semanticTests/revertStrings/invalid_abi_decoding_memory_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract C { function dyn(uint ptr, uint start, uint x) public returns (bytes memory a) { assembly { diff --git a/test/libsolidity/semanticTests/types/mapping_enum_key_getter.sol b/test/libsolidity/semanticTests/types/mapping_enum_key_getter_v1.sol similarity index 98% rename from test/libsolidity/semanticTests/types/mapping_enum_key_getter.sol rename to test/libsolidity/semanticTests/types/mapping_enum_key_getter_v1.sol index 1796b9cdc..973432d80 100644 --- a/test/libsolidity/semanticTests/types/mapping_enum_key_getter.sol +++ b/test/libsolidity/semanticTests/types/mapping_enum_key_getter_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; contract test { enum E { A, B, C } mapping(E => uint8) public table; diff --git a/test/libsolidity/semanticTests/types/mapping_enum_key_library.sol b/test/libsolidity/semanticTests/types/mapping_enum_key_library_v1.sol similarity index 98% rename from test/libsolidity/semanticTests/types/mapping_enum_key_library.sol rename to test/libsolidity/semanticTests/types/mapping_enum_key_library_v1.sol index 7b638d122..3df034fc7 100644 --- a/test/libsolidity/semanticTests/types/mapping_enum_key_library.sol +++ b/test/libsolidity/semanticTests/types/mapping_enum_key_library_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; enum E { A, B, C } library L { function get(mapping(E => uint8) storage table, E k) external returns (uint8) { diff --git a/test/libsolidity/semanticTests/types/mapping_enum_key.sol b/test/libsolidity/semanticTests/types/mapping_enum_key_v1.sol similarity index 97% rename from test/libsolidity/semanticTests/types/mapping_enum_key.sol rename to test/libsolidity/semanticTests/types/mapping_enum_key_v1.sol index 50dde5f5b..934ce7d11 100644 --- a/test/libsolidity/semanticTests/types/mapping_enum_key.sol +++ b/test/libsolidity/semanticTests/types/mapping_enum_key_v1.sol @@ -1,3 +1,4 @@ +pragma abicoder v1; enum E { A, B, C } contract test { mapping(E => uint8) table;