Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
r0qs committed Jan 18, 2024
1 parent 971da98 commit c7f1c0e
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/test_antlr_grammar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ done < <(
grep -v -E 'inlineAssembly/prevrandao_disallowed_function_post_paris.sol' |
# Skipping a test with "let blobhash := ..."
grep -v -E 'inlineAssembly/blobhash_pre_cancun.sol' |
grep -v -E 'inlineAssembly/blobhash_pre_cancun_warning.sol' |
grep -v -E 'inlineAssembly/blobhash_pre_cancun_not_reserved.sol' |
# Skipping license error, unrelated to the grammar
grep -v -E 'license/license_double5.sol' |
grep -v -E 'license/license_hidden_unicode.sol' |
Expand Down
3 changes: 3 additions & 0 deletions test/libsolidity/semanticTests/state/uncalled_blobhash.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
contract C {
function f() public returns (bytes32) {
// NOTE: The `tx_context.blob_hashes` is injected into EVMHost with the following hashes, indexed accordingly:
// 0 -> 0x0100000000000000000000000000000000000000000000000000000000000001
// 1 -> 0x0100000000000000000000000000000000000000000000000000000000000002
return (blobhash)(0);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
contract C {
function blobhash(uint256 index) public pure returns(bytes32) {
return bytes32(index);
}
function f() public pure returns(bytes32) {
return blobhash(2);
}
}
// ====
// EVMVersion: <=shanghai
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ contract C {
return blobhash(2);
}
}
// ====
// EVMVersion: >=cancun
// ----
// Warning 2319: (17-117): This declaration shadows a builtin symbol.
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ contract C
blobhash;
}
}
// ====
// EVMVersion: >=cancun
// ----
// Warning 6133: (52-60): Statement has no effect.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
contract C
{
function f() public pure {
blobhash;
}
}
// ====
// EVMVersion: <=shanghai
// ----
// DeclarationError 7576: (52-60): Undeclared identifier. Did you mean "blockhash"?
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
contract C {
function f() public pure returns (bool) {
bool blobhash = true;
return blobhash;
}
}
// ====
// EVMVersion: <=shanghai
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ contract C
return blobhash;
}
}
// ====
// EVMVersion: >=cancun
// ----
// Warning 2319: (67-80): This declaration shadows a builtin symbol.
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ contract C {
// ====
// EVMVersion: <=shanghai
// ----
// 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.

0 comments on commit c7f1c0e

Please sign in to comment.