mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Tests and Changelog for basefee.
This commit is contained in:
parent
cb9b52c242
commit
43605d9299
@ -1,6 +1,8 @@
|
||||
### 0.8.7 (unreleased)
|
||||
|
||||
Language Features:
|
||||
* Introduce global ``block.basefee`` for retrieving the base fee of the current block.
|
||||
* Yul: Introduce builtin ``basefee()`` for retrieving the base fee of the current block.
|
||||
|
||||
|
||||
Compiler Features:
|
||||
|
18
test/libsolidity/semanticTests/state/block_basefee.sol
Normal file
18
test/libsolidity/semanticTests/state/block_basefee.sol
Normal file
@ -0,0 +1,18 @@
|
||||
contract C {
|
||||
function f() public view returns (uint) {
|
||||
return block.basefee;
|
||||
}
|
||||
function g() public view returns (uint ret) {
|
||||
assembly {
|
||||
ret := basefee()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=london
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 7
|
||||
// g() -> 7
|
||||
// f() -> 7
|
||||
// g() -> 7
|
@ -0,0 +1,15 @@
|
||||
contract C {
|
||||
function f() public view returns (uint) {
|
||||
return block.basefee;
|
||||
}
|
||||
function g() public view returns (uint ret) {
|
||||
assembly {
|
||||
ret := basefee()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: =berlin
|
||||
// ----
|
||||
// TypeError 5921: (74-87): "basefee" is not supported by the VM version.
|
||||
// TypeError 5430: (183-190): The "basefee" instruction is only available for London-compatible VMs (you are currently compiling for "berlin").
|
13
test/libsolidity/syntaxTests/types/magic_block_london.sol
Normal file
13
test/libsolidity/syntaxTests/types/magic_block_london.sol
Normal file
@ -0,0 +1,13 @@
|
||||
contract C {
|
||||
function f() public view returns (uint) {
|
||||
return block.basefee;
|
||||
}
|
||||
function g() public view returns (uint ret) {
|
||||
assembly {
|
||||
ret := basefee()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=london
|
||||
// ----
|
@ -0,0 +1,13 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly { pop(basefee()) }
|
||||
}
|
||||
function g() public pure returns (uint) {
|
||||
return block.basefee;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=london
|
||||
// ----
|
||||
// TypeError 2527: (67-76): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (147-160): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
@ -13,5 +13,5 @@ object "a" {
|
||||
// stop
|
||||
// data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421
|
||||
// Bytecode: 6006600055fe48656c6c6f2c20576f726c6421
|
||||
// Opcodes: PUSH1 0x6 PUSH1 0x0 SSTORE INVALID 0x48 PUSH6 0x6C6C6F2C2057 PUSH16 0x726C6421000000000000000000000000
|
||||
// Opcodes: PUSH1 0x6 PUSH1 0x0 SSTORE INVALID BASEFEE PUSH6 0x6C6C6F2C2057 PUSH16 0x726C6421000000000000000000000000
|
||||
// SourceMappings: 32:19:0:-:0;29:1;22:30
|
||||
|
Loading…
Reference in New Issue
Block a user