Skip to content

fix: was passing attestation data instead of whole attestation #904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/lambda_ethereum_consensus/p2p/gossip/attestation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ defmodule LambdaEthereumConsensus.P2P.Gossip.Attestation do
Libp2pPort.publish(topic, message)
end

@spec collect(non_neg_integer(), Types.AttestationData.t()) :: :ok
def collect(subnet_id, attestation_data) do
GenServer.call(__MODULE__, {:collect, subnet_id, attestation_data})
@spec collect(non_neg_integer(), Types.Attestation.t()) :: :ok
def collect(subnet_id, attestation) do
GenServer.call(__MODULE__, {:collect, subnet_id, attestation})
join(subnet_id)
end

Expand Down Expand Up @@ -95,9 +95,9 @@ defmodule LambdaEthereumConsensus.P2P.Gossip.Attestation do
end

@impl true
def handle_call({:collect, subnet_id, attestation_data}, _from, state) do
attestations = Map.put(state.attestations, subnet_id, [attestation_data])
attnets = Map.put(state.attnets, subnet_id, attestation_data)
def handle_call({:collect, subnet_id, attestation}, _from, state) do
attestations = Map.put(state.attestations, subnet_id, [attestation])
attnets = Map.put(state.attnets, subnet_id, attestation.data)
new_state = %{state | attnets: attnets, attestations: attestations}
{:reply, :ok, new_state}
end
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 @@ -216,7 +216,7 @@ defmodule LambdaEthereumConsensus.Validator do

if current_duty.is_aggregator do
Logger.info("[Validator] Collecting messages for future aggregation...")
Gossip.Attestation.collect(subnet_id, attestation.data)
Gossip.Attestation.collect(subnet_id, attestation)
end
end

Expand Down Expand Up @@ -261,7 +261,7 @@ defmodule LambdaEthereumConsensus.Validator do

defp append_signature(aggregate_and_proof, signing_domain, %{privkey: privkey}) do
signing_root = Misc.compute_signing_root(aggregate_and_proof, signing_domain)
signature = Bls.sign(privkey, signing_root)
{:ok, signature} = Bls.sign(privkey, signing_root)
%Types.SignedAggregateAndProof{message: aggregate_and_proof, signature: signature}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/ssz_ex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ defmodule LambdaEthereumConsensus.SszEx do
:ok <- check_length(fixed_length, variable_length),
{:ok, fixed_parts} <-
replace_offsets(fixed_size_values, offsets)
|> encode_schemas do
|> encode_schemas() do
(fixed_parts ++ variable_parts)
|> Enum.join()
|> then(&{:ok, &1})
Expand Down