solidity icon indicating copy to clipboard operation
solidity copied to clipboard

Add blobhash inside the `tx` context: blobhash(uint index) --> tx.blobhash(uint index)

Open jesusholoo opened this issue 2 years ago • 4 comments

Abstract / Motivation

The blob hash is an opcode that depends on the transaction, similar to the tx.origin or tx.gasprice. I think it's more consistent to access it inside the tx context

Specification

Blobhash opcode should be access in solidity like: tx.blobhash(uint index) returns (bytes32)

Backwards Compatibility

An alias could be made to be backwards compatibility but i don't think it's necessary

jesusholoo avatar Feb 27 '24 13:02 jesusholoo

Hi @invocamanman, thanks for opening the issue, but similarly to block.blockhash() which was removed in Solidity version 0.5.0 in favor of the global free function blockhash() we prefer to keep blobhash() as free function as well.

r0qs avatar Feb 27 '24 16:02 r0qs

Hey!^^ thanks for the answer :D

The blockhash is not an opcode depending on the metadata/data of the current executing block, but a opcode that retrieve information from previous blocks of the blockchain. So i think it's accurate to put it outside the block context.

( It's true tho that the block number of the current block might depend the execution of this opcode, since only can retrieve the hash of the last 256, but since it's retrieving "other information" than the current executing block, i think it's more accurate the way it is and see the 256 as a limitation)

The blobhash instead make reference only to the current executing transaction. And the index is referring to the blobs of the executing transaction as well.

jesusholoo avatar Feb 28 '24 00:02 jesusholoo

Hi @invocamanman, while I agree with your point about including blobhash as a member of tx, having these members of global magic variables (e.g. block, tx, etc) as global free functions would simplify the implementation of our planned Solidity standard library (refer to: https://github.com/ethereum/solidity/issues/10282 for additional context). Therefore, we prefer to not introduce this feature now, as it would require breaking changes in the near future.

r0qs avatar Feb 28 '24 13:02 r0qs

oki ^^ it makes sense

Thanks for the answers ^^

jesusholoo avatar Feb 28 '24 16:02 jesusholoo