Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Extract db-related logic from baseTrie #67

Closed
s1na opened this issue Jan 10, 2019 · 4 comments
Closed

Extract db-related logic from baseTrie #67

s1na opened this issue Jan 10, 2019 · 4 comments

Comments

@s1na
Copy link
Contributor

s1na commented Jan 10, 2019

In addition to MPT logic, BaseTrie also has methods for the underlying key-value db. This logic can be extracted to a separate class, to make BaseTrie more readable and reduce coupling. The methods include getRaw, 'putRaw, 'batchNodes, etc.

@holgerd77
Copy link
Member

Makes sense.

@s1na
Copy link
Contributor Author

s1na commented Jan 15, 2019

CheckpointTrie tries to implement checkpointing by inheriting BaseTrie. During #73 I noticed that this might not be the best design, and this manifests in _enterCpMode and _exitCpMode where methods of BaseTrie are patched dynamically.

I think after extracting DB-related logic to a separate class, the checkpointing mechanism could be moved to this class. This would remove the need for patching methods dynamically, all other implementations of Trie (including SecureTrie) could use checkpointing without explicitly inheriting CheckpointTrie, and it would be more easy to reason about.

@holgerd77
Copy link
Member

👍

@holgerd77
Copy link
Member

Closed by #74.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants