Skip to content
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

Merged
merged 4 commits into from Feb 25, 2020
Merged

feat: Simple randomness beacon #2177

merged 4 commits into from Feb 25, 2020

Conversation

SkidanovAlex
Copy link
Collaborator

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.

Copy link
Collaborator

@bowenwang1996 bowenwang1996 left a 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 🤔

near/src/runtime.rs Outdated Show resolved Hide resolved
@SkidanovAlex
Copy link
Collaborator Author

Yes, we need to make sure the staking transaction always contains ED25519 that is convertable to restretto. Will add.


// Data to confirm the correctness of randomness beacon output
pub vrf_value: near_crypto::vrf::Value,
pub vrf_proof: near_crypto::vrf::Proof,
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants