Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nikola-matic committed Jan 11, 2024
1 parent cfb8994 commit c760bd8
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 10 deletions.
2 changes: 2 additions & 0 deletions docs/using-the-compiler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ at each version. Backward compatibility is not guaranteed between each version.
- Introduces ``prevrandao()`` and ``block.prevrandao``, and changes the semantics of the now deprecated ``block.difficulty``, disallowing ``difficulty()`` in inline assembly (see `EIP-4399 <https://eips.ethereum.org/EIPS/eip-4399>`_).
- ``shanghai`` (**default**)
- Smaller code size and gas savings due to the introduction of ``push0`` (see `EIP-3855 <https://eips.ethereum.org/EIPS/eip-3855>`_).
- ``cancun``
- The block's blob base fee (`EIP-7516 <https://eips.ethereum.org/EIPS/eip-7516>`_ and `EIP-4844 <https://eips.ethereum.org/EIPS/eip-4844>`_) can be accessed via the global ``block.blobbasefee`` or ``blobbasefee()`` in inline assembly.

.. index:: ! standard JSON, ! --standard-json
.. _compiler-api:
Expand Down
3 changes: 2 additions & 1 deletion test/EVMHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ EVMHost::EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm):
tx_context.chain_id = evmc::uint256be{1};
// The minimum value of basefee
tx_context.block_base_fee = evmc::bytes32{7};
tx_context.blob_base_fee = evmc::bytes32{7};
// The minimum value of blobbasefee
tx_context.blob_base_fee = evmc::bytes32{1};

// Reserve space for recording calls.
if (!recorded_calls.capacity())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
contract C {
function f() public view returns (uint ret) {
assembly {
let blobbasefee := sload(0)
let blobbasefee := 999
ret := blobbasefee
}
}
Expand All @@ -17,5 +17,5 @@ contract C {
// ====
// EVMVersion: <=shanghai
// ----
// f() -> 0
// f() -> 999
// g() -> 1000
8 changes: 4 additions & 4 deletions test/libsolidity/semanticTests/state/block_blobbasefee.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ contract C {
// ====
// EVMVersion: >=cancun
// ----
// f() -> 7
// g() -> 7
// f() -> 7
// g() -> 7
// f() -> 1
// g() -> 1
// f() -> 1
// g() -> 1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ contract C {
}
}
// ====
// EVMVersion: =cancun
// EVMVersion: >=cancun
// ----
// ParserError 5568: (98-109): Cannot use builtin function name "blobbasefee" as identifier name.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contract C {
}
}
// ====
// EVMVersion: <=shanghai
// EVMVersion: =shanghai
// ----
// TypeError 1006: (74-91): "blobbasefee" is not supported by the VM version.
// DeclarationError 4619: (187-198): Function "blobbasefee" not found.
Expand Down
10 changes: 10 additions & 0 deletions test/libyul/yulInterpreterTests/blobbasefee.yul
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
sstore(0, blobbasefee())
}
// ====
// EVMVersion: >=cancun
// ----
// Trace:
// Memory dump:
// Storage dump:
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
function blobbasefee() {}
}
// ====
// EVMVersion: <=shanghai
// ----
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
function blobbasefee() {}
}
// ====
// EVMVersion: >=cancun
// ----
// ParserError 5568: (15-26): Cannot use builtin function name "blobbasefee" as identifier name.
3 changes: 2 additions & 1 deletion test/tools/yulInterpreter/Interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ struct InterpreterState
u256 chainid = 0x01;
/// The minimum value of basefee: 7 wei.
u256 basefee = 0x07;
u256 blobbasefee = 0x07;
/// The minimum value of blobbasefee: 1 wei.
u256 blobbasefee = 0x01;
/// Log of changes / effects. Sholud be structured data in the future.
std::vector<std::string> trace;
/// This is actually an input parameter that more or less limits the runtime.
Expand Down

0 comments on commit c760bd8

Please sign in to comment.