mirror of
				https://source.quilibrium.com/quilibrium/ceremonyclient.git
				synced 2025-11-03 23:47:27 +00:00 
			
		
		
		
	push out signature validation to the edge, punish only
This commit is contained in:
		
							parent
							
								
									1e60549f89
								
							
						
					
					
						commit
						c84599e7e0
					
				@ -266,7 +266,7 @@ func NewPubSub(ctx context.Context, h host.Host, rt PubSubRouter, opts ...Option
 | 
			
		||||
		peerOutboundQueueSize: 32,
 | 
			
		||||
		signID:                h.ID(),
 | 
			
		||||
		signKey:               nil,
 | 
			
		||||
		signPolicy:            StrictSign,
 | 
			
		||||
		signPolicy:            LaxSign,
 | 
			
		||||
		incoming:              make(chan *RPC, 32),
 | 
			
		||||
		newPeers:              make(chan struct{}, 1),
 | 
			
		||||
		newPeersPend:          make(map[peer.ID]struct{}),
 | 
			
		||||
 | 
			
		||||
@ -27,10 +27,8 @@ const (
 | 
			
		||||
	// StrictNoSign does not produce signatures and drops and penalises incoming messages that carry one
 | 
			
		||||
	StrictNoSign = msgVerification
 | 
			
		||||
	// LaxSign produces signatures and validates incoming signatures iff one is present
 | 
			
		||||
	// Deprecated: it is recommend to either strictly enable, or strictly disable, signatures.
 | 
			
		||||
	LaxSign = msgSigning
 | 
			
		||||
	// LaxNoSign does not produce signatures and validates incoming signatures iff one is present
 | 
			
		||||
	// Deprecated: it is recommend to either strictly enable, or strictly disable, signatures.
 | 
			
		||||
	LaxNoSign = 0
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -297,7 +297,7 @@ func (v *validation) validateWorker() {
 | 
			
		||||
func (v *validation) validate(vals []*validatorImpl, src peer.ID, msg *Message, synchronous bool) error {
 | 
			
		||||
	// If signature verification is enabled, but signing is disabled,
 | 
			
		||||
	// the Signature is required to be nil upon receiving the message in PubSub.pushMsg.
 | 
			
		||||
	if msg.Signature != nil {
 | 
			
		||||
	if msg.Signature != nil && v.p.signPolicy&msgVerification != 0 {
 | 
			
		||||
		if !v.validateSignature(msg) {
 | 
			
		||||
			log.Debugf("message signature validation failed; dropping message from %s", src)
 | 
			
		||||
			v.tracer.RejectMessage(msg, RejectInvalidSignature)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user