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
Split Alpha into AlphaPreference and AlphaConfidence #2125
Conversation
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.
Where can I find documentation about avalanchego consensus? I'm curious about the different implementations (binary, nnary, flat, etc) and what they are used for.
In general - the only thing that is used from the As for |
@StephenButtolph can you elaborate on the difference between lockstep vs sampled simulations? They seems to represent a synchronous vs asynchronous enviroment but not sure. |
When run in lockstep:
This means that in any given round, the nodes observe the same colors of virtuous nodes. This was meant to behave as if all the nodes are very equal and there is some (constant) network delay. When running by sampling nodes:
This is why the last graph |
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.
nits and possibly a type in a UT. Still looking at this.
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.
lgtm
just nits to make sure I understand the test changes :)
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.
lgtm
Lgtm 🫡 |
commit 188f2b2 Author: David Boehm <91908103+dboehm-avalabs@users.noreply.github.com> Date: Mon Oct 16 13:10:00 2023 -0400 MerkleDB Reduce buffer creation/memcopy on path construction (#2124) Co-authored-by: Dan Laine <daniel.laine@avalabs.org> commit 9d44ec2 Author: Alberto Benegiamo <alberto.benegiamo@gmail.com> Date: Mon Oct 16 08:53:59 2023 -0700 Validator Diffs: docs and UTs cleanup (#2037) Co-authored-by: Stephen Buttolph <stephen@avalabs.org> commit 50f131e Author: Patrick O'Grady <prohb125@gmail.com> Date: Thu Oct 12 23:04:02 2023 -0700 [x/merkledb] `Prefetcher` interface (#2167) commit 007f98d Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu Oct 12 22:33:23 2023 -0700 Bump google.golang.org/grpc from 1.55.0 to 1.58.3 (#2159) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Stephen Buttolph <stephen@avalabs.org> commit 8d2c4f2 Author: Stephen Buttolph <stephen@avalabs.org> Date: Thu Oct 12 19:44:04 2023 -0400 Use set.Of rather than set.Add (#2164) commit 9da2e62 Author: Stephen Buttolph <stephen@avalabs.org> Date: Thu Oct 12 17:41:27 2023 -0400 Remove context lock from API VM interface (#2165) commit 9dbf82a Author: Stephen Buttolph <stephen@avalabs.org> Date: Wed Oct 11 19:48:54 2023 -0400 Remove write lock option from the avm rpc API (#2156) commit 2eb6e84 Author: Stephen Buttolph <stephen@avalabs.org> Date: Wed Oct 11 19:39:44 2023 -0400 Remove write lock option from the platformvm API (#2157) commit 9725095 Author: Dhruba Basu <7675102+dhrubabasu@users.noreply.github.com> Date: Wed Oct 11 14:12:29 2023 -0700 Remove aliasing of `math` standard lib (#2163) commit 18fbdef Author: Stephen Buttolph <stephen@avalabs.org> Date: Wed Oct 11 16:57:11 2023 -0400 Remove lock options from the admin API (#2150) commit aae7260 Author: Stephen Buttolph <stephen@avalabs.org> Date: Wed Oct 11 16:56:13 2023 -0400 Remove lock options from the IPCs api (#2151) commit 8247f74 Author: Stephen Buttolph <stephen@avalabs.org> Date: Wed Oct 11 16:56:05 2023 -0400 Remove write lock option from the xsvm API (#2152) commit 1bc63d4 Author: Dhruba Basu <7675102+dhrubabasu@users.noreply.github.com> Date: Wed Oct 11 16:34:12 2023 -0400 Rename `removeSubnetValidatorValidation` to `verifyRemoveSubnetValidatorTx` (#2162) commit 99fc926 Author: Stephen Buttolph <stephen@avalabs.org> Date: Wed Oct 11 12:39:01 2023 -0400 Fix json marshalling of Sets (#2161) commit 0f95f13 Author: Stephen Buttolph <stephen@avalabs.org> Date: Wed Oct 11 11:37:57 2023 -0400 Remove write lock option from the avm wallet API (#2155) commit e6dab5d Author: Stephen Buttolph <stephen@avalabs.org> Date: Wed Oct 11 11:30:41 2023 -0400 Remove write lock option from the avm static API (#2154) commit 7f61fee Author: Stephen Buttolph <stephen@avalabs.org> Date: Tue Oct 10 23:17:17 2023 -0400 Remove lock options from the info api (#2149) commit c50ea11 Author: Stephen Buttolph <stephen@avalabs.org> Date: Tue Oct 10 23:13:19 2023 -0400 Marshal blocks and transactions inside API calls (#2153) commit 0ac1937 Author: kyoshisuki <143475866+kyoshisuki@users.noreply.github.com> Date: Tue Oct 10 20:12:25 2023 -0700 Fix typo in block formation logic documentation (#2158) commit 145dfb0 Author: Stephen Buttolph <stephen@avalabs.org> Date: Tue Oct 10 22:18:27 2023 -0400 Update versions for v1.10.12 (#2139) commit 6d53e51 Author: Stephen Buttolph <stephen@avalabs.org> Date: Fri Oct 6 18:08:15 2023 -0400 Split Alpha into AlphaPreference and AlphaConfidence (#2125) commit 1fc8973 Author: Stephen Buttolph <stephen@avalabs.org> Date: Thu Oct 5 17:50:20 2023 -0400 Add additional payload.Hash examples (#2145) Signed-off-by: Stephen Buttolph <stephen@avalabs.org> Co-authored-by: Dhruba Basu <7675102+dhrubabasu@users.noreply.github.com> Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
In my own simulations, the number of rounds until finalization used to go higher when the underlying stake distribution was weird with no expected mean. See "Law of Large Numbers": 《The average of the results obtained from a large number of trials may fail to converge in some cases. For instance, the average of n results taken from the Cauchy distribution or some Pareto distributions (α<1) will not converge as n becomes larger; the reason is heavy tails.[4] 》 What distribution and parametrization did you assume during the simulations? See my repository if you're interested: |
Background
The Avalanche network uses the Snow* consensus protocols to reach distributed agreement. Specifically, each blockchain runs its own isolated instance of Snowman.
Snowman
Snowman is a multi-decree multivariate chain-based consensus process built from the single-decree binary consensus protocol, Snowball. It runs (potentially many) dependent Snowball protocols concurrently, which form a binary tree with the root being the last accepted Snowball decision.
As an example:
The tree above has 3 processing blocks,
A
,B
, andC
. For simplicity, we'll ignore that blocks can have many conflicts. SinceA
andB
are conflicting there is a Snowball instance that will determine which block to accept. Even thoughC
is built on top ofB
, this does not impact the likelihood ofB
being accepted overA
. The only mechanism that decides betweenA
andB
is the Snowball instance.Snowball
Snowball's goal is to have a network agree on one of two values. Typically, we refer to these values as
Red
andBlue
. This process can itself be broken into 2 primary mechanisms.It's critical that these mechanisms are able to tolerate arbitrary failures. Specifically, nodes reporting incorrect colors, or not reporting any color at all, must not impact network progress.
The existing Snowball specification is:
We can see the two mechanisms at play.
currentColor
by adopting whichever color has had the mostalphaMajority
samples.lastMajorityColor
once it seesβ
consecutive samples wherelastMajorityColor
had analphaMajority
.Snowball Simulation
With this specification, we can run simulations on how many rounds of sampling it takes for the network to finalize.
Parameters:
The network is initialized with
125 Red
and125 Blue
nodes. Nodes perform sampling in lockstep.For small values of
α
, the majority of the sampling time is done to trigger the finalization mechanism. The finalization detector requires at leastβ = 30
rounds until termination. However, asα
increases, the number of rounds increases significantly higher thanβ
. This is because the color selection mechanism becomes less aggressive asα
increases towardsK
.This is a major reason why
α = 15
andK = 20
are the current Mainnet consensus parameters.When nodes are randomly selected to perform the sampling, versus in lockstep, the average rounds until termination decreases.
However, the growth pattern is similar as
α
increases.Conflicting Optimization
As the above graph shows, increasing
α
can significantly increase the required rounds until termination. This is because having a highα
can take an extended amount of time for nodes to adopt the majority color. However, increasingα
is often desirable to increase the safety of the decision.Increasing
α
trades off performance for safety.Suggested change
Snowball's color selection and finalization detection mechanisms should be better separated. Specifically, the usage of
α
in the Snowball specification should be modified to have two values:alphaPreference
andalphaConfidence
.It is required that
alphaPreference <= alphaConfidence
.The updated Snowball specification would be:
Updated Snowball Simulation
Parameters:
The network is initialized with
125 Red
and125 Blue
nodes.Nodes performing sampling in lockstep:
Sampling which node to perform the sampling:
These simulations show that keeping
alphaPreference
constant while increasingalphaConfidence
increases the rounds until termination significantly less than increasingα
in the current protocol specification.Safety Impact
While modifying the color selection does impact the safety analysis, the impact is not expected to be significant.
As a simple argument for why safety shouldn't be drastically impacted, consider the case that one virtuous node has accepted
Red
. If byzantine nodes switching their color toBlue
caused polls to see moreBlue
thanRed
, safety will eventually be violated. This is because eventually nodes will switch their preferences, except for the one node that has acceptedRed
, toBlue
. Once enough nodes have updated their preferences toBlue
, another virtuous node may acceptBlue
. Notice that this is independent ofα
.α
in this situation only impacts the speed at which such a failure would occur.The actual impact on the safety analysis is due to the variance in sampling. Larger
α
values protect more against unlikely samples of a disproportionate number of byzantine nodes. Before modifying the default consensus parameters, this should be included in the formal safety analysis.Additionally, this change can unblock using a larger
alphaConfidence
than currently configured without significantly degrading performance.Why this should be merged
alphaPreference
is set to a different value thanalphaConfidence
. Changing the default value of these parameters is left to a future proposal.How this was tested