From 743f6a86a5992f2b8aca4bcb86cf3df9541755c5 Mon Sep 17 00:00:00 2001 From: goku <118421317+gokutheengineer@users.noreply.github.com> Date: Tue, 28 Feb 2023 16:30:25 +0300 Subject: [PATCH] [CONSENSUS] Find issue with sending metadata request (#548) ## Description Unable to metadata request sending issue on Localnet. ## Issue Fixes #549. ## Type of change Please mark the relevant option(s): - [ ] New feature, functionality or library - [X] Bug fix - [ ] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [ ] Other ## List of changes - Fix bug in consensus/debugging.go. ## Testing - [X] `make develop_test` - [X] [LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md) w/ all of the steps outlined in the `README` ## Required Checklist - [X] I have performed a self-review of my own code - [X] I have commented my code, particularly in hard-to-understand areas - [X] I have tested my changes using the available tooling - [X] I have updated the corresponding CHANGELOG ### If Applicable Checklist - [ ] I have updated the corresponding README(s); local and/or global - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added, or updated, [mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding README(s) - [ ] I have added, or updated, documentation and [mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*` if I updated `shared/*`README(s) --------- Co-authored-by: Alessandro De Blasis Co-authored-by: Daniel Olshansky --- consensus/debugging.go | 2 +- consensus/doc/CHANGELOG.md | 4 ++++ consensus/state_sync_handler.go | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/consensus/debugging.go b/consensus/debugging.go index 43daf04c3..3fb26af85 100644 --- a/consensus/debugging.go +++ b/consensus/debugging.go @@ -184,7 +184,7 @@ func (m *consensusModule) sendGetMetadataStateSyncMessage(_ *messaging.DebugMess } for _, val := range validators { - if m.GetNodeAddress() != val.GetAddress() { + if m.GetNodeAddress() == val.GetAddress() { continue } valAddress := cryptoPocket.AddressFromString(val.GetAddress()) diff --git a/consensus/doc/CHANGELOG.md b/consensus/doc/CHANGELOG.md index d019cb7cc..40d42f642 100644 --- a/consensus/doc/CHANGELOG.md +++ b/consensus/doc/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.0.0.35] - 2023-02-28 + +- Fixed bug in `sendGetMetadataStateSyncMessage` + ## [0.0.0.34] - 2023-02-24 - Fixed `TestPacemakerCatchupSameStepDifferentRounds` test diff --git a/consensus/state_sync_handler.go b/consensus/state_sync_handler.go index e306df8b9..cd78a36f3 100644 --- a/consensus/state_sync_handler.go +++ b/consensus/state_sync_handler.go @@ -11,6 +11,7 @@ import ( func (m *consensusModule) HandleStateSyncMessage(stateSyncMessageAny *anypb.Any) error { m.m.Lock() defer m.m.Unlock() + m.logger.Info().Msg("Handling StateSyncMessage") switch stateSyncMessageAny.MessageName() { case StateSyncMessageContentType: @@ -33,6 +34,7 @@ func (m *consensusModule) HandleStateSyncMessage(stateSyncMessageAny *anypb.Any) func (m *consensusModule) handleStateSyncMessage(stateSyncMessage *typesCons.StateSyncMessage) error { switch stateSyncMessage.Message.(type) { case *typesCons.StateSyncMessage_MetadataReq: + m.logger.Info().Str("proto_type", "MetadataRequest").Msg("Handling StateSyncMessage MetadataReq") if !m.stateSync.IsServerModEnabled() { return fmt.Errorf("server module is not enabled") } @@ -40,6 +42,7 @@ func (m *consensusModule) handleStateSyncMessage(stateSyncMessage *typesCons.Sta case *typesCons.StateSyncMessage_MetadataRes: return m.stateSync.HandleStateSyncMetadataResponse(stateSyncMessage.GetMetadataRes()) case *typesCons.StateSyncMessage_GetBlockReq: + m.logger.Info().Str("proto_type", "GetBlockRequest").Msg("Handling StateSyncMessage MetadataReq") if !m.stateSync.IsServerModEnabled() { return fmt.Errorf("server module is not enabled") }