diff --git a/lib/beacon_api/utils.ex b/lib/beacon_api/utils.ex index afe444141..cd7e2ab63 100644 --- a/lib/beacon_api/utils.ex +++ b/lib/beacon_api/utils.ex @@ -4,14 +4,6 @@ defmodule BeaconApi.Utils do """ alias LambdaEthereumConsensus.ForkChoice.Helpers - @doc """ - Checks if the value is 32 bytes and starting with "0x" - """ - @spec is_bytes32?(binary) :: boolean - def is_bytes32?(value) when is_binary(value) do - String.starts_with?(value, "0x") and byte_size(value) == 66 - end - @spec parse_id(binary) :: Helpers.block_id() def parse_id("genesis"), do: :genesis def parse_id("justified"), do: :justified diff --git a/lib/lambda_ethereum_consensus/beacon/pending_blocks.ex b/lib/lambda_ethereum_consensus/beacon/pending_blocks.ex index 8e23547bd..4d8abb8d3 100644 --- a/lib/lambda_ethereum_consensus/beacon/pending_blocks.ex +++ b/lib/lambda_ethereum_consensus/beacon/pending_blocks.ex @@ -31,9 +31,9 @@ defmodule LambdaEthereumConsensus.Beacon.PendingBlocks do GenServer.cast(__MODULE__, {:add_block, signed_block}) end - @spec is_pending_block(Types.root()) :: boolean() - def is_pending_block(block_root) do - GenServer.call(__MODULE__, {:is_pending_block, block_root}) + @spec pending_block?(Types.root()) :: boolean() + def pending_block?(block_root) do + GenServer.call(__MODULE__, {:pending_block?, block_root}) end ########################## @@ -56,7 +56,7 @@ defmodule LambdaEthereumConsensus.Beacon.PendingBlocks do end @impl true - def handle_call({:is_pending_block, block_root}, _from, state) do + def handle_call({:pending_block?, block_root}, _from, state) do {:reply, Map.has_key?(state.pending_blocks, block_root), state} end diff --git a/lib/lambda_ethereum_consensus/fork_choice/handlers.ex b/lib/lambda_ethereum_consensus/fork_choice/handlers.ex index 04cd81f3f..cb211bdc2 100644 --- a/lib/lambda_ethereum_consensus/fork_choice/handlers.ex +++ b/lib/lambda_ethereum_consensus/fork_choice/handlers.ex @@ -116,7 +116,7 @@ defmodule LambdaEthereumConsensus.ForkChoice.Handlers do end defp check_valid_indexed_attestation(target_state, indexed_attestation) do - if Predicates.is_valid_indexed_attestation(target_state, indexed_attestation), + if Predicates.valid_indexed_attestation?(target_state, indexed_attestation), do: :ok, else: {:error, "invalid indexed attestation"} end @@ -137,13 +137,13 @@ defmodule LambdaEthereumConsensus.ForkChoice.Handlers do state = BlockStates.get_state!(store.justified_checkpoint.root) cond do - not Predicates.is_slashable_attestation_data(attestation_1.data, attestation_2.data) -> + not Predicates.slashable_attestation_data?(attestation_1.data, attestation_2.data) -> {:error, "attestation is not slashable"} - not Predicates.is_valid_indexed_attestation(state, attestation_1) -> + not Predicates.valid_indexed_attestation?(state, attestation_1) -> {:error, "attestation 1 is not valid"} - not Predicates.is_valid_indexed_attestation(state, attestation_2) -> + not Predicates.valid_indexed_attestation?(state, attestation_2) -> {:error, "attestation 2 is not valid"} true -> diff --git a/lib/lambda_ethereum_consensus/fork_choice/helpers.ex b/lib/lambda_ethereum_consensus/fork_choice/helpers.ex index 1a2d6161e..5dd45bce7 100644 --- a/lib/lambda_ethereum_consensus/fork_choice/helpers.ex +++ b/lib/lambda_ethereum_consensus/fork_choice/helpers.ex @@ -128,7 +128,7 @@ defmodule LambdaEthereumConsensus.ForkChoice.Helpers do # If the previous epoch is justified, the block should be pulled-up. In this case, check that unrealized # justification is higher than the store and that the voting source is not more than two epochs ago correct_justified = - if not correct_justified and is_previous_epoch_justified(store) do + if not correct_justified and previous_epoch_justified?(store) do store.unrealized_justifications[block_root].epoch >= store.justified_checkpoint.epoch and voting_source.epoch + 2 >= current_epoch else @@ -171,7 +171,7 @@ defmodule LambdaEthereumConsensus.ForkChoice.Helpers do end end - def is_previous_epoch_justified(%Store{} = store) do + def previous_epoch_justified?(%Store{} = store) do current_slot = Store.get_current_slot(store) current_epoch = Misc.compute_epoch_at_slot(current_slot) store.justified_checkpoint.epoch + 1 == current_epoch diff --git a/lib/lambda_ethereum_consensus/state_transition/accessors.ex b/lib/lambda_ethereum_consensus/state_transition/accessors.ex index 387c11af8..f61453847 100644 --- a/lib/lambda_ethereum_consensus/state_transition/accessors.ex +++ b/lib/lambda_ethereum_consensus/state_transition/accessors.ex @@ -110,7 +110,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Accessors do compute_fn = fn -> validators |> Aja.Vector.with_index() - |> Aja.Vector.filter(fn {v, _} -> Predicates.is_active_validator(v, epoch) end) + |> Aja.Vector.filter(fn {v, _} -> Predicates.active_validator?(v, epoch) end) |> Aja.Vector.map(fn {_, index} -> index end) end @@ -160,7 +160,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Accessors do participating_indices = state.validators |> Aja.Vector.zip_with(epoch_participation, fn v, participation -> - not v.slashed and Predicates.is_active_validator(v, epoch) and + not v.slashed and Predicates.active_validator?(v, epoch) and Predicates.has_flag(participation, flag_index) end) |> Aja.Vector.with_index() @@ -194,7 +194,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Accessors do Cache.lazily_compute(:total_active_balance, {epoch, root}, fn -> state.validators - |> Stream.filter(&Predicates.is_active_validator(&1, epoch)) + |> Stream.filter(&Predicates.active_validator?(&1, epoch)) |> Stream.map(fn %Validator{effective_balance: effective_balance} -> effective_balance end) |> Enum.sum() |> max(ChainSpec.get("EFFECTIVE_BALANCE_INCREMENT")) @@ -232,7 +232,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Accessors do validators |> Stream.with_index() |> Stream.filter(fn {validator, _index} -> - Predicates.is_eligible_validator(validator, previous_epoch) + Predicates.eligible_validator?(validator, previous_epoch) end) |> Stream.map(fn {_validator, index} -> index end) |> Enum.to_list() @@ -284,7 +284,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Accessors do @spec get_active_validator_count(BeaconState.t(), Types.epoch()) :: Types.uint64() def get_active_validator_count(%BeaconState{} = state, epoch) do Cache.lazily_compute(:active_validator_count, {epoch, get_state_epoch_root(state)}, fn -> - Aja.Enum.count(state.validators, &Predicates.is_active_validator(&1, epoch)) + Aja.Enum.count(state.validators, &Predicates.active_validator?(&1, epoch)) end) end diff --git a/lib/lambda_ethereum_consensus/state_transition/epoch_processing.ex b/lib/lambda_ethereum_consensus/state_transition/epoch_processing.ex index a8b82afe5..95a458a90 100644 --- a/lib/lambda_ethereum_consensus/state_transition/epoch_processing.ex +++ b/lib/lambda_ethereum_consensus/state_transition/epoch_processing.ex @@ -145,8 +145,8 @@ defmodule LambdaEthereumConsensus.StateTransition.EpochProcessing do validators |> Stream.with_index() |> Stream.map(fn {v, i} -> - {{v, i}, Predicates.is_eligible_for_activation_queue(v), - Predicates.is_active_validator(v, current_epoch) and + {{v, i}, Predicates.eligible_for_activation_queue?(v), + Predicates.active_validator?(v, current_epoch) and v.effective_balance <= ejection_balance} end) |> Stream.filter(&(elem(&1, 1) or elem(&1, 2))) @@ -163,7 +163,7 @@ defmodule LambdaEthereumConsensus.StateTransition.EpochProcessing do with {:ok, new_state} <- result do new_state.validators |> Stream.with_index() - |> Stream.filter(fn {v, _} -> Predicates.is_eligible_for_activation(state, v) end) + |> Stream.filter(fn {v, _} -> Predicates.eligible_for_activation?(state, v) end) |> Enum.sort_by(fn {%{activation_eligibility_epoch: ep}, i} -> {ep, i} end) |> Enum.slice(0..(churn_limit - 1)) |> Enum.reduce(new_state.validators, fn {v, i}, acc -> @@ -223,13 +223,13 @@ defmodule LambdaEthereumConsensus.StateTransition.EpochProcessing do {:ok, unslashed_participating_indices} = Accessors.get_unslashed_participating_indices(state, timely_target_index, previous_epoch) - state_is_in_inactivity_leak = Predicates.is_in_inactivity_leak(state) + state_in_inactivity_leak? = Predicates.in_inactivity_leak?(state) state.inactivity_scores |> Stream.zip(state.validators) |> Stream.with_index() |> Enum.map(fn {{inactivity_score, validator}, index} -> - if Predicates.is_eligible_validator(validator, previous_epoch) do + if Predicates.eligible_validator?(validator, previous_epoch) do inactivity_score |> Misc.increase_inactivity_score( index, @@ -237,7 +237,7 @@ defmodule LambdaEthereumConsensus.StateTransition.EpochProcessing do inactivity_score_bias ) |> Misc.decrease_inactivity_score( - state_is_in_inactivity_leak, + state_in_inactivity_leak?, inactivity_score_recovery_rate ) else @@ -323,7 +323,7 @@ defmodule LambdaEthereumConsensus.StateTransition.EpochProcessing do state.validators |> Aja.Vector.zip_with(epoch_participation, fn v, participation -> - {not v.slashed and Predicates.is_active_validator(v, epoch) and + {not v.slashed and Predicates.active_validator?(v, epoch) and Predicates.has_flag(participation, flag_index), v.effective_balance} end) |> Aja.Vector.filter(&elem(&1, 0)) diff --git a/lib/lambda_ethereum_consensus/state_transition/operations.ex b/lib/lambda_ethereum_consensus/state_transition/operations.ex index 17b8d43b1..0ed6df789 100644 --- a/lib/lambda_ethereum_consensus/state_transition/operations.ex +++ b/lib/lambda_ethereum_consensus/state_transition/operations.ex @@ -223,7 +223,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Operations do ) do cond do # Verify consistency of the parent hash with respect to the previous execution payload header - Types.BeaconState.is_merge_transition_complete(state) and + Types.BeaconState.merge_transition_complete?(state) and payload.parent_hash != state.latest_execution_payload_header.block_hash -> {:error, "Inconsistency in parent hash"} @@ -364,10 +364,10 @@ defmodule LambdaEthereumConsensus.StateTransition.Operations do |> Stream.take(bound) |> Stream.map(fn {{validator, balance}, index} -> cond do - Validator.is_fully_withdrawable_validator(validator, balance, epoch) -> + Validator.fully_withdrawable_validator?(validator, balance, epoch) -> {validator, balance, index} - Validator.is_partially_withdrawable_validator(validator, balance) -> + Validator.partially_withdrawable_validator?(validator, balance) -> {validator, balance - max_effective_balance, index} true -> @@ -400,7 +400,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Operations do proposer = state.validators[header_1.proposer_index] cond do - not Predicates.is_indices_available(validators_size, [header_1.proposer_index]) -> + not Predicates.indices_available?(validators_size, [header_1.proposer_index]) -> {:error, "Too high index"} not (header_1.slot == header_2.slot) -> @@ -412,7 +412,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Operations do not (header_1 != header_2) -> {:error, "Headers are same"} - not Predicates.is_slashable_validator(proposer, Accessors.get_current_epoch(state)) -> + not Predicates.slashable_validator?(proposer, Accessors.get_current_epoch(state)) -> {:error, "Proposer is not slashable"} not ([proposer_slashing.signed_header_1, proposer_slashing.signed_header_2] @@ -458,7 +458,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Operations do {:ok, BeaconState.t()} | {:error, String.t()} def process_deposit(state, deposit) do with {:ok, deposit_data_root} <- Ssz.hash_tree_root(deposit.data) do - if Predicates.is_valid_merkle_branch?( + if Predicates.valid_merkle_branch?( deposit_data_root, deposit.proof, Constants.deposit_contract_tree_depth() + 1, @@ -487,19 +487,19 @@ defmodule LambdaEthereumConsensus.StateTransition.Operations do validator_size = Aja.Vector.size(state.validators) cond do - not Predicates.is_slashable_attestation_data(attestation_1.data, attestation_2.data) -> + not Predicates.slashable_attestation_data?(attestation_1.data, attestation_2.data) -> {:error, "Attestation data is not slashable"} - not Predicates.is_valid_indexed_attestation(state, attestation_1) -> + not Predicates.valid_indexed_attestation?(state, attestation_1) -> {:error, "Attestation 1 is not valid"} - not Predicates.is_valid_indexed_attestation(state, attestation_2) -> + not Predicates.valid_indexed_attestation?(state, attestation_2) -> {:error, "Attestation 2 is not valid"} - not Predicates.is_indices_available(validator_size, attestation_1.attesting_indices) -> + not Predicates.indices_available?(validator_size, attestation_1.attesting_indices) -> {:error, "Index too high attestation 1"} - not Predicates.is_indices_available(validator_size, attestation_2.attesting_indices) -> + not Predicates.indices_available?(validator_size, attestation_2.attesting_indices) -> {:error, "Index too high attestation 2"} true -> @@ -521,7 +521,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Operations do defp slash_validator(slashed_any, state, i) do if Aja.Vector.at!(state.validators, i) - |> Predicates.is_slashable_validator(Accessors.get_current_epoch(state)) do + |> Predicates.slashable_validator?(Accessors.get_current_epoch(state)) do case Mutators.slash_validator(state, i) do {:ok, state} -> {:cont, {true, state}} {:error, _msg} -> {:halt, {false, nil}} @@ -542,10 +542,10 @@ defmodule LambdaEthereumConsensus.StateTransition.Operations do validator = state.validators[validator_index] cond do - not Predicates.is_indices_available(Aja.Vector.size(state.validators), [validator_index]) -> + not Predicates.indices_available?(Aja.Vector.size(state.validators), [validator_index]) -> {:error, "Too high index"} - not Predicates.is_active_validator(validator, Accessors.get_current_epoch(state)) -> + not Predicates.active_validator?(validator, Accessors.get_current_epoch(state)) -> {:error, "Validator isn't active"} validator.exit_epoch != Constants.far_future_epoch() -> @@ -860,7 +860,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Operations do end defp check_valid_indexed_attestation(state, indexed_attestation) do - if Predicates.is_valid_indexed_attestation(state, indexed_attestation) do + if Predicates.valid_indexed_attestation?(state, indexed_attestation) do :ok else {:error, "Invalid signature"} diff --git a/lib/lambda_ethereum_consensus/state_transition/predicates.ex b/lib/lambda_ethereum_consensus/state_transition/predicates.ex index 0f59cbd39..ef8ca55c2 100644 --- a/lib/lambda_ethereum_consensus/state_transition/predicates.ex +++ b/lib/lambda_ethereum_consensus/state_transition/predicates.ex @@ -13,8 +13,8 @@ defmodule LambdaEthereumConsensus.StateTransition.Predicates do @doc """ Check if ``validator`` is active. """ - @spec is_active_validator(Validator.t(), Types.epoch()) :: boolean - def is_active_validator( + @spec active_validator?(Validator.t(), Types.epoch()) :: boolean + def active_validator?( %Validator{activation_epoch: activation_epoch, exit_epoch: exit_epoch}, epoch ) do @@ -24,9 +24,9 @@ defmodule LambdaEthereumConsensus.StateTransition.Predicates do @doc """ Check if ``validator`` is eligible for rewards and penalties. """ - @spec is_eligible_validator(Validator.t(), Types.epoch()) :: boolean - def is_eligible_validator(%Validator{} = validator, previous_epoch) do - is_active_validator(validator, previous_epoch) || + @spec eligible_validator?(Validator.t(), Types.epoch()) :: boolean + def eligible_validator?(%Validator{} = validator, previous_epoch) do + active_validator?(validator, previous_epoch) || (validator.slashed && previous_epoch + 1 < validator.withdrawable_epoch) end @@ -34,8 +34,8 @@ defmodule LambdaEthereumConsensus.StateTransition.Predicates do If the beacon chain has not managed to finalise a checkpoint for MIN_EPOCHS_TO_INACTIVITY_PENALTY epochs Check if ``validator`` is eligible to be placed into the activation queue. """ - @spec is_eligible_for_activation_queue(Validator.t()) :: boolean - def is_eligible_for_activation_queue(%Validator{} = validator) do + @spec eligible_for_activation_queue?(Validator.t()) :: boolean + def eligible_for_activation_queue?(%Validator{} = validator) do far_future_epoch = Constants.far_future_epoch() max_effective_balance = ChainSpec.get("MAX_EFFECTIVE_BALANCE") @@ -46,8 +46,8 @@ defmodule LambdaEthereumConsensus.StateTransition.Predicates do @doc """ Check if ``validator`` is eligible for activation. """ - @spec is_eligible_for_activation(BeaconState.t(), Validator.t()) :: boolean - def is_eligible_for_activation(%BeaconState{} = state, %Validator{} = validator) do + @spec eligible_for_activation?(BeaconState.t(), Validator.t()) :: boolean + def eligible_for_activation?(%BeaconState{} = state, %Validator{} = validator) do far_future_epoch = Constants.far_future_epoch() validator.activation_eligibility_epoch <= state.finalized_checkpoint.epoch && @@ -58,8 +58,8 @@ defmodule LambdaEthereumConsensus.StateTransition.Predicates do If the beacon chain has not managed to finalise a checkpoint for MIN_EPOCHS_TO_INACTIVITY_PENALTY epochs (that is, four epochs), then the chain enters the inactivity leak. """ - @spec is_in_inactivity_leak(BeaconState.t()) :: boolean - def is_in_inactivity_leak(%BeaconState{} = state) do + @spec in_inactivity_leak?(BeaconState.t()) :: boolean + def in_inactivity_leak?(%BeaconState{} = state) do min_epochs_to_inactivity_penalty = ChainSpec.get("MIN_EPOCHS_TO_INACTIVITY_PENALTY") Accessors.get_finality_delay(state) > min_epochs_to_inactivity_penalty end @@ -76,9 +76,9 @@ defmodule LambdaEthereumConsensus.StateTransition.Predicates do @doc """ Check if ``data_1`` and ``data_2`` are slashable according to Casper FFG rules. """ - @spec is_slashable_attestation_data(Types.AttestationData.t(), Types.AttestationData.t()) :: + @spec slashable_attestation_data?(Types.AttestationData.t(), Types.AttestationData.t()) :: boolean - def is_slashable_attestation_data(data_1, data_2) do + def slashable_attestation_data?(data_1, data_2) do (data_1 != data_2 and data_1.target.epoch == data_2.target.epoch) or (data_1.source.epoch < data_2.source.epoch and data_2.target.epoch < data_1.target.epoch) end @@ -86,8 +86,8 @@ defmodule LambdaEthereumConsensus.StateTransition.Predicates do @doc """ Check if ``validator`` is slashable. """ - @spec is_slashable_validator(Validator.t(), Types.epoch()) :: boolean - def is_slashable_validator(validator, epoch) do + @spec slashable_validator?(Validator.t(), Types.epoch()) :: boolean + def slashable_validator?(validator, epoch) do not validator.slashed and (validator.activation_epoch <= epoch and epoch < validator.withdrawable_epoch) end @@ -95,34 +95,34 @@ defmodule LambdaEthereumConsensus.StateTransition.Predicates do @doc """ Check if slashing attestation indices are in range of validators. """ - @spec is_indices_available(any(), list(Types.validator_index())) :: boolean - def is_indices_available(validators, indices) do - is_indices_available(validators, indices, true) + @spec indices_available?(any(), list(Types.validator_index())) :: boolean + def indices_available?(validators, indices) do + indices_available?(validators, indices, true) end - defp is_indices_available(_validators, [], true) do + defp indices_available?(_validators, [], true) do true end - defp is_indices_available(_validators, _indices, false) do + defp indices_available?(_validators, _indices, false) do false end - defp is_indices_available(validators, [h | indices], _acc) do - is_indices_available(validators, indices, h < validators) + defp indices_available?(validators, [h | indices], _acc) do + indices_available?(validators, indices, h < validators) end @doc """ Check if merkle branch is valid """ - @spec is_valid_merkle_branch?( + @spec valid_merkle_branch?( Types.bytes32(), list(Types.bytes32()), Types.uint64(), Types.uint64(), Types.root() ) :: boolean - def is_valid_merkle_branch?(leaf, branch, depth, index, root) do + def valid_merkle_branch?(leaf, branch, depth, index, root) do root == generate_merkle_proof(leaf, branch, depth, index) end @@ -144,8 +144,8 @@ defmodule LambdaEthereumConsensus.StateTransition.Predicates do @doc """ Check if ``indexed_attestation`` is not empty, has sorted and unique indices and has a valid aggregate signature. """ - @spec is_valid_indexed_attestation(BeaconState.t(), Types.IndexedAttestation.t()) :: boolean - def is_valid_indexed_attestation(state, indexed_attestation) do + @spec valid_indexed_attestation?(BeaconState.t(), Types.IndexedAttestation.t()) :: boolean + def valid_indexed_attestation?(state, indexed_attestation) do indices = indexed_attestation.attesting_indices if Enum.empty?(indices) or not uniq_and_sorted?(indices) do diff --git a/lib/types/beacon_chain/beacon_state.ex b/lib/types/beacon_chain/beacon_state.ex index 22af8d019..4aba67047 100644 --- a/lib/types/beacon_chain/beacon_state.ex +++ b/lib/types/beacon_chain/beacon_state.ex @@ -127,8 +127,8 @@ defmodule Types.BeaconState do @doc """ Checks if state is pre or post merge """ - @spec is_merge_transition_complete(t()) :: boolean() - def is_merge_transition_complete(state) do + @spec merge_transition_complete?(t()) :: boolean() + def merge_transition_complete?(state) do state.latest_execution_payload_header != struct(Types.ExecutionPayload, Types.ExecutionPayloadHeader.default()) end @@ -180,7 +180,7 @@ defmodule Types.BeaconState do is_unslashed = MapSet.member?(unslashed_participating_indices, index) cond do - is_unslashed and Predicates.is_in_inactivity_leak(state) -> + is_unslashed and Predicates.in_inactivity_leak?(state) -> 0 is_unslashed -> @@ -198,7 +198,7 @@ defmodule Types.BeaconState do state.validators |> Stream.with_index() |> Stream.map(fn {validator, index} -> - if Predicates.is_eligible_validator(validator, previous_epoch), + if Predicates.eligible_validator?(validator, previous_epoch), do: process_reward_and_penalty.(index), else: 0 end) @@ -224,7 +224,7 @@ defmodule Types.BeaconState do |> Stream.zip(state.inactivity_scores) |> Stream.with_index() |> Stream.map(fn {{validator, inactivity_score}, index} -> - if Predicates.is_eligible_validator(validator, previous_epoch) and + if Predicates.eligible_validator?(validator, previous_epoch) and not MapSet.member?(matching_target_indices, index) do penalty_numerator = validator.effective_balance * inactivity_score -div(penalty_numerator, penalty_denominator) diff --git a/lib/types/beacon_chain/validator.ex b/lib/types/beacon_chain/validator.ex index 8052931a2..7a4489111 100644 --- a/lib/types/beacon_chain/validator.ex +++ b/lib/types/beacon_chain/validator.ex @@ -44,9 +44,9 @@ defmodule Types.Validator do @doc """ Check if ``validator`` is fully withdrawable. """ - @spec is_fully_withdrawable_validator(t(), Types.gwei(), Types.epoch()) :: + @spec fully_withdrawable_validator?(t(), Types.gwei(), Types.epoch()) :: boolean - def is_fully_withdrawable_validator( + def fully_withdrawable_validator?( %{withdrawable_epoch: withdrawable_epoch} = validator, balance, epoch @@ -57,8 +57,8 @@ defmodule Types.Validator do @doc """ Check if ``validator`` is partially withdrawable. """ - @spec is_partially_withdrawable_validator(t(), Types.gwei()) :: boolean - def is_partially_withdrawable_validator( + @spec partially_withdrawable_validator?(t(), Types.gwei()) :: boolean + def partially_withdrawable_validator?( %{effective_balance: effective_balance} = validator, balance ) do diff --git a/mix.exs b/mix.exs index 7d511740f..d9112c8f4 100644 --- a/mix.exs +++ b/mix.exs @@ -40,7 +40,7 @@ defmodule LambdaEthereumConsensus.MixProject do {:snappyer, "~> 1.2"}, {:yaml_elixir, "~> 2.8"}, {:timex, "~> 3.7"}, - {:recase, "~> 0.5"}, + {:recase, "~> 0.7"}, {:rexbug, "~> 1.0"}, {:eep, git: "https://github.com/virtan/eep", branch: "master"}, {:protobuf, "~> 0.12.0"}, diff --git a/mix.lock b/mix.lock index 03bc33118..96850f7c9 100644 --- a/mix.lock +++ b/mix.lock @@ -1,17 +1,17 @@ %{ - "aja": {:hex, :aja, "0.6.2", "3eae51bc26dd479ad53b07ec9254bc018ab9b95704db13817df6a1ecf1c817de", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "1f0a1aab112dacec73914b4e30a7215cda6cab7b0fb0adf5472dc3bf227d8b34"}, - "benchee": {:hex, :benchee, "1.2.0", "afd2f0caec06ce3a70d9c91c514c0b58114636db9d83c2dc6bfd416656618353", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "ee729e53217898b8fd30aaad3cce61973dab61574ae6f48229fe7ff42d5e4457"}, + "aja": {:hex, :aja, "0.6.4", "9569d0040a35c5668bee56ce12f90c583ca73fd776e967ee1cba9a5bc797f1e8", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "a865afc944327839fd9bd1b04df78529898fcef0a67ed2d7f7440105fcad9443"}, + "benchee": {:hex, :benchee, "1.3.0", "f64e3b64ad3563fa9838146ddefb2d2f94cf5b473bdfd63f5ca4d0657bf96694", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "34f4294068c11b2bd2ebf2c59aac9c7da26ffa0068afdf3419f1b176e16c5f81"}, "broadway": {:hex, :broadway, "1.0.7", "7808f9e3eb6f53ca6d060f0f9d61012dd8feb0d7a82e62d087dd517b9b66fa53", [:mix], [{:gen_stage, "~> 1.0", [hex: :gen_stage, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.3.7 or ~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "e76cfb0a7d64176c387b8b1ddbfb023e2ee8a63e92f43664d78e6d5d0b1177c6"}, - "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "castore": {:hex, :castore, "1.0.5", "9eeebb394cc9a0f3ae56b813459f990abb0a3dedee1be6b27fdb50301930502f", [:mix], [], "hexpm", "8d7c597c3e4a64c395980882d4bca3cebb8d74197c590dc272cfd3b6a6310578"}, "certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"}, "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"}, "cowboy": {:hex, :cowboy, "2.10.0", "ff9ffeff91dae4ae270dd975642997afe2a1179d94b1887863e43f681a203e26", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "3afdccb7183cc6f143cb14d3cf51fa00e53db9ec80cdcd525482f5e99bc41d6b"}, "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, "cowlib": {:hex, :cowlib, "2.12.1", "a9fa9a625f1d2025fe6b462cb865881329b5caff8f1854d1cbc9f9533f00e1e1", [:make, :rebar3], [], "hexpm", "163b73f6367a7341b33c794c4e88e7dbfe6498ac42dcd69ef44c5bc5507c8db0"}, - "credo": {:hex, :credo, "1.7.1", "6e26bbcc9e22eefbff7e43188e69924e78818e2fe6282487d0703652bc20fd62", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e9871c6095a4c0381c89b6aa98bc6260a8ba6addccf7f6a53da8849c748a58a2"}, + "credo": {:hex, :credo, "1.7.3", "05bb11eaf2f2b8db370ecaa6a6bda2ec49b2acd5e0418bc106b73b07128c0436", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "35ea675a094c934c22fb1dca3696f3c31f2728ae6ef5a53b5d648c11180a4535"}, "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, - "dialyxir": {:hex, :dialyxir, "1.4.2", "764a6e8e7a354f0ba95d58418178d486065ead1f69ad89782817c296d0d746a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "516603d8067b2fd585319e4b13d3674ad4f314a5902ba8130cd97dc902ce6bbd"}, + "dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"}, "eep": {:git, "https://github.com/virtan/eep", "8f6e5e3ade0606390d928830db61350a5451dda8", [branch: "master"]}, "eflambe": {:hex, :eflambe, "0.3.1", "ef0a35084fad1f50744496730a9662782c0a9ebf449d3e03143e23295c5926ea", [:rebar3], [{:meck, "0.9.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "58d5997be606d4e269e9e9705338e055281fdf3e4935cc902c8908e9e4516c5f"}, "eleveldb": {:hex, :eleveldb, "2.2.20", "1fff63a5055bbf4bf821f797ef76065882b193f5e8095f95fcd9287187773b58", [:rebar3], [], "hexpm", "0e67df12ef836a7bcdde9373c59f1ae18b335defd1d66b820d3d4dd7ca1844e2"}, @@ -19,7 +19,7 @@ "ex2ms": {:hex, :ex2ms, "1.6.1", "66d472eb14da43087c156e0396bac3cc7176b4f24590a251db53f84e9a0f5f72", [:mix], [], "hexpm", "a7192899d84af03823a8ec2f306fa858cbcce2c2e7fd0f1c49e05168fb9c740e"}, "exleveldb": {:hex, :exleveldb, "0.14.0", "8e9353bbce38482d6971d254c6b98ceb50f3f179c94732b5d17db1be426fca18", [:mix], [{:eleveldb, "~> 2.2.20", [hex: :eleveldb, repo: "hexpm", optional: false]}], "hexpm", "803cd3b4c826a1e17e7e28f6afe224837a743b475e1a48336f186af3dd8636ad"}, "expo": {:hex, :expo, "0.5.1", "249e826a897cac48f591deba863b26c16682b43711dd15ee86b92f25eafd96d9", [:mix], [], "hexpm", "68a4233b0658a3d12ee00d27d37d856b1ba48607e7ce20fd376958d0ba6ce92b"}, - "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, + "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"}, "gen_stage": {:hex, :gen_stage, "1.2.1", "19d8b5e9a5996d813b8245338a28246307fd8b9c99d1237de199d21efc4c76a1", [:mix], [], "hexpm", "83e8be657fa05b992ffa6ac1e3af6d57aa50aace8f691fcf696ff02f8335b001"}, "gettext": {:hex, :gettext, "0.24.0", "6f4d90ac5f3111673cbefc4ebee96fe5f37a114861ab8c7b7d5b30a1108ce6d8", [:mix], [{:expo, "~> 0.5.1", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "bdf75cdfcbe9e4622dd18e034b227d77dd17f0f133853a1c73b97b3d6c770e8b"}, "hackney": {:hex, :hackney, "1.20.1", "8d97aec62ddddd757d128bfd1df6c5861093419f8f7a4223823537bad5d064e2", [:rebar3], [{:certifi, "~> 2.12.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "fe9094e5f1a2a2c0a7d10918fee36bfec0ec2a979994cff8cfe8058cd9af38e3"}, @@ -33,14 +33,14 @@ "mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"}, "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, "nimble_options": {:hex, :nimble_options, "1.1.0", "3b31a57ede9cb1502071fade751ab0c7b8dbe75a9a4c2b5bbb0943a690b63172", [:mix], [], "hexpm", "8bbbb3941af3ca9acc7835f5655ea062111c9c27bcac53e004460dfd19008a99"}, - "open_api_spex": {:hex, :open_api_spex, "3.18.1", "0a73cd5dbcba7d32952dd9738c6819892933d9bae1642f04c9f200281524dd31", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 3.0 or ~> 4.0 or ~> 5.0", [hex: :poison, repo: "hexpm", optional: true]}, {:ymlr, "~> 2.0 or ~> 3.0 or ~> 4.0", [hex: :ymlr, repo: "hexpm", optional: true]}], "hexpm", "f52933cddecca675e42ead660379ae2d3853f57f5a35d201eaed85e2e81517d1"}, + "open_api_spex": {:hex, :open_api_spex, "3.18.2", "8c855e83bfe8bf81603d919d6e892541eafece3720f34d1700b58024dadde247", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 3.0 or ~> 4.0 or ~> 5.0", [hex: :poison, repo: "hexpm", optional: true]}, {:ymlr, "~> 2.0 or ~> 3.0 or ~> 4.0", [hex: :ymlr, repo: "hexpm", optional: true]}], "hexpm", "aa3e6dcfc0ad6a02596b2172662da21c9dd848dac145ea9e603f54e3d81b8d2b"}, "parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"}, "patch": {:hex, :patch, "0.12.0", "2da8967d382bade20344a3e89d618bfba563b12d4ac93955468e830777f816b0", [:mix], [], "hexpm", "ffd0e9a7f2ad5054f37af84067ee88b1ad337308a1cb227e181e3967127b0235"}, - "phoenix": {:hex, :phoenix, "1.7.10", "02189140a61b2ce85bb633a9b6fd02dff705a5f1596869547aeb2b2b95edd729", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "cf784932e010fd736d656d7fead6a584a4498efefe5b8227e9f383bf15bb79d0"}, + "phoenix": {:hex, :phoenix, "1.7.11", "1d88fc6b05ab0c735b250932c4e6e33bfa1c186f76dcf623d8dd52f07d6379c7", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "b1ec57f2e40316b306708fe59b92a16b9f6f4bf50ccfa41aa8c7feb79e0ec02a"}, "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"}, "phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"}, - "plug": {:hex, :plug, "1.15.2", "94cf1fa375526f30ff8770837cb804798e0045fd97185f0bb9e5fcd858c792a3", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "02731fa0c2dcb03d8d21a1d941bdbbe99c2946c0db098eee31008e04c6283615"}, - "plug_cowboy": {:hex, :plug_cowboy, "2.6.1", "9a3bbfceeb65eff5f39dab529e5cd79137ac36e913c02067dba3963a26efe9b2", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "de36e1a21f451a18b790f37765db198075c25875c64834bcc82d90b309eb6613"}, + "plug": {:hex, :plug, "1.15.3", "712976f504418f6dff0a3e554c40d705a9bcf89a7ccef92fc6a5ef8f16a30a97", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "cc4365a3c010a56af402e0809208873d113e9c38c401cabd88027ef4f5c01fd2"}, + "plug_cowboy": {:hex, :plug_cowboy, "2.7.0", "3ae9369c60641084363b08fe90267cbdd316df57e3557ea522114b30b63256ea", [:mix], [{:cowboy, "~> 2.7.0 or ~> 2.8.0 or ~> 2.9.0 or ~> 2.10.0", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "d85444fb8aa1f2fc62eabe83bbe387d81510d773886774ebdcb429b3da3c1a4a"}, "plug_crypto": {:hex, :plug_crypto, "2.0.0", "77515cc10af06645abbfb5e6ad7a3e9714f805ae118fa1a70205f80d2d70fe73", [:mix], [], "hexpm", "53695bae57cc4e54566d993eb01074e4d894b65a3766f1c43e2c61a1b0f45ea9"}, "protobuf": {:hex, :protobuf, "0.12.0", "58c0dfea5f929b96b5aa54ec02b7130688f09d2de5ddc521d696eec2a015b223", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "75fa6cbf262062073dd51be44dd0ab940500e18386a6c4e87d5819a58964dc45"}, "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, @@ -53,9 +53,9 @@ "statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"}, "stream_data": {:hex, :stream_data, "0.6.0", "e87a9a79d7ec23d10ff83eb025141ef4915eeb09d4491f79e52f2562b73e5f47", [:mix], [], "hexpm", "b92b5031b650ca480ced047578f1d57ea6dd563f5b57464ad274718c9c29501c"}, "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, - "telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"}, + "telemetry_metrics": {:hex, :telemetry_metrics, "0.6.2", "2caabe9344ec17eafe5403304771c3539f3b6e2f7fb6a6f602558c825d0d0bfb", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "9b43db0dc33863930b9ef9d27137e78974756f5f198cae18409970ed6fa5b561"}, "telemetry_metrics_prometheus": {:hex, :telemetry_metrics_prometheus, "1.1.0", "1cc23e932c1ef9aa3b91db257ead31ea58d53229d407e059b29bb962c1505a13", [:mix], [{:plug_cowboy, "~> 2.1", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:telemetry_metrics_prometheus_core, "~> 1.0", [hex: :telemetry_metrics_prometheus_core, repo: "hexpm", optional: false]}], "hexpm", "d43b3659b3244da44fe0275b717701542365d4519b79d9ce895b9719c1ce4d26"}, - "telemetry_metrics_prometheus_core": {:hex, :telemetry_metrics_prometheus_core, "1.1.0", "4e15f6d7dbedb3a4e3aed2262b7e1407f166fcb9c30ca3f96635dfbbef99965c", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "0dd10e7fe8070095df063798f82709b0a1224c31b8baf6278b423898d591a069"}, + "telemetry_metrics_prometheus_core": {:hex, :telemetry_metrics_prometheus_core, "1.2.0", "b583c3f18508f5c5561b674d16cf5d9afd2ea3c04505b7d92baaeac93c1b8260", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "9cba950e1c4733468efbe3f821841f34ac05d28e7af7798622f88ecdbbe63ea3"}, "telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"}, "tesla": {:hex, :tesla, "1.8.0", "d511a4f5c5e42538d97eef7c40ec4f3e44effdc5068206f42ed859e09e51d1fd", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.13", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, ">= 1.0.0", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.2", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:msgpax, "~> 2.3", [hex: :msgpax, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "10501f360cd926a309501287470372af1a6e1cbed0f43949203a4c13300bc79f"}, "timex": {:hex, :timex, "3.7.11", "bb95cb4eb1d06e27346325de506bcc6c30f9c6dea40d1ebe390b262fad1862d1", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.20", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "8b9024f7efbabaf9bd7aa04f65cf8dcd7c9818ca5737677c7b76acbc6a94d1aa"}, diff --git a/test/spec/runners/light_client.ex b/test/spec/runners/light_client.ex index a869fb988..086a5c40f 100644 --- a/test/spec/runners/light_client.ex +++ b/test/spec/runners/light_client.ex @@ -39,7 +39,7 @@ defmodule LightClientTestRunner do |> SpecTestUtils.sanitize_yaml() res = - Predicates.is_valid_merkle_branch?( + Predicates.valid_merkle_branch?( leaf, branch, Constants.deposit_contract_tree_depth() + 1, diff --git a/test/unit/pending_blocks_test.exs b/test/unit/pending_blocks_test.exs index d8145cabd..b56e3e1b1 100644 --- a/test/unit/pending_blocks_test.exs +++ b/test/unit/pending_blocks_test.exs @@ -31,10 +31,10 @@ defmodule Unit.PendingBlocks do PendingBlocks.add_block(signed_block) - assert PendingBlocks.is_pending_block(block_root) + assert PendingBlocks.pending_block?(block_root) send(PendingBlocks, :process_blocks) # If the block is not pending anymore, it means it was added to the fork choice - assert not PendingBlocks.is_pending_block(block_root) + assert not PendingBlocks.pending_block?(block_root) end end