Skip to content

Commit

Permalink
fix: warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
avilagaston9 committed Jun 10, 2024
1 parent b3ae855 commit 1a25c16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion lib/lambda_ethereum_consensus/p2p/gossip/attestation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ defmodule LambdaEthereumConsensus.P2P.Gossip.Attestation do
id_with_trailer |> String.trim_trailing("/ssz_snappy") |> String.to_integer()
end

@spec persist_subnet_info(SubnetInfo.t(), non_neg_integer()) :: :ok
defp persist_subnet_info(subnet_info, subnet_id) do
:telemetry.span([:subnet, :persist], %{}, fn ->
{Db.put(
Expand Down
12 changes: 5 additions & 7 deletions lib/types/subnet_info.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ defmodule Types.SubnetInfo do
attestations: Attestation
}

@spec new_subnet_with_attestation(Attestation.t()) :: t()
def new_subnet_with_attestation(attestation) do
%SubnetInfo{data: attestation.data, attestations: [attestation]}
end
def new_subnet_with_attestation(%Attestation{data: data} = attestation),
do: %SubnetInfo{data: data, attestations: [attestation]}

@spec aggregate_attestation(t(), Attestation.t()) :: t()
@spec aggregate_attestation(SubnetInfo.t(), Attestation.t()) :: SubnetInfo.t()
def aggregate_attestation(subnet_info, attestation) do
if subnet_info.data == attestation.data do
%SubnetInfo{subnet_info | attestations: [attestation | subnet_info.attestations]}
Expand All @@ -29,12 +27,12 @@ defmodule Types.SubnetInfo do
end
end

@spec encode(t()) :: binary()
@spec encode(SubnetInfo.t()) :: binary()
def encode(%__MODULE__{} = subnet_info) do
{subnet_info.data, subnet_info.attestations} |> :erlang.term_to_binary()
end

@spec decode(binary()) :: t()
@spec decode(binary()) :: SubnetInfo.t()
def decode(bin) do
{data, attestations} = :erlang.binary_to_term(bin)
%__MODULE__{data: data, attestations: attestations}
Expand Down

0 comments on commit 1a25c16

Please sign in to comment.