Skip to content

Commit

Permalink
node/pkg/solana: log quorum and emitter chain on settled VAAs
Browse files Browse the repository at this point in the history
Change-Id: I8162ed3bfb77d0708a9dd910eb1ba757d73bc246
  • Loading branch information
Leo committed Oct 1, 2021
1 parent 3ebde5d commit 92d3ee5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 18 additions & 1 deletion node/pkg/processor/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package processor
import (
"context"
"github.com/certusone/wormhole/node/pkg/common"
"github.com/certusone/wormhole/node/pkg/vaa"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"time"
Expand Down Expand Up @@ -57,7 +58,6 @@ func (p *Processor) handleCleanup(ctx context.Context) {
// arrive, barring special circumstances. This is a better time to count misses than submission,
// because we submit right when we quorum rather than waiting for all observations to arrive.
s.settled = true
p.logger.Info("VAA considered settled", zap.String("digest", hash))

// Use either the most recent (in case of a VAA we haven't seen) or stored gs, if available.
var gs *common.GuardianSet
Expand All @@ -67,6 +67,23 @@ func (p *Processor) handleCleanup(ctx context.Context) {
gs = p.gs
}

hasSigs := len(s.signatures)
wantSigs := CalculateQuorum(len(gs.Keys))

var chain vaa.ChainID
if s.ourVAA != nil {
chain = s.ourVAA.EmitterChain
}

p.logger.Info("VAA considered settled",
zap.String("digest", hash),
zap.Duration("delta", delta),
zap.Int("have_sigs", hasSigs),
zap.Int("required_sigs", wantSigs),
zap.Bool("quorum", hasSigs >= wantSigs),
zap.Stringer("emitter_chain", chain),
)

for _, k := range gs.Keys {
if _, ok := s.signatures[k]; ok {
aggregationStateFulfillment.WithLabelValues(k.Hex(), s.source, "present").Inc()
Expand Down
2 changes: 2 additions & 0 deletions node/pkg/vaa/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ func (a SignatureData) String() string {

func (c ChainID) String() string {
switch c {
case 0:
return "unset"
case ChainIDSolana:
return "solana"
case ChainIDEthereum:
Expand Down

0 comments on commit 92d3ee5

Please sign in to comment.