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

Simplify NetworkIdentity type #6666

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

eddyashton
Copy link
Member

Following #6660, this PR simplifies the NetworkIdentity type by flattening it to a single type. The core of the changes are those in identity.h, which removes ReplicatedNetworkIdentity and several fields from NetworkIdentity. This touches a bunch of other files for 2 reasons:

  • Moved COSESignaturesConfig under the ccf:: namespace, since it is in a public header.
  • Rather than accessing cose_signatures_config from NetworkIdentity, the /join endpoint in node_frontend.h now accesses the single instance stored in/owned by history.h, which takes a few hops to reach. I think some of these hops are helpful, some may be unnecessary, but regardless this fits the existing style.

While we're doing this, be slightly stricter about the order of calls to history, and ensure we throw errors if set_service_signing_identity is called multiple times, or if set_service_signing_identity was not called before either get_cose_signatures_config or emit_signature.

@@ -6,13 +6,16 @@

#include <string>

struct COSESignaturesConfig
Copy link
Member

Choose a reason for hiding this comment

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

This was deliberately not namespaced, because it started under startup_config.h, out of shallow consistency with other config types. I do not remember why we don't namespace those, and the right thing to do is perhaps to namespace them all.

const ccf::COSESignaturesConfig cose_signatures_config;
};

std::optional<ServiceSigningContext> signing_context = std::nullopt;
Copy link
Member

Choose a reason for hiding this comment

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

ServiceSigningIdentity seems slightly more precise.

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.

2 participants