Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mint-client): include federation join info in OOBNotes #4231

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

elsirion
Copy link
Contributor

@elsirion elsirion commented Feb 4, 2024

Fixes #4048

Copy link

codecov bot commented Feb 4, 2024

Codecov Report

Attention: 35 lines in your changes are missing coverage. Please review.

Comparison is base (5a941b7) 57.94% compared to head (41d1920) 58.05%.
Report is 2 commits behind head on master.

Files Patch % Lines
fedimint-cli/src/client.rs 0.00% 16 Missing ⚠️
fedimint-client/src/module/mod.rs 0.00% 13 Missing ⚠️
modules/fedimint-mint-client/src/lib.rs 96.18% 5 Missing ⚠️
fedimint-load-test-tool/src/common.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4231      +/-   ##
==========================================
+ Coverage   57.94%   58.05%   +0.10%     
==========================================
  Files         197      197              
  Lines       43414    43563     +149     
==========================================
+ Hits        25157    25290     +133     
- Misses      18257    18273      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@elsirion elsirion marked this pull request as ready for review February 4, 2024 12:23
@elsirion elsirion requested a review from a team as a code owner February 4, 2024 12:23
@@ -110,11 +119,25 @@ impl OOBNotes {
])
}

pub fn new_with_invite(notes: TieredMulti<SpendableNote>, invite: InviteCode) -> Self {
Self(vec![
// FIXME: once we can break compatibility with 0.2 we can remove the prefix in case an
Copy link
Member

Choose a reason for hiding this comment

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

maybe FIXME(0.2) so we can grep for it later

@@ -92,6 +93,14 @@ pub struct OOBNotes(Vec<OOBNotesData>);
enum OOBNotesData {
Copy link
Member

Choose a reason for hiding this comment

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

OOBNotesData was a good idea!

Comment on lines +440 to +450
let cfg = self.get_config().global;
let (any_guardian_id, any_guardian_url) = cfg
.api_endpoints
.iter()
.next()
.expect("A federation always has at least one guardian");
InviteCode::new(
any_guardian_url.url.clone(),
*any_guardian_id,
cfg.federation_id(),
)
Copy link
Member

Choose a reason for hiding this comment

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

would be nice to also have this function on config type

/// Invite code to join the federation by which the e-cash was issued
///
/// Introduce in 0.3.0
Invite {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is present the FederationIdPrefix is redundant, though we might start to omit it in some future. Though we might already change code that uses FederationIdPrefix to use see if Invite is available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this a documentation request?

Copy link
Contributor

Choose a reason for hiding this comment

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

No. Code request, unless I'm missing something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pub fn federation_id_prefix(&self) -> FederationIdPrefix {
self.0
.iter()
.find_map(|data| match data {
OOBNotesData::FederationIdPrefix(prefix) => Some(*prefix),
OOBNotesData::Invite { federation_id, .. } => Some(federation_id.to_prefix()),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dpc feels like this is what you were asking for in your comment?

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@dpc dpc enabled auto-merge February 5, 2024 04:23
@dpc dpc added this pull request to the merge queue Feb 5, 2024
Merged via the queue into fedimint:master with commit ec2034e Feb 5, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E-cash should optionally contain invite code
3 participants