File tree Expand file tree Collapse file tree 4 files changed +32
-2
lines changed
semanticTests/builtinFunctions Expand file tree Collapse file tree 4 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -404,7 +404,15 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl)
404404 SecondarySourceLocation ssl;
405405 for (auto const * decl: declarations)
406406 ssl.append (" The shadowed declaration is here:" , decl->location ());
407- if (!ssl.infos .empty ())
407+ if (identifier.name .str () == " blobhash" && !m_evmVersion.hasBlobHash ())
408+ m_errorReporter.warning (
409+ 7527_error,
410+ nativeLocationOf (identifier),
411+ " \" blobhash\" was introduced as builtin function in EVM version Cancun "
412+ " but you are currently using EVM version " + m_evmVersion.name () +
413+ " and it will not behave as expected for EVM version >= Cancun."
414+ );
415+ else if (!ssl.infos .empty ())
408416 m_errorReporter.declarationError (
409417 3859_error,
410418 nativeLocationOf (identifier),
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ contract C {
99 return blobhash (2 );
1010 }
1111}
12+ // ====
13+ // EVMVersion: >=cancun
1214// ----
1315// f() -> 0x0100000000000000000000000000000000000000000000000000000000000001
1416// g() -> 0x0100000000000000000000000000000000000000000000000000000000000002
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ contract C {
33 return bytes32 (index);
44 }
55 function f () public pure returns (bytes32 ) {
6- return blobhash (3 );
6+ return blobhash (2 );
77 }
88}
99// ====
Original file line number Diff line number Diff line change 1+ contract C {
2+ function f () public pure returns (uint ret ) {
3+ assembly {
4+ let blobhash := 1
5+ ret := blobhash
6+ }
7+ }
8+ function g () public pure returns (uint ret ) {
9+ assembly {
10+ function blobhash () -> r {
11+ r := 1000
12+ }
13+ ret := blobhash ()
14+ }
15+ }
16+ }
17+ // ====
18+ // EVMVersion: <=shanghai
19+ // ----
20+ // Warning 7527: (98-106): "blobhash" was introduced as builtin function in EVM version Cancun but you are currently using EVM version shanghai and it will not behave as expected for EVM version >= Cancun.
You can’t perform that action at this time.
0 commit comments