Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions proposals/0192-transaction_account_resolution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
simd: '0192'
title: Relax Transaction Account Resolution
authors:
- Andrew Fitzgerald (Anza)
category: Standard
type: Core
status: Review
created: 2024-11-06
feature:
supersedes:
superseded-by:
extends:
---

## Summary

This proposal aims to relax certain transaction errors related to the account
keys used in a transaction, from protocol violations to runtime errors.

## Motivation

The current transaction constraints are overly restrictive and add complexity
to the protocol. Specifically the constraints that require account-state
in order to validate a block due to lookup tables. This account-state
dependence makes both block-production and block-validation more complex than
necessary.

## New Terminology

These terms are used elsewhere, but are defined here for clarity:

- Protocol Violating Transaction Error: A transaction error that violates the
protocol. This class of errors must result in the entire block being rejected
by the network.
- Runtime Transaction Error: A transaction error that results in a failed
transaction, and may be included in the block. These transactions still
incur transaction fees, and nonce advancements.

## Detailed Design

The current protocol requires that the the account keys used in a transaction:

1. Contain no duplicate account keys,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a transaction includes a key twice, does it get charged for the write lock once or twice?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarified below - account key values are not considered for transaction-cost calculation, just the number of write locks requested.
Transactions violating the constraints are treated the same as "fee-only" transactions are currently for the cost-model.

2. All address lookup tables must be resolvable:
- The address lookup table account must exist.
- The address lookup table account must be owned by the address lookup
table program: `AddressLookupTab1e1111111111111111111111111`
- The address lookup table account data must be deserializable into
`AddressLookupTable` as defined in `solana-sdk`.
- All account table indices specified in the transaction must be less than
the number of active addresses in the address lookup table.

This proposal seeks to relax these constraints from protocol violation errors
to runtime errors.
This means that transactions that break any of these constraints may be
included in a block, if they are otherwise valid.
Such transactions do not need to attempt any further loading or execution; they
need only to pay fees and advance the nonce.
Such transactions must have transaction costs for block-limits applied only
to the fee-payer and nonce accounts, since execution will not even be
attempted.
Comment on lines +60 to +62
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely a corner case, but we should probably specify it: if the fee payer and nonce accounts are duplicates of each other, does the write lock cost get applied once or twice?

Once makes more sense, but requires an extra check. Twice is more natural from an implementation perspective. I think either is fine, but it just needs to be specified.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for (very) slow response! If the nonce & fee-payer are the same acct, write lock costs are applied once, as is the case today. Nonce is just a reference to an acct index like any other, so this feels the most straight-forward imo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3fb21b1 LMK if this added sentence is clear.

In the case the fee-payer and nonce are the same account, costs are applied
only once, as is currently done for valid and successful transactions.
Transaction-cost calculation is unchanged, and calculated as if the transaction
were a "fee-only" transaction.

## Alternatives Considered

- Do nothing
- This is the simplest option, as we could leave the protocol as is.
However, this leaves the protocol more complex than it needs to be.
- Relax additional constraints:
- SIMD-0082 sought to relax additional constraints, but has not been
accepted. This proposal is a subset of SIMD-0082, intended to make the
review process simpler and faster. Therefore, we have decided to keep
this proposal focused specifically on certain loading failures.

## Impact

- Transactions that would previously have been dropped with a protocol
violation error can now be included and will be charged fees.
- Users must be more careful when constructing transactions to ensure the
account keys requested are valid.

## Security Considerations

None

## Drawbacks

- Users must be more careful about what they sign, as they will be charged fees
for transactions that are included in a block, even if they are not executed.
- This will likely break a lot of tooling, such as explorers, which may expect
all transactions to attempt execution.

## Backwards Compatibility

This proposal is backwards compatible with the current protocol, since it only
relaxes constraints, and does not add any new constraints. All previously valid
blocks would still be valid. However, new blocks may not be valid under the old
protocol.
Loading