bridge: do not log errors for duplicate VAA submissions
No functional change, just nicer log output.
ghstack-source-id: f946cbe71d
Pull Request resolved: https://github.com/certusone/wormhole/pull/52
This commit is contained in:
parent
e5e6690f35
commit
d3875ba523
|
@ -5,6 +5,7 @@ import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
eth_common "github.com/ethereum/go-ethereum/common"
|
eth_common "github.com/ethereum/go-ethereum/common"
|
||||||
|
@ -111,8 +112,6 @@ func (e *SolanaBridgeWatcher) Run(ctx context.Context) error {
|
||||||
res, err := c.SubmitVAA(timeout, &agentv1.SubmitVAARequest{Vaa: vaaBytes})
|
res, err := c.SubmitVAA(timeout, &agentv1.SubmitVAARequest{Vaa: vaaBytes})
|
||||||
cancel()
|
cancel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("failed to submit VAA", zap.Error(err), zap.String("digest", h))
|
|
||||||
|
|
||||||
st, ok := status.FromError(err)
|
st, ok := status.FromError(err)
|
||||||
if !ok {
|
if !ok {
|
||||||
panic("err not a status")
|
panic("err not a status")
|
||||||
|
@ -128,13 +127,25 @@ func (e *SolanaBridgeWatcher) Run(ctx context.Context) error {
|
||||||
codes.Unavailable,
|
codes.Unavailable,
|
||||||
codes.Aborted:
|
codes.Aborted:
|
||||||
|
|
||||||
logger.Error("requeuing VAA", zap.Error(err), zap.String("digest", h))
|
logger.Error("transient error, requeuing VAA", zap.Error(err), zap.String("digest", h))
|
||||||
|
|
||||||
// Tombstone goroutine
|
// Tombstone goroutine
|
||||||
go func(v *vaa.VAA) {
|
go func(v *vaa.VAA) {
|
||||||
time.Sleep(10 * time.Second)
|
time.Sleep(10 * time.Second)
|
||||||
e.vaaChan <- v
|
e.vaaChan <- v
|
||||||
}(v)
|
}(v)
|
||||||
|
|
||||||
|
case codes.Internal:
|
||||||
|
// This VAA has already been executed on chain, successfully or not.
|
||||||
|
// TODO: dissect InstructionError in agent and convert this to the proper gRPC code
|
||||||
|
if strings.Contains(st.Message(), "custom program error: 0xb") { // AlreadyExists
|
||||||
|
logger.Info("VAA already submitted on-chain, ignoring", zap.Error(err), zap.String("digest", h))
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
fallthrough
|
||||||
|
default:
|
||||||
|
logger.Error("error submitting VAA", zap.Error(err), zap.String("digest", h))
|
||||||
}
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue