-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add blobhash high-level global function.
- Loading branch information
Showing
12 changed files
with
86 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 10 additions & 6 deletions
16
test/libsolidity/semanticTests/builtinFunctions/blobhash.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
contract C { | ||
function f() public view returns (bytes32 ret) { | ||
assembly { | ||
ret := blobhash(0) | ||
} | ||
function f() public view returns(bytes32) { | ||
return blobhash(0); | ||
} | ||
function g() public view returns(bytes32) { | ||
return blobhash(1); | ||
} | ||
function h() public view returns(bytes32) { | ||
return blobhash(2); | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=cancun | ||
// ---- | ||
// f() -> 0x0100000000000000000000000000000000000000000000000000000000000001 | ||
// g() -> 0x0100000000000000000000000000000000000000000000000000000000000002 | ||
// h() -> 0x00 |
12 changes: 12 additions & 0 deletions
12
test/libsolidity/semanticTests/builtinFunctions/blobhash_shadow_resolution.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
contract C { | ||
function blobhash(uint256 index) public pure returns(bytes32) { | ||
return bytes32(index); | ||
} | ||
function f() public pure returns(bytes32) { | ||
return blobhash(3); | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=cancun | ||
// ---- | ||
// f() -> 0x03 |
11 changes: 11 additions & 0 deletions
11
test/libsolidity/semanticTests/inlineAssembly/blobhash.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
contract C { | ||
function f() public view returns (bytes32 ret) { | ||
assembly { | ||
ret := blobhash(0) | ||
} | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=cancun | ||
// ---- | ||
// f() -> 0x0100000000000000000000000000000000000000000000000000000000000001 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
contract C { | ||
function f(uint _index) public returns (bytes32) { | ||
return blobhash(_index); | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=cancun | ||
// ---- | ||
// f(uint256): 0 -> 0x0100000000000000000000000000000000000000000000000000000000000001 | ||
// f(uint256): 1 -> 0x0100000000000000000000000000000000000000000000000000000000000002 | ||
// f(uint256): 2 -> 0x00 | ||
// f(uint256): 255 -> 0x00 | ||
// f(uint256): 256 -> 0x00 | ||
// f(uint256): 257 -> 0x00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
contract C { | ||
function f() public returns (bytes32) { | ||
return (blobhash)(0); | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=cancun | ||
// ---- | ||
// f() -> 0x0100000000000000000000000000000000000000000000000000000000000001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
contract C { | ||
function blobhash(uint256 index) public pure returns(bytes32) { | ||
return bytes32(index); | ||
} | ||
function f() public pure returns(bytes32) { | ||
return blobhash(3); | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=cancun | ||
// ---- | ||
// Warning 2319: (17-117): This declaration shadows a builtin symbol. |