Skip to content

doc: add account spec pages #5489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

doc: add account spec pages #5489

wants to merge 1 commit into from

Conversation

ripatel-fd
Copy link
Contributor

Adds information to guide account database and cache design.
This information is not reviewed, YMMV. May be useful in a real
spec later.

Adds information to guide account database and cache design.
This information is not reviewed, YMMV.  May be useful in a real
spec later.
### Program executions

A *program execution* is a type of account access that results from
transaction execution. The *program account* to execute is specified
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
transaction execution. The *program account* to execute is specified
transaction execution. The *program accounts* to execute are specified

### Sysvar reads

Certain accounts can be read at any time during runtime execution. This
includes the slot transition, native programs, and syscall handlers.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should define what a "slot transition" is or rephrase

When executing a slot, the runtime alternates between transaction
execution and miscellaneous system processing. The latter includes any
slot execution phase during which transactions are not executed. These
steps perform various writes to [*stored accounts*](#stored-accounts).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clarify that system accesses only happen in this aforementioned "miscellaneous system processing". (Or use a proper term to define that sort of system processing, like "slot freeze")

8. [Incinerator](#incinerator)
2. [System managed accounts](#system-managed-accounts)
1. [Slot sysvars](#slot-sysvars)
2. [Builtin accounts](#builtin-accounts)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm unsure about where we draw the distinction between "user writable accounts" and "system managed accounts". Perhaps, there is none ...

1. [Slot sysvars](#slot-sysvars)
2. [Builtin accounts](#builtin-accounts)

### Transparent Accounts
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Virtual account" sounds better

non-existent account when trying to read *transparent accounts*.

[*System writes*](#system-writes) to transparent accounts are inherently
undefined, since the written data would not persist.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reflink is broken (system-accesses instead), also clarify that these accesses don't exist because they are undefined

Ephemeral sysvars are transparent accounts that are accessible through
*sysvar reads*.

For more information, see [sysvars.md](./sysvars.md#slot-sysvars)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reflink should say txn-sysvars

Comment on lines +139 to +141
Most modifications are subject to permission checks. Increasing the
lamport value of an account always passes the permission checks of a
*user writable account*.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These permission checks are specific to the access type (transaction account access), not the account type.


### BPF program accounts

There are two type of *BPF program accounts*: *User BPF programs* and
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
There are two type of *BPF program accounts*: *User BPF programs* and
There are two types of *BPF program accounts*: *User BPF programs* and

- Transitioning a program between immutable/executable, and
mutable/non-executable incurs a one slot delay.

### Core BPF programs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This shouldn't be a separate section


Firedancer uses a **write-through** cache policy for these sysvars.

All writes to the above sysvars use the `fd_slot_sysvar_write` API, which:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably going to be called fd_sysvar_XXX_write

(FIXME clarify what happens when this is attempted)
- Never written to the account database
- Account reads via user transactions are redirected to a custom
callback (does not access the account database)
Copy link
Contributor Author

@ripatel-fd ripatel-fd Jun 28, 2025

Choose a reason for hiding this comment

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

Should add reference to account.md "virtual accounts", and add a rough summary what virtual accounts do

Copy link
Contributor Author

@ripatel-fd ripatel-fd Jun 30, 2025

Choose a reason for hiding this comment

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

  • Document cache behavior of "rent" bank field vs rent sysvar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants