Skip to content
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

En 6833/antiflood observers #2007

Merged
merged 17 commits into from Jun 26, 2020
Merged

Conversation

sasurobert
Copy link
Contributor

do not accept messages - do not propagate messages whose originator is not a validator.
Accepted topics are only transactions_selfID and heartbeat

@iulianpascalau iulianpascalau self-requested a review June 24, 2020 12:22
@iulianpascalau iulianpascalau added the type:feature New feature or request label Jun 24, 2020
Copy link
Contributor

@iulianpascalau iulianpascalau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor stuff found when displaying logs lines

process/interceptors/multiDataInterceptor.go Show resolved Hide resolved
@@ -156,6 +165,10 @@ func (mdi *MultiDataInterceptor) ProcessReceivedMessage(message p2p.MessageP2P,
)
}

if !allWhiteListed && errOriginator != nil {
log.Debug("got message from peer on topic only for validators", "originator", message.Peer(), "topic", mdi.topic, "err", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed to:

log.Debug("got message from peer on topic only for validators", 
"originator", p2p.PeerIdToShortString(message.Peer()), 
"topic", mdi.topic, 
"err", err)

as message.Peer() might contain unprintable characters
I think we should add a String() function on core.PeerID struct

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

isWhiteListed := sdi.whiteListRequested.IsWhiteListed(interceptedData)
if !isWhiteListed && errOriginator != nil {
log.Debug("got message from peer on topic only for validators", "originator", message.Peer(), "topic", sdi.topic, "err", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, please use p2p.PeerIdToShortString function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@SebastianMarian SebastianMarian self-requested a review June 24, 2020 13:37
iulianpascalau
iulianpascalau previously approved these changes Jun 24, 2020

import "github.com/ElrondNetwork/elrond-go/core"

type PeerValidatorMapper struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a mocked comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return process.ErrOnlyValidatorsCanUseThisTopic
}

// SetTopicsForAll set the topics which are enabled for all
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sets

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

iulianpascalau
iulianpascalau previously approved these changes Jun 24, 2020
# Conflicts:
#	process/throttle/antiflood/p2pAntiflood.go
iulianpascalau
iulianpascalau previously approved these changes Jun 25, 2020
Copy link
Contributor

@iulianpascalau iulianpascalau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

identation failed in p2pAntiflood.go

}

sort.Slice(epochList, func(i, j int) bool {
return epochList[i] < epochList[j]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 that should overwrite the values from previous epochs, if the node is performing well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was the idea

@@ -132,11 +134,7 @@ func (psm *PeerShardMapper) getPeerInfoWithNodesCoordinator(pid core.PeerID) (*c
}, false
}

psm.mutEpoch.RLock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove the mutex, epoch and the associated handlers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left there if later it would be used

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

later means never :)))

iulianpascalau
iulianpascalau previously approved these changes Jun 26, 2020
iulianpascalau and others added 2 commits June 26, 2020 18:59
…de the checking of nonce or epoch start in the case of shard/meta headers.
Copy link
Contributor

@LucianMincu LucianMincu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System tests passed.

@LucianMincu LucianMincu merged commit 1d88984 into development Jun 26, 2020
@LucianMincu LucianMincu deleted the EN-6833/Antiflood-observers branch June 26, 2020 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants