Skip to content

Commit

Permalink
SIMD-0220: Snapshots use Accounts Lattice Hash
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Jan 9, 2025
1 parent 781cfdd commit 75f4c7c
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions proposals/0220-snapshots-use-accounts-lattice-hash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
simd: '0220'
title: Snapshots use Accounts Lattice Hash
authors:
- Brooks Prumo
category: Standard
type: Core
status: Review
created: 2025-01-08
feature: LTsNAP8h1voEVVToMNBNqoiNQex4aqfUrbFhRH3mSQ2
development:
- Agave: Implemented (v2.2.0)
---

## Summary

Use the **Accounts Lattice Hash** as the **Snapshot Hash**, which enables
removing the merkle-based accounts hash calculation.


## Motivation

This SIMD follows on from SIMD-215, and shares its motivation:

> The main goal is to scale Solana to billions accounts
When snapshots are taken, they contain a **Snapshot Hash**. This hash is
based on the merkle-based hash of the total account state. As established in
SIMD-215, this merkle-based hashing of all accounts hinders scaling. And since
SIMD-215 added the **Accounts Lattice Hash**, which is a hash of the total
account state, the merkle-based hash of all accounts used in the current
**Snapshot Hash** is redundant work. The **Snapshot Hash** can be updated to
use the **Accounts Lattice Hash** instead.


## New Terminology

None.


## Detailed Design

When constructing the **Snapshot Hash**, the merkle-based hash of all accounts
will be replaced by the **Accounts Lattice Hash**. And since SIMD-215 removes
the **Epoch Accounts Hash**, the **Snapshot Hash** becomes:

```
snapshot_hash := accounts_lattice_hash.out()
```

Specifically, the **Snapshot Hash** for slot `S` is the 32-byte blake3 of the
**Accounts Lattice Hash** at slot `S`.

Note that SIMD-215 is a prerequisite for this SIMD.


## Alternatives Considered

None.


## Impact

Only validators will be impacted, and their performance will improve since the
merkle-based hashing of all accounts will no longer be performed.


## Security Considerations

None.


## Backwards Compatibility

Snapshots will have a new hash, so consumers of snapshots will need to know
which method to use for hash validation.

0 comments on commit 75f4c7c

Please sign in to comment.