Support solc v0.8.35 (#512)

- Support solc v0.8.35
- The new `erc7201` is comptime (already translated to a constant in
Yul)

Didn't spot any relevant breakage or addition in the release notes so
should be no-brainer.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
xermicus authored and GitHub committed 2026-05-01 20:14:36 +02:00
1 parent 1308b446f1
commit ee869cdd18
11 files changed
+68 -9

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.35;
/* runner.json
{
"differential": true,
"actions": [
{
"Instantiate": {
"code": {
"Solidity": {
"contract": "ERC7201"
}
}
}
}
]
}
*/
/// Tests the `erc7201` builtin introduced in solc 0.8.35.
/// Reference: https://eips.ethereum.org/EIPS/eip-7201
contract ERC7201 {
/// Reference implementation of the ERC-7201 base slot formula in pure
/// Solidity. Used to cross-check the builtin output.
function referenceSlot(string memory id) internal pure returns (uint256) {
return uint256(
keccak256(bytes.concat(bytes32(uint256(keccak256(bytes(id))) - 1)))
& ~bytes32(uint256(0xff))
);
}
constructor() payable {
// Compile-time path: literal argument, solc folds the result into a
// numeric constant in the emitted Yul.
assert(erc7201("example.main") == referenceSlot("example.main"));
assert(
erc7201("erc7201:openzeppelin.storage.Initializable")
== referenceSlot("erc7201:openzeppelin.storage.Initializable")
);
assert(erc7201("") == referenceSlot(""));
// Runtime path: non-literal argument, solc emits a Yul utility
// function that performs the keccak256 hashes at runtime.
string memory id = "example.main";
assert(erc7201(id) == referenceSlot(id));
string memory empty = "";
assert(erc7201(empty) == referenceSlot(empty));
// The two paths must agree.
assert(erc7201("example.main") == erc7201(id));
}
}
+1
View File
@@ -67,6 +67,7 @@ test_spec!(add_mod_mul_mod, "AddModMulModTester", "AddModMulMod.sol");
test_spec!(memory_bounds, "MemoryBounds", "MemoryBounds.sol");
test_spec!(selfdestruct, "Selfdestruct", "Selfdestruct.sol");
test_spec!(clz, "CountLeadingZeros", "CountLeadingZeros.sol");
test_spec!(erc7201, "ERC7201", "ERC7201.sol");
test_spec!(call_gas, "CallGas", "CallGas.sol");
test_spec!(linker_symbol, "Linked", "Linked.sol");
test_spec!(
+1 -1
View File
@@ -23,7 +23,7 @@ pub mod version;
pub const FIRST_SUPPORTED_VERSION: semver::Version = semver::Version::new(0, 8, 0);
/// The last supported version of `solc`.
pub const LAST_SUPPORTED_VERSION: semver::Version = semver::Version::new(0, 8, 34);
pub const LAST_SUPPORTED_VERSION: semver::Version = semver::Version::new(0, 8, 35);
/// The Solidity compiler.
pub trait Compiler {