node/pkg/solana: add more logging to transaction parsing
Change-Id: I2529b0c0a7aa7d94802598a7fffbcdbe0ddca5bc
This commit is contained in:
parent
6ab0fe3855
commit
7a4cac2dde
|
@ -303,11 +303,12 @@ OUTER:
|
||||||
zap.String("commitment", string(s.commitment)))
|
zap.String("commitment", string(s.commitment)))
|
||||||
|
|
||||||
// Find top-level instructions
|
// Find top-level instructions
|
||||||
for _, inst := range tx.Transaction.Message.Instructions {
|
for i, inst := range tx.Transaction.Message.Instructions {
|
||||||
found, err := s.processInstruction(ctx, logger, slot, inst, programIndex, tx)
|
found, err := s.processInstruction(ctx, logger, slot, inst, programIndex, tx, signature, i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("malformed Wormhole instruction",
|
logger.Error("malformed Wormhole instruction",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
|
zap.Int("idx", i),
|
||||||
zap.Stringer("signature", signature),
|
zap.Stringer("signature", signature),
|
||||||
zap.Uint64("slot", slot),
|
zap.Uint64("slot", slot),
|
||||||
zap.String("commitment", string(s.commitment)),
|
zap.String("commitment", string(s.commitment)),
|
||||||
|
@ -346,11 +347,12 @@ OUTER:
|
||||||
zap.Duration("took", time.Since(start)))
|
zap.Duration("took", time.Since(start)))
|
||||||
|
|
||||||
for _, inner := range tr.Meta.InnerInstructions {
|
for _, inner := range tr.Meta.InnerInstructions {
|
||||||
for _, inst := range inner.Instructions {
|
for i, inst := range inner.Instructions {
|
||||||
_, err := s.processInstruction(ctx, logger, slot, inst, programIndex, tx)
|
_, err := s.processInstruction(ctx, logger, slot, inst, programIndex, tx, signature, i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("malformed Wormhole instruction",
|
logger.Error("malformed Wormhole instruction",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
|
zap.Int("idx", i),
|
||||||
zap.Stringer("signature", signature),
|
zap.Stringer("signature", signature),
|
||||||
zap.Uint64("slot", slot),
|
zap.Uint64("slot", slot),
|
||||||
zap.String("commitment", string(s.commitment)))
|
zap.String("commitment", string(s.commitment)))
|
||||||
|
@ -362,7 +364,7 @@ OUTER:
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SolanaWatcher) processInstruction(ctx context.Context, logger *zap.Logger, slot uint64, inst solana.CompiledInstruction, programIndex uint16, tx rpc.TransactionWithMeta) (bool, error) {
|
func (s *SolanaWatcher) processInstruction(ctx context.Context, logger *zap.Logger, slot uint64, inst solana.CompiledInstruction, programIndex uint16, tx rpc.TransactionWithMeta, signature solana.Signature, idx int) (bool, error) {
|
||||||
if inst.ProgramIDIndex != programIndex {
|
if inst.ProgramIDIndex != programIndex {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
@ -382,7 +384,8 @@ func (s *SolanaWatcher) processInstruction(ctx context.Context, logger *zap.Logg
|
||||||
return false, fmt.Errorf("failed to deserialize instruction data: %w", err)
|
return false, fmt.Errorf("failed to deserialize instruction data: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Info("post message data", zap.Any("deserialized_data", data))
|
logger.Info("post message data", zap.Any("deserialized_data", data),
|
||||||
|
zap.Stringer("signature", signature), zap.Uint64("slot", slot), zap.Int("idx", idx))
|
||||||
|
|
||||||
level, err := data.ConsistencyLevel.Commitment()
|
level, err := data.ConsistencyLevel.Commitment()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -395,6 +398,10 @@ func (s *SolanaWatcher) processInstruction(ctx context.Context, logger *zap.Logg
|
||||||
|
|
||||||
// The second account in a well-formed Wormhole instruction is the VAA program account.
|
// The second account in a well-formed Wormhole instruction is the VAA program account.
|
||||||
acc := tx.Transaction.Message.AccountKeys[inst.Accounts[1]]
|
acc := tx.Transaction.Message.AccountKeys[inst.Accounts[1]]
|
||||||
|
|
||||||
|
logger.Info("fetching VAA account", zap.Stringer("acc", acc),
|
||||||
|
zap.Stringer("signature", signature), zap.Uint64("slot", slot), zap.Int("idx", idx))
|
||||||
|
|
||||||
go s.retryFetchMessageAccount(ctx, logger, acc, slot, 0)
|
go s.retryFetchMessageAccount(ctx, logger, acc, slot, 0)
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|
Loading…
Reference in New Issue