Skip to content

Commit

Permalink
Update trie.md (#9159)
Browse files Browse the repository at this point in the history
Just some better documentation
  • Loading branch information
Shreyan Gupta authored Oct 24, 2023
1 parent fdf1cd0 commit 994fd9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/architecture/how/gc.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ We run a single ‘round’ of GC after a new block is accepted to the chain - a
in order not to delay the chain too much, we make sure that each round removes
at most 2 blocks from the chain.

For more details look at function `clear_data()` in file `chain/chain/src/chain.rs`

## How it works:

Imagine the following chain (with 2 forks)
Expand Down
4 changes: 3 additions & 1 deletion docs/architecture/storage/trie.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ trie nodes using the `get_key_from_shard_id_and_hash` method.

### ShardTries

Contains stores and caches and allows to get `Trie` object for any shard.
This is the main struct that is used to access all Tries. There's usually only a single instance of this and it contains stores and caches. We use this to gain access to the `Trie` for a single shard by calling the `get_trie_for_shard` or equivalent methods.

Each shard within `ShardTries` has their own `cache` and `view_cache`. The `cache` stores the most frequently accessed nodes and is usually used during block production. The `view_cache` is used to serve user request to get data, which usually come in via network. It is a good idea to have an independent cache for this as we can have patterns in accessing user data independent of block production.

## Primitives

Expand Down

0 comments on commit 994fd9b

Please sign in to comment.