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

Introduce randomness into proposer selection? #7858

Closed
melekes opened this issue Oct 20, 2017 · 23 comments
Closed

Introduce randomness into proposer selection? #7858

melekes opened this issue Oct 20, 2017 · 23 comments
Labels
stale for use by stalebot

Comments

@melekes
Copy link
Contributor

melekes commented Oct 20, 2017

"The round-robin algorithm is deterministic for choosing the next leader. So even if there is a timeout, the attacker will know exactly who will be the next proposer and then just direct all his bots to simultaneously attack that proposer and keep doing this in sequence." Joe765 on https://riot.im/app/#/room/#cosmos:matrix.org

@adrianbrink
Copy link
Contributor

@sunnya97

@srmo
Copy link
Contributor

srmo commented Oct 20, 2017

I‘d like to add my previous comment:
Interesting point. A non-deterministic rotation also mitigates potential scenarios in which clients try to gain an advantage via short routes to a validator(s mempool) - i.e. proposer to have their transaction being favored by the proposer.
Which could also be mitigated by adding a randomized tx selection logic from the mempool.
Seeing that the "TM in a nutshell" speaks of customizable "mempool-selection-logic" for the proposer, which isn't there yet.

If mempool inclusion depends on the order when a tx is seen first on a node (i.e. checkTx decision), then the proposer rotation needs to be randomized.

@KrzysiekJ
Copy link
Contributor

Seems related to #574. If ABCI server creators want to reward validators for availability, then one way of doing this is to reward block proposer (after #338 is fixed). It is therefore important that proposer selection is unbiasable and evenly distributed.

@robertdavid010
Copy link

Fairly straight forward to create simple lottery based on commit-block hash(-1).

Reduce validator public key and block hash to common base, and make a best match.

@KrzysiekJ
Copy link
Contributor

Block hash can be manipulated and therefore it is not a good entropy source.

@robertdavid010
Copy link

Ok good to know. Certainly an immutable source of entropy must exist in the blockheader though. I will keep an eye out.

@robertdavid010
Copy link

BTW for clarification, which blockhash can be manipulated? Certainly none stored in the permanent blockchain and used as reference, or is this a seperate blockId??

@KrzysiekJ
Copy link
Contributor

Block hash cannot be manipulated after block is confirmed, but it can be manipulated beforehand, for example by adjusting the set of transactions.

@robertdavid010
Copy link

Ok. This is why i suggested using the previous block hash. ie. the most recent immutable block in the blockchain. This should be trustable pre-proposal?

@adrianbrink
Copy link
Contributor

The problem is that the current proposer could adjust the block in a way to give himself a higher chance of being selected.

@robertdavid010
Copy link

With the hash output being random for any current state, the best any validator could do would be to "brute force" a better result. Would this not mean somehow intentional disruption of proposal process? If every validator tries to brute force it, no transactions get processed, so no point in brute forcing?

@robertdavid010
Copy link

As far as I can tell, the only way to exploit it would be as a proposer, and noncing the current block state to try and get a subsequent blockhash which would again make you the proposer. However there is no direct advantage or incentive to this, so it's hard to see much affect of even a hostile actor (you end up where you started, with a deterministic round initiator), while to non-hostile actors there is incentive to honestly participate in the lottery to the extent it does increase the robustness of the network. Am I correct?

@adrianbrink
Copy link
Contributor

I would say that a hostile actor has all incentive to try and brute-force it to become the next proposer again. It would enable him to order transactions on the next block too. Of course, this becomes super obvious if done repeatedly, but if a proposer only does this every 1000 blocks he can use it to manipulate the transaction ordering for the application (example a DEX and the proposer every once in a while can cheat the system for extra profit).
This would be a significant change and we need to be completely sure that there is no way to game it.

@melekes
Copy link
Contributor Author

melekes commented Oct 26, 2017

@srmo good point! we're planning to add some kind of priority field so the mempool could sort its txs

@robertdavid010
Copy link

Sounds very good. TBH in evangelizing for Tendermint, much technical resistance based on this issue in general for BFT. I suggest a solution would go a long way to broader acceptance of Tendermint. It seems the only problem to solve is whether or not the source of "entropy" in proposer selection is fully known prior to block publishing by consensus round. If this can be prevented, the the "simple lottery" concept could work?

@robertdavid010
Copy link

Transaction payload is considered primary source of non-determinism in lottery systems like Bitcoin PoW. Added nonce is controllable (deterministic) aspect. I suppose what is needed is second/unpredictable source of entropy... Interesting aspect of other BFT's (what I understand original Ripple protocol did), is provable consensus on transactions(?) not just blocks(?). AFAIK, Ripple votes on each transaction. If transaction ordering could be "fixed" (ei. added transacition merkle tree) woud this eliminate "transaction ordering manipulation"? Essentially an added proof of "mempool state" among validators.

@HoOngEe
Copy link

HoOngEe commented Oct 7, 2019

What do you think of the randomized leader election proposal? The CodeChain team is considering to introduce randomized leader election in Tendermint.

@melekes
Copy link
Contributor Author

melekes commented Dec 19, 2019

https://medium.com/cypher-core/tendermint-2019-criticize-by-creation-not-by-finding-fault-ae49fb54f757?

@erikgrinaker
Copy link
Contributor

https://medium.com/codechain/tenderand-randomized-leader-election-in-tendermint-a3663d863479

@tac0turtle tac0turtle transferred this issue from tendermint/tendermint Jul 6, 2021
@ValarDragon
Copy link
Contributor

I'm unaware of any deterministic leader election algorithm that maintains some strong notion of fairness in the presence of weight changes at the moment. (Our current one does not)

Strongly in favor of randomized proposer election, with the sequence of subsequent proposers known {N} blocks ahead of time!

@cmwaters
Copy link
Contributor

cmwaters commented Jul 7, 2021

Does randomized proposer election become easier with epoch-based validator sets (in terms of achieving fairness)?

@olahouze
Copy link

Hi

The solution "randomized proposer election" is implemented in which version of tundermint?

@cmwaters cmwaters transferred this issue from tendermint/spec Feb 18, 2022
@ValarDragon
Copy link
Contributor

Does randomized proposer election become easier with epoch-based validator sets (in terms of achieving fairness)?

Nope! Its pretty easy to get fairness without epochs in the randomized case. (What you'd do is define a lagged fairness property. e.g. if I get a stake update in block N, I have a fair probability for this in block N + k, for a fixed k.)

This is because using randomness, at block N, you can sample a proposer for height N+k independent of all past samplings, and this sample can be perfectly Uniform wrt the stake distribution at height N.

@github-actions github-actions bot added the stale for use by stalebot label Oct 22, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale for use by stalebot
Projects
None yet
Development

No branches or pull requests

10 participants