Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 0.8.33 (2025-12-18)

Bugfixes:
* TypeChecker: Fix internal error when accessing getters of constant variables.


### 0.8.32 (2025-12-18)

Important Bugfixes:
Expand Down
4 changes: 4 additions & 0 deletions docs/bugs_by_version.json
Original file line number Diff line number Diff line change
Expand Up @@ -2081,6 +2081,10 @@
"bugs": [],
"released": "2025-12-18"
},
"0.8.33": {
"bugs": [],
"released": "2025-12-18"
},
"0.8.4": {
"bugs": [
"UnsoundSpillInMutualRecursion",
Expand Down
10 changes: 0 additions & 10 deletions libsolidity/analysis/TypeChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3456,16 +3456,6 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
if (!annotation.isPure.set())
annotation.isPure = false;

if (
auto const* funcType = dynamic_cast<FunctionType const*>(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;
}

Expand Down
4 changes: 4 additions & 0 deletions libsolidity/codegen/ABIFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<UserDefinedValueType const*>(&_type))
if (valueType->underlyingType().category() == Type::Category::Address)
return abiDecodingFunctionValueType(valueType->underlyingType(), _fromMemory);

Type const* decodingType = _type.decodingType();
solAssert(decodingType, "");
solAssert(decodingType->sizeOnStack() == 1, "");
Expand Down
2 changes: 1 addition & 1 deletion libsolidity/codegen/ExpressionCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions libsolidity/codegen/YulUtilFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<UserDefinedValueType const*>(&_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"(
Expand Down
34 changes: 34 additions & 0 deletions test/libsolidity/StandardCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>();
};
// 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"(
Expand Down
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions test/libsolidity/syntaxTests/constants/access_via_getter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
contract Counter {
uint256 public constant MIN_LIQUIDITY = 1000;

function run() view public {
this.MIN_LIQUIDITY();
}
}
// ----
8 changes: 8 additions & 0 deletions test/libsolidity/syntaxTests/immutable/access_via_getter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
contract Counter {
uint256 public immutable MIN_LIQUIDITY = 1000;

function run() view public {
this.MIN_LIQUIDITY();
}
}
// ----
Loading