sea-orm integration + rust-lightning persitence layer#95
Open
dcorral wants to merge 5 commits into
Open
Conversation
60ab584 to
8aceb21
Compare
Member
|
@dcorral could you please rebase this PR? |
8aceb21 to
f71fb32
Compare
Author
|
@zoedberg done! |
84b0895 to
b67a1ff
Compare
zoedberg
requested changes
Apr 13, 2026
Member
zoedberg
left a comment
There was a problem hiding this comment.
Thanks! In addition to the requested changes please
- commit the
src/database/entities/prelude.rsfile that gets generated by sea-orm-cli - add the migration cargo lock file to the
.gitignorefile and remove the file - do not make changes to
src/database/entities/mod.rssince its autogenerated by sea-orm-cli - I know you took inspiration from rgb-lib when creating aliases like ChannelPeerActMod, but I saw this is not the best/recommended approach so please drop the aliases (see rgb-multisig-hub to see what is the best way to use the DB utility objects)
- as requested in the rust-lightning PR, please keep only essential comments
P.S this is not a final review, will do another one after these requests have been addressed
| .expect("Failed to create database tokio runtime") | ||
| }); | ||
|
|
||
| pub(crate) fn block_on<F>(future: F) -> F::Output |
Member
There was a problem hiding this comment.
I think we should use the DB in an async way (see comment in the rust-lightning PR) and drop this entire file
| manager | ||
| .create_table( | ||
| Table::create() | ||
| .table(Mnemonic::Table) |
Member
There was a problem hiding this comment.
Can't we save the mnemonic in the Config table?
| .not_null() | ||
| .primary_key(), | ||
| ) | ||
| .col(ColumnDef::new(Config::Value).string().not_null()) |
Member
There was a problem hiding this comment.
Instead of saving values as strings in multiple rows I think it's better to have a single row DB table with one column per value using the appropriate type for each column (see how we did this in rgb-multisig-hub)
e4c7942 to
8bdceb4
Compare
8bdceb4 to
a92fa60
Compare
b473b17 to
f956780
Compare
f956780 to
4c7960b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces file-based persistence with SQLite database using sea-orm ORM.
Changes
New database tables:
mnemonic- encrypted mnemonic storagekv_store- LDK persistence (channel manager, payments, swaps, network graph, scorer)config- configuration key/value pairs (indexer_url, proxy_url, etc.)revoked_token- revoked auth token IDschannel_peer- channel peer pubkey/address mappingMigrated to database:
Architecture:
DatabaseConnectionviaArcSeaOrmKvStoreimplements rust-lightning'sKVStoreSynctraitrust-lightning submodule (
961313c→b061470):KVStoreSynctrait across 8 filesrgb_utils/mod.rs: replaced file I/O (read_rgb_transfer_info,write_rgb_transfer_info,parse_rgb_payment_info,get_rgb_channel_info_path) with KVStore namespace-based read/write operations usingRGB_PRIMARY_NS+ secondary namespaces (channel_info,payment_info_inbound,payment_info_outbound,transfer_info, etc.)ChannelContext,ChannelManager,OutboundPayments,KeysManager: addedrgb_kv_store: Arc<dyn KVStoreSync + Send + Sync>field, threaded through constructors and deserializationcolor_commitment,color_htlc,color_closing: now take&dyn KVStoreSyncinstead of reading files directlyis_channel_rgb,get_rgb_channel_info,rename_rgb_files,filter_first_hops,is_payment_rgb: switched from path-based lookups to KVStore readsIMPORTANT!
This PR depends on RGB-Tools/rust-lightning#17 and .submodule must be updated to point to the right RGB-Tools fork before merging