foundry
foundry copied to clipboard
Anvil support block.prevrandao?
Component
Anvil
Describe the feature you would like
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract Counter {
uint256 public number;
function setPrevrandao() public {
number = block.prevrandao;
}
}
Additional context
block.prevrandao
always 0
You need to set your hardfork to paris
or shanghai
for this—we've added support recently (https://github.com/foundry-rs/foundry/pull/5061)
Closing for now!
You need to set your hardfork to
paris
orshanghai
for this—we've added support recently (#5061)Closing for now!
Thank you for your reply, but so far nothing has changed. I still get always 0
.
-
foundryup
-
anvil --hardfork shanghai
Can we reopen this? Prevrandao is still always 0 for any block. @Evalir
can just init this to random
Wouldn’t it be better if it gives a different random for each block?
definitely