Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.rs linguist-language=Rust
Cargo.toml linguist-language=Rust
Cargo.lock linguist-language=Rust
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
Cargo.lock
AGENTS.md
CLAUDE.md
40 changes: 40 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
members = ["solana/account"]
resolver = "3"

[workspace.package]
Expand All @@ -10,6 +11,45 @@ repository = "https://github.com/magicblock-labs/engine"
rust-version = "1.94.1"
version = "0.1.0"

[workspace.dependencies]
magic-root-interface = { path = "programs/magic-root-interface" }
magic-root-program = { path = "programs/magic-root-program" }
solana-account = { path = "solana/account" }

ahash = "0.8.12"
arc-swap = "1.9.1"
bincode = "1.3.3"
bitflags = "2.11.1"
blake3 = "1.8.5"
qualifier_attr = "0.2.2"
rand = "0.8.5"
rustix = { version = "1.1.4" }
serde = "1.0.228"
serde_bytes = "0.11.19"
serde_with = { version = "3.21.0", default-features = false }
snedfile = "0.1"
tar = "0.4.45"
tempfile = "3"
thiserror = "2.0.17"
tracing-subscriber = { version = "0.3.23", features = ["env-filter", "fmt"] }
wincode = "0.5.1"
zstd = { version = "0.13.3", default-features = false }

agave-feature-set = { version = "3.1.14", features = ["agave-unstable-api"] }
agave-transaction-view = { version = "3.1.13", features = ["agave-unstable-api"] }
solana-account-info = "3.1.1"
solana-clock = "3.1.0"
solana-compute-budget-instruction = "=4.1.1"
solana-cpi = "3.1.0"
solana-hash = "4.3.0"
solana-instruction-error = "2.3.0"
solana-program-error = "3.0.1"
solana-pubkey = "4.2.0"
solana-sdk-ids = "3.1.0"
solana-sysvar = "4.0.0"
solana-transaction-error = "3.2.0"


[workspace.lints.rust]
missing_docs = "deny"
rust_2018_idioms = { level = "warn", priority = -1 }
Expand Down
37 changes: 14 additions & 23 deletions solana/account/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,40 +1,28 @@
[package]
name = "solana-account"
description = "Solana Account type"
documentation = "https://docs.rs/solana-account"
version = "4.3.1"

authors = { workspace = true }
repository = { workspace = true }
description = "Solana Account type"
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]
readme = "README.md"
repository = { workspace = true }
version = "4.3.1"

[features]
bincode = ["dep:bincode", "dep:solana-sysvar", "serde"]
wincode = ["dep:wincode", "solana-pubkey/wincode"]
dev-context-only-utils = ["bincode", "dep:qualifier_attr"]
frozen-abi = [
"dep:solana-frozen-abi",
"dep:solana-frozen-abi-macro",
"solana-pubkey/frozen-abi",
]
serde = ["dep:serde", "dep:serde_bytes", "dep:serde_derive", "solana-pubkey/serde"]
serde = ["dep:serde", "dep:serde_bytes", "serde/rc", "solana-pubkey/serde"]
testkit = ["bincode"]
wincode = ["bincode", "dep:wincode", "solana-pubkey/wincode"]

[dependencies]
bincode = { workspace = true, optional = true }
qualifier_attr = { workspace = true, optional = true }
bitflags = { workspace = true, features = ["serde"] }
serde = { workspace = true, optional = true }
serde_bytes = { workspace = true, optional = true }
serde_derive = { workspace = true, optional = true }
solana-account-info = { workspace = true }
solana-clock = { workspace = true }
solana-frozen-abi = { workspace = true, optional = true, features = ["frozen-abi"] }
solana-frozen-abi-macro = { workspace = true, optional = true }
solana-instruction-error = { workspace = true }
solana-pubkey = { workspace = true }
solana-sdk-ids = { workspace = true }
Expand All @@ -43,5 +31,8 @@ thiserror = { workspace = true }
wincode = { workspace = true, features = ["alloc"], optional = true }

[dev-dependencies]
solana-account = { path = ".", features = ["dev-context-only-utils"] }
solana-account = { path = ".", features = ["testkit"] }
solana-pubkey = { workspace = true, features = ["std"] }

[lints]
workspace = true
39 changes: 39 additions & 0 deletions solana/account/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# `solana-account`

This fork defines the engine's account representation. `Account` is the
fully-owned compatibility form. `AccountSharedData` uses either a heap-owned
`Arc<Vec<u8>>` or a borrowed view into aligned external storage and records
field-level dirty markers.

Equality compares core state and data bytes, ignoring storage form and dirty
markers.

`AccountMode::mutable()` identifies modes writable by user programs.
`AccountMode::persistent()` separately identifies delegated, ephemeral, and
transient state that higher layers retain in persistent storage.
`AccountSharedData::set_mode()` is the authoritative lifecycle transition
check: read-only and placeholder accounts may enter any mode except transient,
delegated accounts may enter transient, and transient accounts may resolve to
read-only. Ephemeral accounts may close. Reapplying the current mode is a clean
no-op; invalid mode and slot transitions return `AccountPatchError` with their
source and target context without changing the account.

Slot patches must advance the stored slot. An equal slot is accepted only after
the mode genuinely changed in the same transaction.

## Borrowed layout

| Part | Position | Contents |
| --- | --- | --- |
| header | start | sequence and image size |
| pubkey | after header | shared account pubkey |
| image A | after pubkey | core state and data |
| image B | after image A | core state and data |

Borrowed buffers must be 8-byte aligned, match this layout, remain live, and have
unique mutable access for the duration of the borrow. The source may be an mmap,
arena, or test buffer.

The sequence counter selects the active image. Mutation translates active state
into the shadow image; commit advances the sequence to publish it. Writes that
exceed borrowed capacity promote the account to owned storage.
Loading