onflow / flow-go

A fast, secure, and developer-friendly blockchain built to support the next generation of games, apps, and the digital assets that power them.
GNU Affero General Public License v3.0
531 stars 176 forks source link

Tuning Flow's Block Rate #5302

Closed AlexHentschel closed 4 months ago

AlexHentschel commented 8 months ago

Context

In a long-running work, Tarak has replaced the previously used relic cryptography library with BLST. As a result we are seeing notable block-rate increases in model networks. At the moment, it is unclear to which extend these speedups translate to Flow mainnet. Nevertheless, we should see this as an opportunity for improving mainnet performance.

Overview of required work

Step 1: Determine block delay that Cruise control injects before the HCU (using the prior relic crypto stack)

This can be done using the consensus telemetry:

We can collect the needed data from the Consensus Telemetry via the following Loki query:

{network="mainnet24", app="consensus"} |= "\"component\":\"hotstuff.telemetry\"" |= "OnOwnProposal"

We can use the logging time stamp as an accurate approximator for the time when the MessageHub receives the proposal. Hence, the temporal delay $d$ that the MessageHub waits before broadcasting is $$d = \max (\texttt{targetPublicationTime} - \texttt{time}, 0)$$ The $\max$ function is important, because the targetPublicationTime might be earlier than the current time. In this case, the MessageHub broadcasts immediately, i.e. $d$ is zero.

Step 2: Determine block delay that Cruise control injects after the HCU (using BLST crypto stack)

Step 3: Data analysis

see Cruise-Control headroom for speedups (notion)

Step 4: Adjust number of views per Epoch in system smart contract controlling Epoch

see Cruise-Control headroom for speedups (notion) for details how to compute the number of views $V'$ that we can maximally choose without reducing the temporal buffer to compensate for slow or offline nodes below the current buffer with the relic stack.

AlexHentschel commented 6 months ago

for updates on this work, see the Core Protocol Working Group: Tuning Flow's Main Consensus. For the technically detailed analysis, please see our Proposed parameter setting (notion)

AlexHentschel commented 4 months ago

all work has been merged and is in the process of being tested on previewnet