Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Refactor rootchain persistent storage#5

Merged
ainvaltin merged 2 commits intomainfrom
AB-1954-rootchain-storage
May 30, 2025
Merged

Refactor rootchain persistent storage#5
ainvaltin merged 2 commits intomainfrom
AB-1954-rootchain-storage

Conversation

@ainvaltin
Copy link
Copy Markdown
Contributor

This database is used by block store and SafetyModule, on disk it's the rootchain.db

Instead of generic KeyValueDB implement specific storage with type safe interface.

Provide basic framework for upgrading the database in the future.

Instead of generic KeyValueDB implement specific storage with type
safe interface. This databse is used by block store and SafetyModule,
on disk it's the rootchain.db

Provide basic framework for upgrading the database in the future.
@ainvaltin ainvaltin requested a review from MastaP May 28, 2025 11:20
@MastaP MastaP requested a review from RaimoMeltsas May 28, 2025 11:52
Comment thread rootchain/consensus/storage/db_migrate_test.go Outdated
The list is sorted in descending order of round number.
*/
func (db BoltDB) LoadBlocks() (blocks []*ExecutedBlock, err error) {
return blocks, db.db.View(func(tx *bbolt.Tx) error {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note, this db.db.* is bad for the eyes.

Comment thread rootchain/consensus/storage/block_tree.go
if err != nil {
return err
}
/* should we return error when attempting to set earlier round? ie
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mark as todo and add ticket number or remove.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it makes sense to create ticket (yet)... left this comment in as a reminder to think about this. As far as I can tell the original code just ignored the attempt "to go back" and always stored the max, could it break something if we return err or would it help to find bugs? 🤷

@ainvaltin ainvaltin merged commit f51bd61 into main May 30, 2025
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants