-
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.
Merge pull request #14759 from ethereum/eip-4844-add-blobhash-2
EIP 4844 (part 2)
- Loading branch information
Showing
30 changed files
with
234 additions
and
12 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
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
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
18 changes: 18 additions & 0 deletions
18
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
contract C { | ||
function f() public view returns(bytes32) { | ||
return blobhash(0); | ||
} | ||
function g() public view returns(bytes32) { | ||
return blobhash(1); | ||
} | ||
function h() public view returns(bytes32) { | ||
// NOTE: blobhash(2) should return 0 since EVMHost has only two blob hashes injected in the block the transaction is being executed. | ||
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 |
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 |
12 changes: 12 additions & 0 deletions
12
test/libsolidity/semanticTests/state/uncalled_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,12 @@ | ||
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); | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=cancun | ||
// ---- | ||
// f() -> 0x0100000000000000000000000000000000000000000000000000000000000001 |
11 changes: 11 additions & 0 deletions
11
test/libsolidity/syntaxTests/globalFunctions/blobhash_function_pre_cancun.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 blobhash(uint256 index) public pure returns(bytes32) { | ||
return bytes32(index); | ||
} | ||
function f() public pure returns(bytes32) { | ||
return blobhash(2); | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: <=shanghai | ||
// ---- |
12 changes: 12 additions & 0 deletions
12
test/libsolidity/syntaxTests/globalFunctions/blobhash_function_shadow_warning.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(2); | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=cancun | ||
// ---- | ||
// Warning 2319: (17-117): This declaration shadows a builtin symbol. |
10 changes: 10 additions & 0 deletions
10
test/libsolidity/syntaxTests/globalFunctions/blobhash_no_call.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,10 @@ | ||
contract C | ||
{ | ||
function f() public pure { | ||
blobhash; | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=cancun | ||
// ---- | ||
// Warning 6133: (52-60): Statement has no effect. |
10 changes: 10 additions & 0 deletions
10
test/libsolidity/syntaxTests/globalFunctions/blobhash_not_declared_pre_cancun.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,10 @@ | ||
contract C | ||
{ | ||
function f() public pure { | ||
blobhash; | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: <=shanghai | ||
// ---- | ||
// DeclarationError 7576: (52-60): Undeclared identifier. Did you mean "blockhash"? |
9 changes: 9 additions & 0 deletions
9
test/libsolidity/syntaxTests/globalFunctions/blobhash_var_pre_cancun.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,9 @@ | ||
contract C { | ||
function f() public pure returns (bool) { | ||
bool blobhash = true; | ||
return blobhash; | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: <=shanghai | ||
// ---- |
11 changes: 11 additions & 0 deletions
11
test/libsolidity/syntaxTests/globalFunctions/blobhash_var_shadow_warning.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 pure returns (bool) { | ||
bool blobhash = true; | ||
return blobhash; | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=cancun | ||
// ---- | ||
// Warning 2319: (67-80): This declaration shadows a builtin symbol. |
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
test/libsolidity/syntaxTests/inlineAssembly/blobhash_pre_cancun_not_reserved.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,19 @@ | ||
contract C { | ||
function f() public pure returns (uint ret) { | ||
assembly { | ||
let blobhash := 1 | ||
ret := blobhash | ||
} | ||
} | ||
function g() public pure returns (uint ret) { | ||
assembly { | ||
function blobhash() -> r { | ||
r := 1000 | ||
} | ||
ret := blobhash() | ||
} | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: <=shanghai | ||
// ---- |
Oops, something went wrong.