cartesi / rollups-contracts

Smart Contracts for Cartesi Rollups
https://cartesi.github.io/rollups-contracts/
Apache License 2.0
17 stars 37 forks source link

Add `block.prevrandao` to input metadata #256

Closed guidanoli closed 2 months ago

guidanoli commented 3 months ago

📚 Context

After the Merge, the header of every block contains a field called prevrandao, a random number generated by the beacon chain that is used by the proof-of-stake to randomly elect block proposers in the beginning of every epoch.

Applications can use this number as a source of randomness if they don't intend to handle large sums of assets. For large TVLs, we do not recommend using block.prevrandao. See EIP-4399 for technical details, and security tips for application developers.

✔️ Solution

We can add prevrandao to every input as metadata. This would be reflected in the current architecture as an extra parameter in the EvmInspect function. In Solidity, we'll call it prevRandao so that application developers can quickly find resources based on the real name.

guidanoli commented 3 months ago

FYI @tuler @miltonjonat

guidanoli commented 3 months ago

FYI @pedroargento