-
Notifications
You must be signed in to change notification settings - Fork 11
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: add hyperchain sync support #2035
Conversation
1951016
to
15807cd
Compare
412f376
to
aad3a62
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.
Minor comments, rest is looking good to me!
lib/ae_mdw/stats.ex
Outdated
@@ -162,7 +162,7 @@ defmodule AeMdw.Stats do | |||
|
|||
Map.put(stats, :validators_count, validators_count) | |||
else | |||
Model.stat(payload: miners_count) = | |||
{:ok, Model.stat(payload: miners_count)} = |
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.
Can we use fetch!
here instead?
lib/ae_mdw/node.ex
Outdated
@@ -345,6 +346,16 @@ defmodule AeMdw.Node do | |||
|> MapSet.new() | |||
end | |||
|
|||
@spec epoch_start_height(epoch()) :: {:ok, height()} | {:error, atom()} | |||
defmemo epoch_start_height(epoch) do |
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.
Do we want to memoize these? they will accumulate in memory as we call them
lib/ae_mdw/sync/hyperchain.ex
Outdated
|
||
first | ||
|> Stream.iterate(fn x -> x + 1 end) | ||
|> Enum.zip(schedule) |
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.
Enum.with_index(schedule, first)
microblocks keyblock
This reverts commit f2a52cf.
aa20056
to
f4fddae
Compare
This reverts commit 74e098d.
--------- Co-authored-by: Valentin Atanasov <[email protected]>
--------- Co-authored-by: Valentin Atanasov <[email protected]>
BEGIN_COMMIT_OVERRIDE
feat: add hyperchain sync support
END_COMMIT_OVERRIDE
The hyperchains implementation in the node reverses the way key and microblocks are ordered. This is only done for hyperchains.
The current way is that there is a keyblock followed by all of it's microblocks until a new keyblock is produced, where after it are it's microblocks. The breaking change here is that in hc the microblocks come first followed by the keyblock they belong to. This resulted in the mdw creating sync mutations for key blocks at height N with the microblocks inside them for the next keyblock N+1.