Closed maan2003 closed 1 month ago
The update introduces a comprehensive system for managing metadata within the fedimint-client
, including the ability to store, update, and manage metadata fields. A new dependency, reqwest
, is added to facilitate external metadata fetching. The changes span across multiple files, establishing structures and mechanisms for handling metadata, including a MetaManager
for orchestrating metadata sources and updates, and a Waiter
module in fedimint-core
for asynchronous task management. This enhancement enriches the client's functionality with dynamic metadata management capabilities.
File(s) | Summary |
---|---|
fedimint-client/Cargo.toml |
Added reqwest dependency with specific features and default features disabled. |
fedimint-client/src/db.rs |
Introduced ClientMetaField enum variant and related functionality for database meta fields. |
fedimint-client/src/lib.rs , .../init.rs |
Added MetaManager to Client and ClientBuilder ; updated method implementations. |
fedimint-client/src/meta.rs |
Added functionality for managing metadata sources and values. |
fedimint-core/src/task/waiter.rs |
Introduced a Waiter struct for asynchronous task waiting. |
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
in 0.5 maybe we will fire the manager
in 0.5 maybe we will fire the manager
In my experience it's very hard to fire a manager. They tend to fire you instead, and then.
The moment you introduce a first manager, you set in motion a fault-tolerant system that is impossible to stop, and you get Manager Directory and VPs really quick.
Just saying...
what is worse meta managers or Meta services?
fedimint now has Meta services integrated for telemetry :smile:
changes: priority is not for source, but for values now
found a bug, sources can never remove values from meta
edit: now fixed
In my mind if the Federation config has a module with meta
kind, the client can just ignore other metas. Merging anything should be avoided.
I bet the reason for all complexity here is because people are really set on reusing meta module for this gateway vetting, which doesn't really fit here. LN module should keep track of it's vetted gateway on its own.
It creates dependencies between modules, will have a different lifecycle, etc.
Eg. LN module can just have an admin endpoint for guardians to vet/ban gateways, and return such info on a dedicated LN-module endpoint. Clients can fetch and cache such list when they need it. So if you don't make LN payements, you don't need to check anything every 10 minutes. All sorts of smarter and more agile things can be done then - e.g. count number of guardians vetting things, require different amount of thresholds, etc. While meta module is specifically for slow-moving meta information. All without any inter-module dependencies.
@elsirion @maan2003
LN module should keep track of it's vetted gateway on its own.
too late :/ we already cut a 0.3 with vetted gateways in meta
wasn't meta module meant as storage for other modules
we even thought of storing registered gateways in meta module
Lots of changes. there is only one meta source instead of multiple. MetaSource is now responsible for merge and retrying
In my mind if the Federation config has a module with
meta
kind, the client can just ignore other metas. Merging anything should be avoided.
That's a good point actually. Initially my idea was that we want a smooth transition, but that's not actually the case before 0.4 the earliest: new federations will use the meta module while old ones have to continue using the override file.
If we were to automatically add the meta module to existing federations having the merge behavior would be important imo to not accidentally remove all the meta fields from a user's pov.
I bet the reason for all complexity here is because people are really set on reusing meta module for this gateway vetting
I don't think that has much to do with it, just the thought of requiring two client restarts to get the latest meta values is unappealing (first: fetch values on start, but still return old ones to not block, second: actually return new ones). Then the natural conclusion is we need an update in the background that can communicate to the frontend once new values have arrived. At that point, why not just let the updater run continuously for slightly more timely changes on the client side (it's basically free compared to the other shenanigans we do in state machines).
That observation that vetted gateways don't need consensus is correct imo, could just be a per-guardian endpoint and then the client counts which GW comes out on top.
we already cut a 0.3 with vetted gateways in meta
Aaaagh! :D
wasn't meta module meant as storage for other modules
No... As a name of the module suggest, it is supposed to be a replacement for "metadata" about Federation that guardians can update over time, without using centralized place. It supports max 256 key-value pairs, and these were added for potential stuff like ... uploading an logo or some other static assets, not to compete with redis.
We probably have put LN vetting gateways in external meta, as a hack "because it can be easily updated". Now hacks get married, have kids, the kids get ID, voting rights...
we even thought of storing registered gateways in meta module
I don't even...
new federations will use the meta module while old ones have to continue using the override file.
Note: even if existing Federations could add meta module, they could just put existing meta into meta module and thus switch right into it atomically. Then after some time (Clients get to see it) just delete the whole external module (can't delete the one in config, I guess, but otherwise also could be done).
If we were to automatically add the meta module to existing federations having the merge behavior would be important imo to not accidentally remove all the meta fields from a user's pov.
Meta module keys start with uninitialized value, so even right after being addded (if it was possible), the client can tell that nothing was set yet and fallaback to previous sources.
I don't think that has much to do with it, just the thought of requiring two client restarts to get the latest meta values is unappealing (first: fetch values on start, but still return old ones to not block, second: actually return new ones).
I was just thinking yesterday, that we could add to ClientModuleInit
an ability to flag that they don't ever need any recover and thus can be initialized immediately, avoiding the restart after the recovery.
Either a fn ClientModuleInit::needs_recovery() -> bool
or just fn ClientModuleINit::recover(...) -> Option<impl Future<...>>
where None
means, I'm done, no need to wait.
it's basically free compared to the other shenanigans we do in state machines
Most state machines should be chatty for a couple of minutes of activity and wrap it up, or go to a long, long sleep. Otherwise people will complain about batter life, and that might matter a lot in rural areas on second hand old phones.
That observation that vetted gateways don't need consensus is correct imo, could just be a per-guardian endpoint and then the client counts which GW comes out on top.
If e.g. a gateway missbehaves it might take a really inconvenient time to gather threshold amount of votes to change the meta keys, while
significantly changed revision see: https://github.com/fedimint/fedimint/compare/c2079950dba1f86145e1b5554b4bf421bb0b3818..d61300fb2b05c49be84fa9b9e0ac093e85d90b25
Backport failed for releases/v0.3
, because it was unable to cherry-pick the commit(s).
Please cherry-pick the changes locally and resolve any conflicts.
git fetch origin releases/v0.3
git worktree add -d .worktree/backport-4768-to-releases/v0.3 origin/releases/v0.3
cd .worktree/backport-4768-to-releases/v0.3
git switch --create backport-4768-to-releases/v0.3
git cherry-pick -x 6697b722b063fd9a25664c55f9e2dead6774a9a7
implement meta caching and updating
left for follow-up:
on top of #4783
Summary by CodeRabbit
New Features
Enhancements
Refactor