Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended tx_context with "blob base fee" #696

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ and this project adheres to [Semantic Versioning].

### Added

- Extended `tx_context` with [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) blob hashes
- Extended `tx_context` with the [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) blob hashes
[#691](https://github.com/ethereum/evmc/pull/691)
- Extended `tx_context` with the [EIP-7516](https://eips.ethereum.org/EIPS/eip-7516) "blob base fee"
for the `BLOBBASEFEE` EVM instruction.
[#696](https://github.com/ethereum/evmc/pull/696)
- Added [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153) transient storage support
[#693](https://github.com/ethereum/evmc/pull/693)

Expand Down
20 changes: 11 additions & 9 deletions bindings/go/evmc/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@ func goByteSlice(data *C.uint8_t, size C.size_t) []byte {

// TxContext contains information about current transaction and block.
type TxContext struct {
GasPrice Hash
Origin Address
Coinbase Address
Number int64
Timestamp int64
GasLimit int64
PrevRandao Hash
ChainID Hash
BaseFee Hash
GasPrice Hash
Origin Address
Coinbase Address
Number int64
Timestamp int64
GasLimit int64
PrevRandao Hash
ChainID Hash
BaseFee Hash
BlobBaseFee Hash
}

type HostContext interface {
Expand Down Expand Up @@ -181,6 +182,7 @@ func getTxContext(pCtx unsafe.Pointer) C.struct_evmc_tx_context {
evmcBytes32(txContext.PrevRandao),
evmcBytes32(txContext.ChainID),
evmcBytes32(txContext.BaseFee),
evmcBytes32(txContext.BlobBaseFee),
nil, // TODO: Add support for blob hashes.
0,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public ByteBuffer call(ByteBuffer msg) {

@Override
public ByteBuffer getTxContext() {
return ByteBuffer.allocateDirect(208).put(new byte[208]);
return ByteBuffer.allocateDirect(240).put(new byte[240]);
}

@Override
Expand Down
1 change: 1 addition & 0 deletions bindings/rust/evmc-vm/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ mod tests {
block_prev_randao: Uint256::default(),
chain_id: Uint256::default(),
block_base_fee: Uint256::default(),
blob_base_fee: Uint256::default(),
blob_hashes: std::ptr::null(),
blob_hashes_count: 0,
}
Expand Down
1 change: 1 addition & 0 deletions bindings/rust/evmc-vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ mod tests {
block_prev_randao: Uint256 { bytes: [0xaa; 32] },
chain_id: Uint256::default(),
block_base_fee: Uint256::default(),
blob_base_fee: Uint256::default(),
blob_hashes: std::ptr::null(),
blob_hashes_count: 0,
}
Expand Down
1 change: 1 addition & 0 deletions include/evmc/evmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ struct evmc_tx_context
evmc_uint256be block_prev_randao; /**< The block previous RANDAO (EIP-4399). */
evmc_uint256be chain_id; /**< The blockchain's ChainID. */
evmc_uint256be block_base_fee; /**< The block base fee per gas (EIP-1559, EIP-3198). */
evmc_uint256be blob_base_fee; /**< The blob base fee (EIP-7516). */
const evmc_bytes32* blob_hashes; /**< The array of blob hashes (EIP-4844). */
size_t blob_hashes_count; /**< The number of blob hashes (EIP-4844). */
};
Expand Down