rpcpool/yellowstone-faithful

Validate transactions

Opened this issue · 2 comments

Have support for validating transaction signatures (computing the transaction signature from the transaction data.

Hey, recently started looking at the project

Can I take this issue? Will take a bit of time to research but down to work on it

hi @hydrogenbond007

The basic flow would be:

	for _, object := range objects {
		// check if the object is a transaction:
		kind := iplddecoders.Kind(object.Object.RawData()[1])
		if kind != iplddecoders.KindTransaction {
			continue
		}
		decoded, err := iplddecoders.DecodeTransaction(object.Object.RawData())
		if err != nil {
			return nil, fmt.Errorf("error while decoding transaction from nodex %s: %w", object.Cid, err)
		}
		tx, err := decoded.GetSolanaTransaction()
		if err != nil {
			return nil, fmt.Errorf("error while getting solana transaction from object %s: %w", object.Cid, err)
		}
		err = tx.VerifySignatures()
		if err != nil {
			return nil, fmt.Errorf("error while verifying signatures for transaction %s: %w", tx.Signatures[0], err)
		}
	}

This includes some utility code (e.g. decoded.GetSolanaTransaction()) that will be merged soon to main :) and is currently in #99