Add FEVM precompile to fetch drand beacons from chain history #1051
Replies: 6 comments 2 replies
-
An alternative approach to sourcing randomness for a user-space PDP protocol would be for drand beacons, in unchained mode, to be submitted directly to smart contracts from off-chain. drand beacons are independently verifiable so there is no fundamental need to consult the host blockchain. However, verifying drand beacons requires BLS12-381 operations which are not yet available in the FEVM (or in Ethereum). Adding such precompiles, following EIP-2357 would be a great step in the future and is proposed in #846, but this is a much more complicated change: it will require specifying and implementing a set of new FVM syscalls behind those EVM precompiles. But for fetching drand beacons from the host chain, Filecoin already provides a syscall and all that's missing is exposing it to user contracts. |
Beta Was this translation helpful? Give feedback.
-
Since the alternative of submitting drand beacons externally would be a fine basis for a PDP protocol (if verifying those beacons were feasible), this raises a design question about what functionality the precompile should have beyond simply fetching the beacon from chain headers. Where these beacons are used in the built-in actors for proof verification, the beacon values are mixed with entropy and domain separation tags deep in the built-in actor code. It might be natural to suggest similar mixing for the EVM precompile, but I think we should go with zero additional processing being forced upon the caller unless we can give strong motivations for why they should not be allowed to simply fetch the raw DRAND beacon value. |
Beta Was this translation helpful? Give feedback.
-
Related discussion about using the chain beacon records for Raises a couple of questions for this FIP - across network versions there's slight variations in how to extract the randomness from the block headers and also variation in how to handle null epochs. Should the FIP outline either or both of those things? I think at least some mention of null epochs would be worthwhile since it may result in unexpected behaviour for the user where two different calls result in the same randomness. |
Beta Was this translation helpful? Give feedback.
-
The first draft of the FIP is ready for review here: #1048 |
Beta Was this translation helpful? Give feedback.
-
Please include more details around #1048 (comment) before last call |
Beta Was this translation helpful? Give feedback.
-
filecoin-project/lotus#12414 (comment) is my summary of behaviour of this syscall (at least from my read of the code, which could be off in subtle ways so caveat emptor). A few things stand out to me as possibly being worth calling out in the FIP text because it's not mentioned anywhere else:
|
Beta Was this translation helpful? Give feedback.
-
We (@ZenGround0 @anorth) propose adding a precompile to the EVM actor to allow FEVM smart contracts to fetch a drand beacon included in the Filecoin blockchain header at a specified epoch.
The FVM already exposes a syscall for fetching drand beacons at a specified Filecoin epoch. The Filecoin protocol and built-in actors use this to provide randomness for proofs. This proposal introduces a precompile exposing this FVM functionality to the EVM builtin actor, allowing user contracts to make use of the same functionality.
As a historical note, during early development the FEVM team included a similar precompile, but removed it for simplicity for the first launch, lacking a concrete use case.
The motivation behind this proposal is a concrete use case: developing a proof of data possession (PDP) protocol in user-space. The basic form of such a protocol needs an unbiasable source of randomness with lookback to prior epochs. The PREVRANDAO precompile does not provide lookback, but since the Filecoin chain already supports randomness with lookback, we can provide this additional precompile as an extension to raw EVM capabilities.
FIP draft in progress: #1048
Beta Was this translation helpful? Give feedback.
All reactions