10

I'm curious what the difference between preflightCommitment and commitment is.

Also, what are the different types of commitments listed below.

export type Commitment =
    | 'processed'
    | 'confirmed'
    | 'finalized'
    | 'recent'
    | 'single'
    | 'singleGossip'
    | 'root'
    | 'max';
yangli-io
  • 16,760
  • 8
  • 37
  • 47

1 Answers1

16

preflightCommitment is the commitment used for the preflight transaction, AKA the transaction simulation, whereas commitment is used for the actual transaction.

As for the different commitments, they're all listed at https://docs.solana.com/developing/clients/jsonrpc-api#configuring-state-commitment

Some of those terms are old, but here's roughly how they would translate:

  • processed = recent
  • confirmed = singleGossip = single
  • finalized = root = max
Jon C
  • 7,019
  • 10
  • 17
  • 2
    Thanks! why does simulations require some kind of commitment here? Also, does that mean `recent, singleGossip, single, root, max` are all deprecated? – yangli-io Aug 12 '21 at 05:48
  • 2
    Per the definition of commitment: "For preflight checks and transaction processing, Solana nodes choose which bank state to query" so if you choose "finalized" it means that you're running your transaction against a finalized block, and if you choose "processed", you're running your transaction against the most recent block. And yes, those are all now deprecated. – Jon C Aug 13 '21 at 03:20