Skip to content

Commit

Permalink
refactor: remove tuple in Validator.new()
Browse files Browse the repository at this point in the history
  • Loading branch information
avilagaston9 committed Aug 12, 2024
1 parent c0478ab commit 9ba0925
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/lambda_ethereum_consensus/validator/setup.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ defmodule LambdaEthereumConsensus.Validator.Setup do
validators =
validator_keystores
|> Enum.map(fn keystore ->
{keystore.pubkey, Validator.new({slot, head_root, keystore})}
{keystore.pubkey, Validator.new(slot, head_root, keystore)}
end)
|> Map.new()

Expand Down
4 changes: 2 additions & 2 deletions lib/lambda_ethereum_consensus/validator/validator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ defmodule LambdaEthereumConsensus.Validator do
payload_builder: {Types.slot(), Types.root(), BlockBuilder.payload_id()} | nil
}

@spec new({Types.slot(), Types.root(), Keystore.t()}) :: state()
def new({head_slot, head_root, keystore}) do
@spec new(Types.slot(), Types.root(), Keystore.t()) :: state()
def new(head_slot, head_root, keystore) do
state = %__MODULE__{
slot: head_slot,
epoch: Misc.compute_epoch_at_slot(head_slot),
Expand Down
2 changes: 1 addition & 1 deletion lib/libp2p_port.ex
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ defmodule LambdaEthereumConsensus.Libp2pPort do
def handle_call({:add_validator, keystore}, _from, %{validators: validators} = state) do
# TODO (#1263): handle 0 validators
first_validator = validators |> Map.values() |> List.first()
validator = Validator.new({first_validator.slot, first_validator.root, keystore})
validator = Validator.new(first_validator.slot, first_validator.root, keystore)

Logger.warning(
"[Libp2pPort] Adding validator with index #{inspect(validator.index)}. head_slot: #{inspect(validator.slot)}."
Expand Down

0 comments on commit 9ba0925

Please sign in to comment.