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

feat[lang]: add blobhash() builtin #3962

Merged
merged 22 commits into from
May 3, 2024

Conversation

pcaversaccio
Copy link
Collaborator

@pcaversaccio pcaversaccio commented Apr 18, 2024

What I did

Introduce the built-in function blobhash(uint256) for retrieving versioned hashes of BLOBs.

How I did it

Hard skills.

How to verify it

See https://eips.ethereum.org/EIPS/eip-4844#opcode-to-get-versioned-hashes.

Commit message

This commit adds access to the `BLOBHASH` opcode via the new builtin
function `blobhash()`. The opcode was introduced in EIP-4844.

References:
https://eips.ethereum.org/EIPS/eip-4844#opcode-to-get-versioned-hashes

Description for the changelog

feat: introduce the built-in function blobhash(uint256) for retrieving versioned hashes of BLOBs.

Cute Animal Picture

image

Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
@pcaversaccio pcaversaccio self-assigned this Apr 18, 2024
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.87%. Comparing base (097aecf) to head (92d4aec).

❗ Current head 92d4aec differs from pull request most recent head 28b21f3. Consider uploading reports for the commit 28b21f3 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3962      +/-   ##
==========================================
+ Coverage   90.82%   90.87%   +0.04%     
==========================================
  Files          98       95       -3     
  Lines       14867    14464     -403     
  Branches     3310     3207     -103     
==========================================
- Hits        13503    13144     -359     
+ Misses        944      912      -32     
+ Partials      420      408      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
@charles-cooper
Copy link
Member

we should ideally have functional tests, like check that blobhash actually matches what is in the evm

Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
@pcaversaccio
Copy link
Collaborator Author

we should ideally have functional tests, like check that blobhash actually matches what is in the evm

as discussed offline, eth-tester (and other EVM testing frameworks) don't expose the versioned BLOB hashes right now, making it impossible to write (for now) such a test, unfortunately. I added an additional non-empty assert in the tests for now: 98d4088.

pcaversaccio and others added 5 commits April 21, 2024 11:51
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
@@ -4,16 +4,16 @@

import rlp
from cached_property import cached_property
from eth.abc import ChainAPI, ComputationAPI
from eth.abc import ChainAPI, ComputationAPI, VirtualMachineAPI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a nit but i'm not a huge fan of importing things that are only used in type signatures, i am starting to prefer guarding these with if TYPE_CHECKING

@charles-cooper charles-cooper changed the title feat[lang]: add blobhash(uint256) feat[lang]: add blobhash() builtin May 3, 2024
@charles-cooper charles-cooper enabled auto-merge (squash) May 3, 2024 15:14
@charles-cooper charles-cooper merged commit 533b271 into vyperlang:master May 3, 2024
153 checks passed
@pcaversaccio pcaversaccio deleted the feat/blobhash branch May 3, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants