From 19810455e379f3cde568fe22a53c111976330c7d Mon Sep 17 00:00:00 2001 From: turuslan Date: Thu, 21 Nov 2024 12:30:08 +0500 Subject: [PATCH] fix grandpa equivocation Signed-off-by: turuslan --- core/consensus/grandpa/impl/environment_impl.cpp | 2 +- core/consensus/grandpa/types/equivocation_proof.hpp | 6 ++++-- core/consensus/grandpa/vote_types.hpp | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/consensus/grandpa/impl/environment_impl.cpp b/core/consensus/grandpa/impl/environment_impl.cpp index 3bb65b9bff..f427ef8d93 100644 --- a/core/consensus/grandpa/impl/environment_impl.cpp +++ b/core/consensus/grandpa/impl/environment_impl.cpp @@ -501,7 +501,7 @@ namespace kagome::consensus::grandpa { SL_WARN(logger_, "Round #{}: can't submit equivocation report: {}", equivocation.round(), - key_owner_proof_res.error()); + submit_res.error()); return submit_res.as_failure(); } diff --git a/core/consensus/grandpa/types/equivocation_proof.hpp b/core/consensus/grandpa/types/equivocation_proof.hpp index 7a46f618a9..cc44d37777 100644 --- a/core/consensus/grandpa/types/equivocation_proof.hpp +++ b/core/consensus/grandpa/types/equivocation_proof.hpp @@ -61,8 +61,10 @@ namespace kagome::consensus::grandpa { friend scale::ScaleEncoderStream &operator<<( scale::ScaleEncoderStream &s, const Equivocation &equivocation) { return s << equivocation.stage << equivocation.round_number - << equivocation.first.id << equivocation.first - << equivocation.second; + << equivocation.first.id << equivocation.first.getBlockInfo() + << equivocation.first.signature + << equivocation.second.getBlockInfo() + << equivocation.second.signature; } }; diff --git a/core/consensus/grandpa/vote_types.hpp b/core/consensus/grandpa/vote_types.hpp index 6129590989..125cedd938 100644 --- a/core/consensus/grandpa/vote_types.hpp +++ b/core/consensus/grandpa/vote_types.hpp @@ -6,6 +6,8 @@ #pragma once +#include + namespace kagome::consensus::grandpa { - enum class VoteType { Prevote, Precommit }; + enum class VoteType : uint8_t { Prevote, Precommit }; }