|
|
@@ -18,28 +18,11 @@ type (
|
|
|
// The native transaction identifier from the EmitterAddress interaction.
|
|
|
InitiatingTxID common.Hash
|
|
|
}
|
|
|
-
|
|
|
- // VerifiedPeerSignature is a message observation from a Guardian that has been verified
|
|
|
- // to be authentic and authorized to contribute to VAA quorum (ie. within the Guardian set).
|
|
|
- VerifiedPeerSignature struct {
|
|
|
- // The chain the transaction took place on
|
|
|
- EmitterChain vaa.ChainID
|
|
|
- // EmitterAddress of the contract that emitted the Message
|
|
|
- EmitterAddress vaa.Address
|
|
|
- // Sequence of the VAA
|
|
|
- Sequence uint64
|
|
|
- // The address of the Guardian that observed and signed the message
|
|
|
- GuardianAddress common.Address
|
|
|
- // Transaction Identifier of the initiating event
|
|
|
- Signature []byte
|
|
|
- }
|
|
|
)
|
|
|
|
|
|
type lifecycleEventChannels struct {
|
|
|
// channel for each event
|
|
|
MessagePublicationC chan *MessagePublication
|
|
|
- VAAStateUpdateC chan *vaa.VAA
|
|
|
- VerifiedSignatureC chan *VerifiedPeerSignature
|
|
|
VAAQuorumC chan *vaa.VAA
|
|
|
}
|
|
|
|
|
|
@@ -81,8 +64,6 @@ func (re *AttestationEventReporter) Subscribe() *activeSubscription {
|
|
|
re.logger.Debug("Subscribe for client", zap.Int("clientId", clientId))
|
|
|
channels := &lifecycleEventChannels{
|
|
|
MessagePublicationC: make(chan *MessagePublication, 50),
|
|
|
- VAAStateUpdateC: make(chan *vaa.VAA, 50),
|
|
|
- VerifiedSignatureC: make(chan *VerifiedPeerSignature, 50),
|
|
|
VAAQuorumC: make(chan *vaa.VAA, 50),
|
|
|
}
|
|
|
re.subs[clientId] = channels
|
|
|
@@ -113,36 +94,6 @@ func (re *AttestationEventReporter) ReportMessagePublication(msg *MessagePublica
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// ReportVerifiedPeerSignature is invoked after a SignedObservation is verified.
|
|
|
-func (re *AttestationEventReporter) ReportVerifiedPeerSignature(msg *VerifiedPeerSignature) {
|
|
|
- re.mu.RLock()
|
|
|
- defer re.mu.RUnlock()
|
|
|
-
|
|
|
- for client, sub := range re.subs {
|
|
|
- select {
|
|
|
- case sub.VerifiedSignatureC <- msg:
|
|
|
- re.logger.Debug("published VerifiedPeerSignature to client", zap.Int("client", client))
|
|
|
- default:
|
|
|
- re.logger.Debug("buffer overrun when attempting to publish message", zap.Int("client", client))
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// ReportVAAStateUpdate is invoked each time the local VAAState is updated.
|
|
|
-func (re *AttestationEventReporter) ReportVAAStateUpdate(msg *vaa.VAA) {
|
|
|
- re.mu.RLock()
|
|
|
- defer re.mu.RUnlock()
|
|
|
-
|
|
|
- for client, sub := range re.subs {
|
|
|
- select {
|
|
|
- case sub.VAAStateUpdateC <- msg:
|
|
|
- re.logger.Debug("published VAAStateUpdate to client", zap.Int("client", client))
|
|
|
- default:
|
|
|
- re.logger.Debug("buffer overrun when attempting to publish message", zap.Int("client", client))
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
// ReportVAAQuorum is invoked when quorum is reached.
|
|
|
func (re *AttestationEventReporter) ReportVAAQuorum(msg *vaa.VAA) {
|
|
|
re.mu.RLock()
|