From 8ec25533bce01cabdeb0f02584f87574cfc073b9 Mon Sep 17 00:00:00 2001 From: Daniel Lamberger Date: Sat, 17 Feb 2024 14:16:25 +0200 Subject: [PATCH] accounts_cache uml --- nimbus/db/ledger/README.md | 108 +++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/nimbus/db/ledger/README.md b/nimbus/db/ledger/README.md index 5a2eec1d8..2d05793c7 100644 --- a/nimbus/db/ledger/README.md +++ b/nimbus/db/ledger/README.md @@ -1,3 +1,111 @@ +`accounts_cache.nim` class diagram +================================== + +```mermaid +classDiagram + + class AccountsCache { + AccountsTrie + SavePoint + WitnessCache + isDirty: bool + %% ripemdSpecial: bool + } + AccountsCache *-- SavePoint + AccountsCache *-- WitnessCache + + %% TBD: AccountsTrie + + class SavePoint { + parent Savepoint + cache + selfDestruct: EthAddress [] + %% logEntries: Log [] + %% AccessList + TransientStorage + TransactionState + } + SavePoint o-- SavePoint + SavePoint *-- cache + SavePoint *-- TransientStorage + SavePoint *-- TransactionState + + class cache { + EthAddress → RefAccount + EthAddress → RefAccount + ... + } + cache o-- "*" RefAccount + + class RefAccount { + Account + AccountFlags + code: seq[byte] + original: StorageTable + overlay: StorageTable + } + RefAccount o-- Account + RefAccount *-- "*" AccountFlag + RefAccount *-- StorageTable + + class Account { + nonce + balance + storageRoot + codeHash + } + + class AccountFlag { + <> + Alive + IsNew + Dirty + Touched + CodeLoaded + CodeChanged + StorageChanged + NewlyCreated + } + + class TransientStorage { + EthAddress → StorageTable + EthAddress → StorageTable + ... + } + TransientStorage *-- "*" StorageTable + + class StorageTable { + UInt256 → UInt256 + UInt256 → UInt256 + ... + } + + class TransactionState { + <> + Pending + Committed + RolledBack + } + + class WitnessCache { + EthAddress → WitnessData + EthAddress → WitnessData + ... + } + WitnessCache *-- WitnessData + + class WitnessData { + storageKeys: UInt256[] + codeTouched: bool + } + + + +``` + + + + The file `accounts_cache.nim` has been relocated ================================================