add_block deep-copies every account on every block
Les mainteneurs répondent en général sous 1 jour
@anshulchikhale30-p y travaille déjà.
Depuis le 10/11/2026.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 45/100
- Type d'issue
- Refactorisation
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- python
- Domaine
- backend, performance
Piste de recherche
Start with State.snapshot() in minichain/state.py and trace how Blockchain.add_block stores and uses snapshots during reorgs. The issue suggests recording only accounts changed in a block’s journal and rebuilding older states when needed. Done means snapshots avoid copying every account while preserving correct state after a reorg; the issue names no tests to run.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Problem
Every time a block is added, Blockchain.add_block saves a snapshot of the state for reorgs, and State.snapshot() (minichain/state.py) does a copy.deepcopy of the whole accounts dict. So each block costs time proportional to the total number of accounts, even when the block only touches a few of them.
Measurements
Time for one empty block vs. the snapshot copy alone (best of 5):
| Accounts | One block | Snapshot copy alone |
|---|---|---|
| 1,000 | 2.7 ms | 2.1 ms |
| 10,000 | 34.5 ms | 29.5 ms |
| 50,000 | 194.4 ms | 204.1 ms |
The copy is most of the cost of a block and grows linearly with the number of accounts.
Impact
Fine at MiniChain's current scale, but block processing slows down as the number of accounts grows.
Possible direction
A block only changes the accounts in its journal, so a snapshot could record just those accounts instead of copying everything. Older states would then be rebuilt from those changes when a reorg needs them.
- Langage dominant
- Python
- Étoiles
- 12
- Forks
- 27
- Merge moyen
- 2 min
- PR mergées (30 j)
- 1
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de StabilityNexus/MiniChain
-
[BUG]: Handle JSON-RPC notifications and empty batches correctlyPeut-être pris @Muneerali199 l’a pris il y a 10 jours. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
StabilityNexus/MiniChain#177 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
automatic-copyright-year: keep README copyright currentPeut-être pris @anshulchikhale30-p l’a pris il y a 7 jours. Ouvertedocumentation enhancement
Difficulté 3/5 Une demi-journée Accessibilité débutants 35/100
StabilityNexus/MiniChain#189 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulty: bound per-block EMA moves, add a difficulty floor, and preserve state across restartsPeut-être pris @anshulchikhale30-p l’a pris il y a 7 jours. Ouvertebug documentation enhancement
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
StabilityNexus/MiniChain#187 ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG]: Blocks on a different parent are classified INVALID and get the sender bannedPeut-être pris @kansalakshat l’a pris il y a 7 jours. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 35/100
StabilityNexus/MiniChain#185 ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG]: P2P sync downloads full 500-block chunks without headers-first validationPeut-être pris @anshulchikhale30-p l’a pris il y a 14 jours. Ouvertebug documentation enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
StabilityNexus/MiniChain#178 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de StabilityNexus/MiniChain
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
huggingface/datasets#9128 ·
Les mainteneurs répondent en général sous 1 jour
-
priority:low ready-for-dev
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
OpenHands/extensions#975 ·
Les mainteneurs répondent en général sous 1 jour
-
Function/dict state handlers can't supply provider-state injected values (`generate.provider_state`)Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
pact-foundation/pact-python#1789 ·
Les mainteneurs répondent en général sous 9 jours
-
documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
juandresrodca/AdminForge#66 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour