ChainSafe / gossamer

🕸️ Go Implementation of the Polkadot Host
https://chainsafe.github.io/gossamer
GNU Lesser General Public License v3.0
427 stars 110 forks source link

feat(pkg/trie): TrieDB commits #4039

Closed dimartiro closed 1 day ago

dimartiro commented 2 weeks ago

Changes

This PR adds commit capability for trieDB to flush the temporary changes into the underlying DB. It works by traversing the temporary changes contained in deathRow for deletions and in storage for upserts, to delete, insert, or update them in our DB.

Summary of changes

Tests

make test

Issues

closes: #3993, #3927

dimartiro commented 1 day ago
  • I don't like the use of panics. It's an attack vector in blockchains, we should avoid it as much as we can. I have tried to point out where I saw, but if there are more instances, please change it unless it's absolutely necessary.
  • There are very few comments. We could do with a lot more comments here. I remember we needed a comment on everything exported. Is that not the case anymore? Did we remove that from make lint?

Thanks Kishan, regarding the panics, I followed the same logic Parity has here However since this code is not used yet, I want to revisit all this panics in a different PR, we already have an issue for that #3942, since it could imply some refactor and I don't want to block Tim now. So I gonna resolve all those comments and address them later in #3942

Regarding the godoc, I'll add the missing docs and check the linter to see why it isn't complying about it.

Thank you!