rpcpool / yellowstone-faithful

Project Yellowstone Old Faithful is the project to make all of Solana's history accessible, content addressable and available via a variety of means.
https://old-faithful.net/
GNU Affero General Public License v3.0
54 stars 9 forks source link

Validate transactions #72

Open linuskendall opened 7 months ago

linuskendall commented 7 months ago

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

hydrogenbond007 commented 2 months ago

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

gagliardetto commented 1 month ago

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 https://github.com/rpcpool/yellowstone-faithful/pull/99