From 9ba09252d75d5cae5c10774222e06cd3f50c6437 Mon Sep 17 00:00:00 2001 From: avilagaston9 Date: Mon, 12 Aug 2024 17:07:40 -0300 Subject: [PATCH] refactor: remove tuple in Validator.new() --- lib/lambda_ethereum_consensus/validator/setup.ex | 2 +- lib/lambda_ethereum_consensus/validator/validator.ex | 4 ++-- lib/libp2p_port.ex | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/lambda_ethereum_consensus/validator/setup.ex b/lib/lambda_ethereum_consensus/validator/setup.ex index 6c09f9670..1260f2379 100644 --- a/lib/lambda_ethereum_consensus/validator/setup.ex +++ b/lib/lambda_ethereum_consensus/validator/setup.ex @@ -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() diff --git a/lib/lambda_ethereum_consensus/validator/validator.ex b/lib/lambda_ethereum_consensus/validator/validator.ex index d4e14b183..4884121d5 100644 --- a/lib/lambda_ethereum_consensus/validator/validator.ex +++ b/lib/lambda_ethereum_consensus/validator/validator.ex @@ -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), diff --git a/lib/libp2p_port.ex b/lib/libp2p_port.ex index a0ad485bb..5bb7a8743 100644 --- a/lib/libp2p_port.ex +++ b/lib/libp2p_port.ex @@ -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)}."