Skip to content

[WIP] Add Trie Cache warm-up test#8644

Closed
AndreiEres wants to merge 78 commits intomasterfrom
AndreiEres/trie-warmup-test
Closed

[WIP] Add Trie Cache warm-up test#8644
AndreiEres wants to merge 78 commits intomasterfrom
AndreiEres/trie-warmup-test

Conversation

@AndreiEres
Copy link
Copy Markdown
Contributor

@AndreiEres AndreiEres commented May 26, 2025

Follow up for #7556

For tests we use v15 westend-asset-hub metadata. This one doesn’t work with the old version of subxt, which we use in polkadot-sdk: metadata types break the subxt macro.

Blocking issue for the test: #8592

@AndreiEres AndreiEres requested review from a team as code owners May 26, 2025 08:34
@github-actions
Copy link
Copy Markdown
Contributor

Review required! Latest push from author must always be reviewed

@AndreiEres AndreiEres force-pushed the AndreiEres/trie-warmup-test branch from 6b05dea to 309c1ca Compare May 26, 2025 08:42
@AndreiEres AndreiEres force-pushed the AndreiEres/trie-warmup-test branch from 309c1ca to 4f2c6e2 Compare May 26, 2025 08:44
@AndreiEres AndreiEres changed the base branch from master to AndreiEres/trie-warmup May 26, 2025 08:53
@AndreiEres AndreiEres changed the base branch from AndreiEres/trie-warmup to master May 26, 2025 08:54
github-merge-queue bot pushed a commit that referenced this pull request May 28, 2025
# Description
Fixes #7533.

Part of launching smart contracts on AssetHub. The current task involves
warming up the state and performing sanity checks to ensure that memory
usage remains within reasonable limits; otherwise, it should abort
gracefully.

Here is a breakdown of the task by parts: 
- **Configuration.** We use a CLI flag to trigger the warm up. To
increase the cache size, we use an existing flag.
- **Warm-up.** We populate the trie cache with values from the database
using a best hash as a storage root. For normal use we spawn a
background task for it, for testing purposes we warm up in a blocking
manner.
- **Sanity checks.** If we find that the configured cache size is too
large, we warn.

Variants of the added flag:
| Flag | Meaning |

|---------------------------------|---------------------------------------------|
| [no flag] | no warm-up |
| warm-up-trie-cache | non-blocking warmup |
| warm-up-trie-cache non-blocking | non-blocking warmup (same as just
the flag) |
| —warm-up-trie-cache blocking | blocking warmup |

## Integration
Tested on a snapshot from polkadot-asset-hub: 5426064 keys, ~900MIB
state. Populating Trie cache takes 1.5–2 minutes on Macbook Pro M2.

## Aditional Notes
Initially, we thought about putting the entire state into memory using a
CLI flag or a runtime parameter, but decided against it. That’s up to
collators to decide on which setup run their machines, they can use the
current cache size setting to increase the throughput.

## Todos
Testing moved to #8644

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexandru Gheorghe <49718502+alexggh@users.noreply.github.com>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
@paritytech-workflow-stopper
Copy link
Copy Markdown

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/15389143870
Failed job name: cargo-clippy

pgherveou pushed a commit that referenced this pull request Jun 11, 2025
# Description
Fixes #7533.

Part of launching smart contracts on AssetHub. The current task involves
warming up the state and performing sanity checks to ensure that memory
usage remains within reasonable limits; otherwise, it should abort
gracefully.

Here is a breakdown of the task by parts: 
- **Configuration.** We use a CLI flag to trigger the warm up. To
increase the cache size, we use an existing flag.
- **Warm-up.** We populate the trie cache with values from the database
using a best hash as a storage root. For normal use we spawn a
background task for it, for testing purposes we warm up in a blocking
manner.
- **Sanity checks.** If we find that the configured cache size is too
large, we warn.

Variants of the added flag:
| Flag | Meaning |

|---------------------------------|---------------------------------------------|
| [no flag] | no warm-up |
| warm-up-trie-cache | non-blocking warmup |
| warm-up-trie-cache non-blocking | non-blocking warmup (same as just
the flag) |
| —warm-up-trie-cache blocking | blocking warmup |

## Integration
Tested on a snapshot from polkadot-asset-hub: 5426064 keys, ~900MIB
state. Populating Trie cache takes 1.5–2 minutes on Macbook Pro M2.

## Aditional Notes
Initially, we thought about putting the entire state into memory using a
CLI flag or a runtime parameter, but decided against it. That’s up to
collators to decide on which setup run their machines, they can use the
current cache size setting to increase the throughput.

## Todos
Testing moved to #8644

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexandru Gheorghe <49718502+alexggh@users.noreply.github.com>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
@AndreiEres
Copy link
Copy Markdown
Contributor Author

Included to #7979

@AndreiEres AndreiEres closed this Jun 30, 2025
@AndreiEres AndreiEres deleted the AndreiEres/trie-warmup-test branch June 30, 2025 13:22
alvicsam pushed a commit that referenced this pull request Oct 17, 2025
# Description
Fixes #7533.

Part of launching smart contracts on AssetHub. The current task involves
warming up the state and performing sanity checks to ensure that memory
usage remains within reasonable limits; otherwise, it should abort
gracefully.

Here is a breakdown of the task by parts: 
- **Configuration.** We use a CLI flag to trigger the warm up. To
increase the cache size, we use an existing flag.
- **Warm-up.** We populate the trie cache with values from the database
using a best hash as a storage root. For normal use we spawn a
background task for it, for testing purposes we warm up in a blocking
manner.
- **Sanity checks.** If we find that the configured cache size is too
large, we warn.

Variants of the added flag:
| Flag | Meaning |

|---------------------------------|---------------------------------------------|
| [no flag] | no warm-up |
| warm-up-trie-cache | non-blocking warmup |
| warm-up-trie-cache non-blocking | non-blocking warmup (same as just
the flag) |
| —warm-up-trie-cache blocking | blocking warmup |

## Integration
Tested on a snapshot from polkadot-asset-hub: 5426064 keys, ~900MIB
state. Populating Trie cache takes 1.5–2 minutes on Macbook Pro M2.

## Aditional Notes
Initially, we thought about putting the entire state into memory using a
CLI flag or a runtime parameter, but decided against it. That’s up to
collators to decide on which setup run their machines, they can use the
current cache size setting to increase the throughput.

## Todos
Testing moved to #8644

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexandru Gheorghe <49718502+alexggh@users.noreply.github.com>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
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.

1 participant