-
Notifications
You must be signed in to change notification settings - Fork 40
feat: add support for multiple validators. #1080
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
Changes from 6 commits
8dec6f0
42af559
4305729
257be5b
2d9ee4c
0a7a84f
426c1e8
daed033
fca122a
7627b5c
2d88d6d
a3adbc5
52dee65
5896f93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ defmodule LambdaEthereumConsensus.Beacon.BeaconChain do | |
alias LambdaEthereumConsensus.ForkChoice | ||
alias LambdaEthereumConsensus.P2P.Gossip | ||
alias LambdaEthereumConsensus.StateTransition.Misc | ||
alias LambdaEthereumConsensus.Validator | ||
alias LambdaEthereumConsensus.Validator.ValidatorManager | ||
alias Types.BeaconState | ||
alias Types.Checkpoint | ||
|
||
|
@@ -244,9 +244,11 @@ defmodule LambdaEthereumConsensus.Beacon.BeaconChain do | |
defp notify_subscribers(logical_time) do | ||
log_new_slot(logical_time) | ||
|
||
Enum.each([Validator, Gossip.BeaconBlock], fn subscriber -> | ||
Enum.each([Gossip.BeaconBlock], fn subscriber -> | ||
GenServer.cast(subscriber, {:on_tick, logical_time}) | ||
end) | ||
|
||
ValidatorManager.notify_tick(logical_time) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. breaking the pattern here... ValidatorManager is not a genserver so it can't receive cast messages There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional and low priority, but if you want consistency, you can add a |
||
end | ||
|
||
defp log_new_slot({slot, :first_third}) do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,8 +202,16 @@ defmodule LambdaEthereumConsensus.Validator.BlockBuilder do | |
end | ||
|
||
defp get_finalized_block_hash(state) do | ||
finalized_block = Blocks.get_block!(state.finalized_checkpoint.root) | ||
finalized_hash = finalized_block.body.execution_payload.block_hash | ||
finalized_root = state.finalized_checkpoint.root | ||
|
||
finalized_hash = | ||
if finalized_root == <<0::256>> do | ||
<<0::256>> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dealing with the case where there is not finalized block yet https://github.com/ethereum/execution-apis/blob/main/src/engine/paris.md#forkchoicestatev1
|
||
else | ||
finalized_block = Blocks.get_block!(state.finalized_checkpoint.root) | ||
finalized_block.body.execution_payload.block_hash | ||
end | ||
|
||
{:ok, finalized_hash} | ||
end | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.