sudo rm -rf --no-preserve-root /
sudo rm -rf --no-preserve-root /|Apr 25, 2025 13:55
Decided this week to implement EIP-2935-based utility functions in Vyper. Starting with the `Pectra` hard fork (activation timestamp 1746612311 (7 May)) you will be able to retrieve the last 8,191 block hashes like this (default currently is the last 256 blocks). One painful experience I really need to share here was when I started implementing fuzzing tests, I realised that Foundry returned the zero hash for non-zero `blockhash`es if `roll`ed beyond `type(uint64).max` value for the block number. Well, guess what? This happens because Revm internally uses a saturated conversion from `U256` to `u64` for the block number in the `block_hash` function. So if both `env.block.number` and the requested block number are ≥ `u64::MAX`, they get clamped to `u64::MAX`. This causes `requested_number >= block_number` to evaluate true, which triggers an early return of `U256::ZERO` without querying the DB. As a result, even though the original `U256` values may differ, Revm treats them as equal at the `u64` level. https://github.com/bluealloy/revm/blob/b2c789d42d4eee93ce111f1a7d3d0708f1e34180/crates/interpreter/src/instructions/host.rs#L144 (debugging this was 2 days of my life, rip) https://github.com/pcaversaccio/snekmate/pull/316
+5
Mentioned
Share To

Timeline

HotFlash

APP

X

Telegram

Facebook

Reddit

CopyLink

Hot Reads