node/pkg/watchers: cw decoding more robust
This commit is contained in:
parent
9e27b73e43
commit
7384861384
|
@ -1067,7 +1067,7 @@ func (s *nodePrivilegedService) GetAndObserveMissingVAAs(ctx context.Context, re
|
|||
// Start injecting the VAAs
|
||||
obsCounter := 0
|
||||
errCounter := 0
|
||||
errMsgs := "Errors: "
|
||||
errMsgs := "Messages: "
|
||||
for i := 0; i < processingLen; i++ {
|
||||
missingVAA := missingVAAs[i]
|
||||
// First check to see if this VAA has already been signed
|
||||
|
@ -1101,7 +1101,7 @@ func (s *nodePrivilegedService) GetAndObserveMissingVAAs(ctx context.Context, re
|
|||
continue
|
||||
}
|
||||
}
|
||||
errMsgs += fmt.Sprintf("\nAttempting to observe %s", obsvReq.String())
|
||||
errMsgs += fmt.Sprintf("\nAttempting to observe %s", missingVAA.Txhash)
|
||||
// Call the following function to send the observation request
|
||||
if err := common.PostObservationRequest(s.obsvReqSendC, &obsvReq); err != nil {
|
||||
errMsgs += fmt.Sprintf("\nPostObservationRequest error %s", err.Error())
|
||||
|
|
|
@ -58,6 +58,9 @@ type (
|
|||
|
||||
// URL to get the latest block info from
|
||||
latestBlockURL string
|
||||
|
||||
// b64Encoded indicates if transactions are base 64 encoded.
|
||||
b64Encoded bool
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -126,6 +129,10 @@ func NewWatcher(
|
|||
latestBlockURL = "cosmos/base/tendermint/v1beta1/blocks/latest"
|
||||
}
|
||||
|
||||
// Injective does not base64 encode parameters (as of release v1.11.2).
|
||||
// Terra2 no longer base64 encodes parameters.
|
||||
b64Encoded := env == common.UnsafeDevNet || (chainID != vaa.ChainIDInjective && chainID != vaa.ChainIDTerra2)
|
||||
|
||||
return &Watcher{
|
||||
urlWS: urlWS,
|
||||
urlLCD: urlLCD,
|
||||
|
@ -137,6 +144,7 @@ func NewWatcher(
|
|||
contractAddressFilterKey: contractAddressFilterKey,
|
||||
contractAddressLogKey: contractAddressLogKey,
|
||||
latestBlockURL: latestBlockURL,
|
||||
b64Encoded: b64Encoded,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,7 +310,7 @@ func (e *Watcher) Run(ctx context.Context) error {
|
|||
}
|
||||
}
|
||||
|
||||
msgs := EventsToMessagePublications(e.contract, txHash, events.Array(), logger, e.chainID, contractAddressLogKey)
|
||||
msgs := EventsToMessagePublications(e.contract, txHash, events.Array(), logger, e.chainID, contractAddressLogKey, e.b64Encoded)
|
||||
for _, msg := range msgs {
|
||||
msg.IsReobservation = true
|
||||
e.msgC <- msg
|
||||
|
@ -343,7 +351,7 @@ func (e *Watcher) Run(ctx context.Context) error {
|
|||
continue
|
||||
}
|
||||
|
||||
msgs := EventsToMessagePublications(e.contract, txHash, events.Array(), logger, e.chainID, e.contractAddressLogKey)
|
||||
msgs := EventsToMessagePublications(e.contract, txHash, events.Array(), logger, e.chainID, e.contractAddressLogKey, e.b64Encoded)
|
||||
for _, msg := range msgs {
|
||||
e.msgC <- msg
|
||||
messagesConfirmed.WithLabelValues(networkName).Inc()
|
||||
|
@ -362,9 +370,7 @@ func (e *Watcher) Run(ctx context.Context) error {
|
|||
}
|
||||
}
|
||||
|
||||
func EventsToMessagePublications(contract string, txHash string, events []gjson.Result, logger *zap.Logger, chainID vaa.ChainID, contractAddressKey string) []*common.MessagePublication {
|
||||
// Injective does not base64 encode parameters (as of release v1.11.2).
|
||||
b64Encoded := chainID != vaa.ChainIDInjective
|
||||
func EventsToMessagePublications(contract string, txHash string, events []gjson.Result, logger *zap.Logger, chainID vaa.ChainID, contractAddressKey string, b64Encoded bool) []*common.MessagePublication {
|
||||
networkName := chainID.String()
|
||||
msgs := make([]*common.MessagePublication, 0, len(events))
|
||||
for _, event := range events {
|
||||
|
|
Loading…
Reference in New Issue