From 1ebf887357df5afc6e31ff19825eb9f4784a56a9 Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Wed, 17 Dec 2025 17:28:00 -0300 Subject: [PATCH 1/6] set version to 0.8.33 --- CMakeLists.txt | 2 +- Changelog.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4d67e243bab..5792563eb3c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ include(EthPolicy) eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.8.32") +set(PROJECT_VERSION "0.8.33") # OSX target needed in order to support std::visit set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14") project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX) diff --git a/Changelog.md b/Changelog.md index ad0916815d64..9f533332e147 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,12 @@ +### 0.8.33 (unreleased) + +Language Features: + +Compiler Features: + +Bugfixes: + + ### 0.8.32 (2025-12-18) Important Bugfixes: From c6aecabaddc313dd81d28bc2a4e47434d4c1b95f Mon Sep 17 00:00:00 2001 From: rodiazet Date: Thu, 18 Dec 2025 14:51:27 +0100 Subject: [PATCH 2/6] Remove the sanity check. --- libsolidity/analysis/TypeChecker.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index ab8f00a3082b..8556487ff4ca 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -3409,16 +3409,6 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) if (!annotation.isPure.set()) annotation.isPure = false; - if ( - auto const* funcType = dynamic_cast(annotation.type); - funcType && - funcType->kind() != FunctionType::Kind::Declaration && - funcType->kind() != FunctionType::Kind::Internal && - funcType->kind() != FunctionType::Kind::Error && - funcType->kind() != FunctionType::Kind::Event - ) - solAssert(funcType->isPure() == *annotation.isPure); - return false; } From 27af4dcfb9247707efe002d0ce6aac9185fdbd72 Mon Sep 17 00:00:00 2001 From: rodiazet Date: Thu, 18 Dec 2025 14:57:57 +0100 Subject: [PATCH 3/6] Add tests. --- .../syntaxTests/constants/access_via_getter.sol | 8 ++++++++ .../syntaxTests/immutable/access_via_getter.sol | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/libsolidity/syntaxTests/constants/access_via_getter.sol create mode 100644 test/libsolidity/syntaxTests/immutable/access_via_getter.sol diff --git a/test/libsolidity/syntaxTests/constants/access_via_getter.sol b/test/libsolidity/syntaxTests/constants/access_via_getter.sol new file mode 100644 index 000000000000..686c5a03927e --- /dev/null +++ b/test/libsolidity/syntaxTests/constants/access_via_getter.sol @@ -0,0 +1,8 @@ +contract Counter { + uint256 public constant MIN_LIQUIDITY = 1000; + + function run() view public { + this.MIN_LIQUIDITY(); + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/immutable/access_via_getter.sol b/test/libsolidity/syntaxTests/immutable/access_via_getter.sol new file mode 100644 index 000000000000..6ce9e42c4301 --- /dev/null +++ b/test/libsolidity/syntaxTests/immutable/access_via_getter.sol @@ -0,0 +1,8 @@ +contract Counter { + uint256 public immutable MIN_LIQUIDITY = 1000; + + function run() view public { + this.MIN_LIQUIDITY(); + } +} +// ---- From 07bf6e13a88a6f831b2b0055214aa8bc6cf75f09 Mon Sep 17 00:00:00 2001 From: rodiazet Date: Thu, 18 Dec 2025 15:04:37 +0100 Subject: [PATCH 4/6] Update changelog. --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 9f533332e147..61bde4e259f7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Language Features: Compiler Features: Bugfixes: +* TypeChecker: Fix internal error when accessing getters of constant variables. ### 0.8.32 (2025-12-18) From c8ebb1104691ddcb463bcdbc5f9a5fa743de33ab Mon Sep 17 00:00:00 2001 From: Nikola Matic Date: Thu, 18 Dec 2025 17:36:49 +0100 Subject: [PATCH 5/6] Sort changelog and date for 0.8.33 --- Changelog.md | 6 +----- docs/bugs_by_version.json | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Changelog.md b/Changelog.md index 61bde4e259f7..cb78695bc5e3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,8 +1,4 @@ -### 0.8.33 (unreleased) - -Language Features: - -Compiler Features: +### 0.8.33 (2025-12-18) Bugfixes: * TypeChecker: Fix internal error when accessing getters of constant variables. diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json index 2ecc3c235606..8a4d2fe23b00 100644 --- a/docs/bugs_by_version.json +++ b/docs/bugs_by_version.json @@ -2053,6 +2053,10 @@ "bugs": [], "released": "2025-12-18" }, + "0.8.33": { + "bugs": [], + "released": "2025-12-18" + }, "0.8.4": { "bugs": [ "LostStorageArrayWriteOnSlotOverflow", From df8bb173b9b42587debb14940f858197c6a79724 Mon Sep 17 00:00:00 2001 From: Asuka Date: Thu, 12 Nov 2026 17:19:04 +0800 Subject: [PATCH 6/6] fix: clean token IDs and decode wrapped TRON addresses --- libsolidity/codegen/ABIFunctions.cpp | 4 ++ libsolidity/codegen/ExpressionCompiler.cpp | 2 +- libsolidity/codegen/YulUtilFunctions.cpp | 4 ++ test/libsolidity/StandardCompiler.cpp | 34 +++++++++++ .../userDefinedValueType/tron_address_abi.sol | 56 +++++++++++++++++++ 5 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/semanticTests/userDefinedValueType/tron_address_abi.sol diff --git a/libsolidity/codegen/ABIFunctions.cpp b/libsolidity/codegen/ABIFunctions.cpp index fd18ac44b363..722a9fb6b32b 100644 --- a/libsolidity/codegen/ABIFunctions.cpp +++ b/libsolidity/codegen/ABIFunctions.cpp @@ -1105,6 +1105,10 @@ std::string ABIFunctions::abiDecodingFunction(Type const& _type, bool _fromMemor std::string ABIFunctions::abiDecodingFunctionValueType(Type const& _type, bool _fromMemory) { + if (auto const* valueType = dynamic_cast(&_type)) + if (valueType->underlyingType().category() == Type::Category::Address) + return abiDecodingFunctionValueType(valueType->underlyingType(), _fromMemory); + Type const* decodingType = _type.decodingType(); solAssert(decodingType, ""); solAssert(decodingType->sizeOnStack() == 1, ""); diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index c3dcf3647c80..ebd91d14c6b5 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -890,7 +890,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) // gas <- gas * !value m_context << Instruction::SWAP1 << Instruction::DUP2; m_context << Instruction::ISZERO << Instruction::MUL << Instruction::SWAP1; - arguments[1]->accept(*this); + acceptAndConvert(*arguments[1], *function.parameterTypes()[1], true); // will be removed in next release m_context << Instruction::DUP1 << Instruction::ISZERO; diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 4c3cd8c0fc69..28f87bd78251 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -4041,6 +4041,10 @@ std::string YulUtilFunctions::cleanupFunction(Type const& _type) std::string YulUtilFunctions::validatorFunction(Type const& _type, bool _revertOnFailure) { + if (auto const* valueType = dynamic_cast(&_type)) + if (valueType->underlyingType().category() == Type::Category::Address) + return validatorFunction(valueType->underlyingType(), _revertOnFailure); + std::string functionName = std::string("validator_") + (_revertOnFailure ? "revert_" : "assert_") + _type.identifier(); return m_functionCollector.createFunction(functionName, [&]() { Whiskers templ(R"( diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index eced46153cad..7f48d1d6674c 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -735,6 +735,40 @@ contract C { BOOST_TEST(ir.find("if mod(returndatasize(), 0x20) { revert(0, 0) }") != std::string::npos); } +BOOST_AUTO_TEST_CASE(tron_transfer_token_narrowed_id) +{ + for (bool optimize: {false, true}) + { + auto runtimeFor = [&](std::string const& _tokenId) { + std::string sourceCode = R"( +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.0; +contract C { + function transfer(address payable recipient, uint256 x) external { + recipient.transferToken(100, TOKEN_ID); + } + function transferConstant(address payable recipient) external { + uint256 x = (1 << 64) + 1000001; + recipient.transferToken(100, TOKEN_ID); + } +} +)"; + boost::replace_all(sourceCode, "TOKEN_ID", _tokenId); + Json input = createLanguageAndSourcesSection("Solidity", {{"A.sol", sourceCode}}); + input["settings"]["optimizer"]["enabled"] = optimize; + input["settings"]["metadata"]["appendCBOR"] = false; + input["settings"]["outputSelection"]["*"]["*"] = Json::array({"evm.deployedBytecode.object"}); + Json const output = compile(input.dump()); + BOOST_REQUIRE(containsAtMostWarnings(output)); + return output["contracts"]["A.sol"]["C"]["evm"]["deployedBytecode"]["object"].get(); + }; + // Implicit widening to trcToken must consume the same value as explicit widening. + std::string const cleaned = runtimeFor("uint256(uint24(x))"); + BOOST_CHECK_EQUAL(runtimeFor("uint24(x)"), cleaned); + BOOST_CHECK(runtimeFor("x") != cleaned); + } +} + BOOST_AUTO_TEST_CASE(compilation_error) { char const* input = R"( diff --git a/test/libsolidity/semanticTests/userDefinedValueType/tron_address_abi.sol b/test/libsolidity/semanticTests/userDefinedValueType/tron_address_abi.sol new file mode 100644 index 000000000000..78625da7b130 --- /dev/null +++ b/test/libsolidity/semanticTests/userDefinedValueType/tron_address_abi.sol @@ -0,0 +1,56 @@ +pragma abicoder v2; +type MyAddress is address; +type MyPayableAddress is address payable; +type MyUint24 is uint24; +type MyBool is bool; +type MyBytes2 is bytes2; + +contract C { + // Payable entry points let the generic EVM test host exercise the ABI decoder + // without the TRON-specific non-payable CALLTOKENID/CALLTOKENVALUE checks. + constructor() payable {} + + function plain(address a) external payable returns (address) { return a; } + function wrapped(MyAddress a) external payable returns (MyAddress) { return a; } + function raw(MyAddress a) external payable returns (uint256 value) { + assembly { value := a } + } + function wrappedPayable(MyPayableAddress a) external payable returns (MyPayableAddress) { return a; } + function decode(bytes memory data) external payable returns (MyAddress) { + return abi.decode(data, (MyAddress)); + } + function calldataArray(MyAddress[] calldata data) external payable returns (MyAddress) { return data[0]; } + function memoryArray(MyAddress[] memory data) external payable returns (MyAddress) { return data[0]; } + + function integer(MyUint24 value) external payable returns (MyUint24) { return value; } + function boolean(MyBool value) external payable returns (MyBool) { return value; } + function fixedBytes(MyBytes2 value) external payable returns (MyBytes2) { return value; } +} +// ==== +// EVMVersion: >=byzantium +// compileViaYul: also +// ---- +// plain(address): 0x1234 -> 0x1234 +// plain(address): 0x410000000000000000000000000000000000001234 -> 0x1234 +// plain(address): 0x01410000000000000000000000000000000000001234 -> FAILURE +// wrapped(address): 0x1234 -> 0x1234 +// wrapped(address): 0x410000000000000000000000000000000000001234 -> 0x1234 +// wrapped(address): 0xff0000000000000000000000000000000000001234 -> 0x1234 +// wrapped(address): 0x01410000000000000000000000000000000000001234 -> FAILURE +// raw(address): 0x410000000000000000000000000000000000001234 -> 0x1234 +// wrappedPayable(address): 0x410000000000000000000000000000000000001234 -> 0x1234 +// decode(bytes): 0x20, 0x20, 0x1234 -> 0x1234 +// decode(bytes): 0x20, 0x20, 0x410000000000000000000000000000000000001234 -> 0x1234 +// decode(bytes): 0x20, 0x20, 0x01410000000000000000000000000000000000001234 -> FAILURE +// calldataArray(address[]): 0x20, 1, 0x1234 -> 0x1234 +// calldataArray(address[]): 0x20, 1, 0x410000000000000000000000000000000000001234 -> 0x1234 +// calldataArray(address[]): 0x20, 1, 0x01410000000000000000000000000000000000001234 -> FAILURE +// memoryArray(address[]): 0x20, 1, 0x1234 -> 0x1234 +// memoryArray(address[]): 0x20, 1, 0x410000000000000000000000000000000000001234 -> 0x1234 +// memoryArray(address[]): 0x20, 1, 0x01410000000000000000000000000000000000001234 -> FAILURE +// integer(uint24): 0xffffff -> 0xffffff +// integer(uint24): 0x1000000 -> FAILURE +// boolean(bool): 1 -> true +// boolean(bool): 2 -> FAILURE +// fixedBytes(bytes2): 0x1234000000000000000000000000000000000000000000000000000000000000 -> 0x1234000000000000000000000000000000000000000000000000000000000000 +// fixedBytes(bytes2): 0x1234000000000000000000000000000000000000000000000000000000000001 -> FAILURE