Skip to content

Commit

Permalink
[CONSENSUS] Find issue with sending metadata request (#548)
Browse files Browse the repository at this point in the history
## 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 <!-- add details here if it a different type of change -->

## 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 <alex@deblasis.net>
Co-authored-by: Daniel Olshansky <olshansky@pokt.network>
  • Loading branch information
3 people authored Feb 28, 2023
1 parent feadb65 commit 743f6a8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion consensus/debugging.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
4 changes: 4 additions & 0 deletions consensus/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions consensus/state_sync_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -33,13 +34,15 @@ 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")
}
return m.stateSync.HandleStateSyncMetadataRequest(stateSyncMessage.GetMetadataReq())
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")
}
Expand Down

0 comments on commit 743f6a8

Please sign in to comment.