github.com/koko1123/flow-go-1@v0.29.6/model/flow/slashable.go (about)

     1  package flow
     2  
     3  // Slashable represents an message we got from a different node, whose validity has not been _entirely_
     4  // confirmed. We want to retain information about the origin that published this particular message
     5  // within the network, so we can potentially raise a slashing challenge against the origin, should
     6  // we discover that this message is evidence of a protocol violation.
     7  // TODO: this struct does not have its final form. We only retain the ID of the node where the message
     8  // originated. However, this will not allow us to prove to somebody else that `OriginID` really sent
     9  // this message, as we could have tempered with the message and then erroneously accuse `OriginID`
    10  // of a protocol violation. In the mature protocol, `OriginID` will be replaced by an inspector object
    11  // (generated by the networking layer) that allows us to generate a cryptographic proof of who sent the message.
    12  type Slashable[T any] struct {
    13  	OriginID Identifier // this will become the inspector object, once we have message forensics
    14  	Message  *T
    15  }
    16  
    17  // NoSlashable returns the zero value for Slashable[T].
    18  func NoSlashable[T any]() Slashable[T] {
    19  	return Slashable[T]{}
    20  }