Skip to content

Commit

Permalink
Update SVM docs (anza-xyz#2628)
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge authored and ray-kast committed Nov 27, 2024
1 parent 7567ba6 commit 65edb3d
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions svm/doc/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,28 +139,25 @@ pub trait TransactionProcessingCallback {
Consumers can customize this plug-in to use their own Solana account source,
caching, and more.

### `SanitizedTransaction`
### `SVMTransaction`

A "sanitized" Solana transaction is a transaction that has undergone the
An SVM transaction is a transaction that has undergone the
various checks required to evaluate a transaction against the Solana protocol
ruleset. Some of these rules include signature verification and validation
of account indices (`num_readonly_signers`, etc.).

A `SanitizedTransaction` contains:

- `SanitizedMessage`: Enum with two kinds of messages - `LegacyMessage` and
`LoadedMessage` - both of which contain:
- `MessageHeader`: Vector of `Pubkey` of accounts used in the transaction.
- `Hash` of recent block.
- Vector of `CompiledInstruction`.
- In addition, `LoadedMessage` contains a vector of
`MessageAddressTableLookup` - list of address table lookups to
load additional accounts for this transaction.
- A Hash of the message
- A boolean flag `is_simple_vote_tx` - shortcut for determining if the
transaction is merely a simple vote transaction produced by a validator.
- A vector of `Signature` - the hash of the transaction message encrypted using
A `SVMTransaction` is a trait that can access:

- `signatures`: the hash of the transaction message encrypted using
the signing key (for each signer in the transaction).
- `static_account_keys`: Slice of `Pubkey` of accounts used in the transaction.
- `account_keys`: Pubkeys of all accounts used in the transaction, including
those from address table lookups.
- `recent_blockhash`: Hash of a recent block.
- `instructions_iter`: An iterator over the transaction's instructions.
- `message_address_table_lookups`: An iterator over the transaction's
address table lookups. These are only used in V0 transactions, for legacy
transactions the iterator is empty.

### `TransactionCheckResult`

Expand Down Expand Up @@ -245,10 +242,10 @@ Steps of `load_and_execute_sanitized_transactions`
- Return the replenished local program cache.

2. Load accounts (call to `load_accounts` function)
- For each `SanitizedTransaction` and `TransactionCheckResult`, we:
- For each `SVMTransaction` and `TransactionCheckResult`, we:
- Calculate the number of signatures in transaction and its cost.
- Call `load_transaction_accounts`
- The function is interwined with the struct `CompiledInstruction`
- The function is interwined with the struct `SVMInstruction`
- Load accounts from accounts DB
- Extract data from accounts
- Verify if we've reached the maximum account data size
Expand Down

0 comments on commit 65edb3d

Please sign in to comment.