Skip to content

Commit 00b1741

Browse files
authored
fix: was passing attestation data instead of whole attestation (#904)
1 parent 3bf9862 commit 00b1741

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lib/lambda_ethereum_consensus/p2p/gossip/attestation.ex

+6-6
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ defmodule LambdaEthereumConsensus.P2P.Gossip.Attestation do
5151
Libp2pPort.publish(topic, message)
5252
end
5353

54-
@spec collect(non_neg_integer(), Types.AttestationData.t()) :: :ok
55-
def collect(subnet_id, attestation_data) do
56-
GenServer.call(__MODULE__, {:collect, subnet_id, attestation_data})
54+
@spec collect(non_neg_integer(), Types.Attestation.t()) :: :ok
55+
def collect(subnet_id, attestation) do
56+
GenServer.call(__MODULE__, {:collect, subnet_id, attestation})
5757
join(subnet_id)
5858
end
5959

@@ -95,9 +95,9 @@ defmodule LambdaEthereumConsensus.P2P.Gossip.Attestation do
9595
end
9696

9797
@impl true
98-
def handle_call({:collect, subnet_id, attestation_data}, _from, state) do
99-
attestations = Map.put(state.attestations, subnet_id, [attestation_data])
100-
attnets = Map.put(state.attnets, subnet_id, attestation_data)
98+
def handle_call({:collect, subnet_id, attestation}, _from, state) do
99+
attestations = Map.put(state.attestations, subnet_id, [attestation])
100+
attnets = Map.put(state.attnets, subnet_id, attestation.data)
101101
new_state = %{state | attnets: attnets, attestations: attestations}
102102
{:reply, :ok, new_state}
103103
end

lib/lambda_ethereum_consensus/validator/validator.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ defmodule LambdaEthereumConsensus.Validator do
216216

217217
if current_duty.is_aggregator do
218218
Logger.info("[Validator] Collecting messages for future aggregation...")
219-
Gossip.Attestation.collect(subnet_id, attestation.data)
219+
Gossip.Attestation.collect(subnet_id, attestation)
220220
end
221221
end
222222

@@ -261,7 +261,7 @@ defmodule LambdaEthereumConsensus.Validator do
261261

262262
defp append_signature(aggregate_and_proof, signing_domain, %{privkey: privkey}) do
263263
signing_root = Misc.compute_signing_root(aggregate_and_proof, signing_domain)
264-
signature = Bls.sign(privkey, signing_root)
264+
{:ok, signature} = Bls.sign(privkey, signing_root)
265265
%Types.SignedAggregateAndProof{message: aggregate_and_proof, signature: signature}
266266
end
267267

lib/ssz_ex.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ defmodule LambdaEthereumConsensus.SszEx do
701701
:ok <- check_length(fixed_length, variable_length),
702702
{:ok, fixed_parts} <-
703703
replace_offsets(fixed_size_values, offsets)
704-
|> encode_schemas do
704+
|> encode_schemas() do
705705
(fixed_parts ++ variable_parts)
706706
|> Enum.join()
707707
|> then(&{:ok, &1})

0 commit comments

Comments
 (0)