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: Simple randomness beacon #2177
Conversation
43ff1c1
to
904bbcf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change a validator can make the entire network crash by sending a staking transaction with a Secp256 key 🤔
Yes, we need to make sure the staking transaction always contains ED25519 that is convertable to restretto. Will add. |
904bbcf
to
3f7391b
Compare
bd619ae
to
a40d2c2
Compare
|
||
// Data to confirm the correctness of randomness beacon output | ||
pub vrf_value: near_crypto::vrf::Value, | ||
pub vrf_proof: near_crypto::vrf::Proof, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there are two fields vrf_value
and random_value
in different places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic is the following: with this randomness beacon the random_value = hash(vrf_value)
.
However, once we switch to the new randomness beacon, that will change to random_value = new_beacon(hash(vrf_value))
. In other words, vrf_value
will always stay the output of the VRF by the current block producer, while the way the random_value
is computed can change.
This implements a simple biasable randomness beacon. The work on the unbiasable randomness beacon is here: https://github.com/nearprotocol/nearcore/commits/rnd_integration The biasable randomness beacon in this commit just uses the VRF created by the current block proposer, thus it has 1 bit of influence (the block proposer can choose not to create a block), which is sufficient for the block producers rotation, but should be used with caution for other use cases. Test plan --------- No new tests added as part of the change.
a40d2c2
to
48ab2c2
Compare
This implements a simple biasable randomness beacon. The work on the
unbiasable randomness beacon is here:
https://github.com/nearprotocol/nearcore/commits/rnd_integration
The biasable randomness beacon in this commit just uses the VRF created
by the current block proposer, thus it has 1 bit of influence (the block
proposer can choose not to create a block), which is sufficient for the
block producers rotation, but should be used with caution for other use
cases.
Test plan
No new tests added as part of the change.