Skip to content

Commit 1477920

Browse files
authored
docs: document parallel execution across authorities (#48)
Per-authority PDA design means different authorities on the same wallet can execute transactions concurrently on Solana's runtime. Only the authority PDA is writable (counter increment); wallet and vault are read-only during Execute, creating no shared write locks.
1 parent 3eb7134 commit 1477920

3 files changed

Lines changed: 44 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ A high-performance smart wallet program on Solana with passkey (WebAuthn/Secp256
1616
- **Zero-Copy Serialization**: Raw byte casting via pinocchio, no Borsh overhead
1717
- **CompactInstructions**: Index-based instruction packing for multi-call payloads within Solana's 1,232-byte tx limit
1818
- **Deferred Execution**: 2-transaction flow for payloads exceeding the tx limit (e.g., Jupiter swaps) -- TX1 authorizes via signature, TX2 executes with full inner instruction space (~1,100 bytes)
19+
- **Parallel Execution**: Different authorities on the same wallet execute concurrently -- per-authority PDA means no shared write locks
1920
- **CPI Reentrancy Protection**: stack_height check prevents cross-program authentication attacks
2021

2122
---

docs/Architecture.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,35 @@ Seeds: `["vault", wallet_pubkey]`
139139

140140
No data allocated. Holds SOL. Program signs for it via PDA seeds during Execute.
141141

142+
## Parallel Execution
143+
144+
A key design property: **different authorities on the same wallet can execute transactions in parallel** on Solana's runtime.
145+
146+
### Why it works
147+
148+
During Execute, the only account written to is the **authority PDA** (odometer counter increment). The wallet PDA and vault PDA are read-only:
149+
150+
| Account | Access | Shared across authorities? |
151+
|---|---|---|
152+
| Authority PDA | **Writable** (counter++) | No -- each authority has its own PDA |
153+
| Wallet PDA | Read-only | Yes, but no write lock |
154+
| Vault PDA | Signer-only (CPI) | Yes, but no write lock |
155+
156+
Since each authority is a separate PDA, Solana's scheduler sees no writable overlap and runs them concurrently.
157+
158+
### Parallelism matrix
159+
160+
| Scenario | Parallel? | Reason |
161+
|---|---|---|
162+
| Authority A + Authority B (same wallet) | Yes | Different writable PDAs |
163+
| Session key + Secp256r1 authority (same wallet) | Yes | Different writable PDAs |
164+
| Same authority, 2 transactions | No | Same writable PDA + counter conflict |
165+
| Authority A (wallet 1) + Authority B (wallet 2) | Yes | Entirely separate accounts |
166+
167+
### Design implication
168+
169+
This enables high-throughput wallets where multiple authorized parties (e.g., an admin managing permissions while a spender sends payments, or multiple session keys operating concurrently) never block each other. The per-authority odometer counter provides replay protection without creating a shared bottleneck.
170+
142171
## 5. Instructions (9 total)
143172

144173
### CreateWallet (discriminator: 0)

docs/Costs.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,20 @@ The Secp256r1 Execute transaction was optimized from **708 bytes to 658 bytes**
102102

103103
---
104104

105+
## Parallel Execution
106+
107+
Different authorities on the same wallet can execute transactions **in parallel** on Solana's runtime. This is possible because each authority has its own PDA -- the only writable account during Execute is the authority PDA (counter increment), while wallet and vault are read-only.
108+
109+
| Scenario | Parallel? |
110+
|---|---|
111+
| Authority A + Authority B (same wallet) | Yes -- different writable PDAs |
112+
| Session key + Secp256r1 authority | Yes -- different writable PDAs |
113+
| Same authority, 2 transactions | No -- counter conflict on same PDA |
114+
115+
This means a wallet can have multiple session keys, spenders, and admins operating concurrently without blocking each other. See [Architecture.md](Architecture.md) for the full account access analysis.
116+
117+
---
118+
105119
## Rent-Exempt Costs
106120

107121
Solana requires accounts to maintain a minimum balance (rent-exempt) based on data size. The formula is `(128 + data_size) * 3,480 * 2` lamports.

0 commit comments

Comments
 (0)