CCF
Loading...
Searching...
No Matches
network_tables.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the Apache 2.0 License.
3#pragma once
4
5#include "ccf/endpoint.h"
25#include "kv/store.h"
26#include "tables/config.h"
29#include "tables/secrets.h"
30#include "tables/shares.h"
31#include "tables/signatures.h"
34
35#include <memory>
36#include <tuple>
37
38namespace ccf
39{
40 inline std::shared_ptr<ccf::kv::Store> make_store()
41 {
42 return std::make_shared<ccf::kv::Store>();
43 }
44
46 {
47 std::shared_ptr<ccf::kv::Store> tables;
48
49 //
50 // Governance tables (public:ccf.gov.*)
51 // Note that this only covers the builtin tables, with entries common to
52 // many CCF services and modified by C++ code. Constitutions may extend this
53 // with their own tables, and some services will not use all of these
54 // tables.
55 //
56
57 //
58 // Member tables
59 //
60 const MemberCerts member_certs = {Tables::MEMBER_CERTS};
62 Tables::MEMBER_ENCRYPTION_PUBLIC_KEYS};
63 const MemberInfo member_info = {Tables::MEMBER_INFO};
64 const MemberAcks member_acks = {Tables::MEMBER_ACKS};
65
66 inline auto get_all_member_tables() const
67 {
68 return std::make_tuple(
70 }
71
72 //
73 // User tables
74 //
75 const UserCerts user_certs = {Tables::USER_CERTS};
76 const UserInfo user_info = {Tables::USER_INFO};
77
78 inline auto get_all_user_tables() const
79 {
80 return std::make_tuple(user_certs, user_info);
81 }
82
83 //
84 // Node tables
85 //
86 const CodeIDs node_code_ids = {Tables::NODE_CODE_IDS};
87 const Nodes nodes = {Tables::NODES};
89 Tables::NODE_ENDORSED_CERTIFICATES};
90 const ACMECertificates acme_certificates = {Tables::ACME_CERTIFICATES};
91
92 const VirtualHostDataMap virtual_host_data = {Tables::VIRTUAL_HOST_DATA};
94 Tables::NODE_VIRTUAL_MEASUREMENTS};
95
96 const SnpHostDataMap host_data = {Tables::HOST_DATA};
97 const SnpMeasurements snp_measurements = {Tables::NODE_SNP_MEASUREMENTS};
99 Tables::NODE_SNP_UVM_ENDORSEMENTS};
100 const SnpTcbVersionMap snp_tcb_versions = {Tables::SNP_TCB_VERSIONS};
101
102 inline auto get_all_node_tables() const
103 {
104 return std::make_tuple(
106 nodes,
111 host_data,
115 }
116
117 //
118 // History of governance, proposals, and ballots tables
119 //
120 const GovernanceHistory governance_history = {Tables::GOV_HISTORY};
122 Tables::COSE_GOV_HISTORY};
124 Tables::COSE_RECENT_PROPOSALS};
125
126 const jsgov::ProposalMap proposals = {jsgov::Tables::PROPOSALS};
128 jsgov::Tables::PROPOSALS_INFO};
129
131 {
132 return std::make_tuple(
135 proposals,
138 }
139
140 //
141 // JS Generic tables
142 //
143 const Modules modules = {Tables::MODULES};
145 Tables::MODULES_QUICKJS_BYTECODE};
147 Tables::MODULES_QUICKJS_VERSION};
148 const InterpreterFlush interpreter_flush = {Tables::INTERPRETER_FLUSH};
149 const JSEngine js_engine = {Tables::JSENGINE};
150 const endpoints::EndpointsMap js_endpoints = {endpoints::Tables::ENDPOINTS};
151
152 inline auto get_all_js_generic_tables() const
153 {
154 return std::make_tuple(
155 modules,
159 js_engine,
161 }
162
163 //
164 // JWT tables
165 //
166 const CACertBundlePEMs ca_cert_bundles = {Tables::CA_CERT_BUNDLE_PEMS};
167 const JwtIssuers jwt_issuers = {Tables::JWT_ISSUERS};
169 Tables::JWT_PUBLIC_SIGNING_KEYS_METADATA};
172 Tables::Legacy::JWT_PUBLIC_SIGNING_KEYS_METADATA};
174 {Tables::Legacy::JWT_PUBLIC_SIGNING_KEYS};
177 Tables::Legacy::JWT_PUBLIC_SIGNING_KEY_ISSUER};
178
189
190 //
191 // Service tables
192 //
193 const Service service = {Tables::SERVICE};
195 Tables::PREVIOUS_SERVICE_IDENTITY};
197 Tables::PREVIOUS_SERVICE_LAST_SIGNED_ROOT};
200 Tables::PREVIOUS_SERVICE_IDENTITY_ENDORSEMENT};
201 const Configuration config = {Tables::CONFIGURATION};
202 const Constitution constitution = {Tables::CONSTITUTION};
203
204 inline auto get_all_service_tables() const
205 {
206 return std::make_tuple(
208 }
209
210 // All builtin governance tables should be included here, so that wrapper
211 // endpoints can be automatically generated for them
223
224 //
225 // Internal tables (public:ccf.internal.* and ccf.internal.*)
226 //
227 const Secrets secrets = {Tables::ENCRYPTED_LEDGER_SECRETS};
228 const SnapshotEvidence snapshot_evidence = {Tables::SNAPSHOT_EVIDENCE};
229 const RecoveryShares shares = {Tables::SHARES};
231 Tables::ENCRYPTED_PAST_LEDGER_SECRET};
233 Tables::ENCRYPTED_SUBMITTED_SHARES};
234
235 // The signatures and serialised_tree tables should always be written to at
236 // the same time so that the root of the tree in the signatures table
237 // matches the serialised Merkle tree.
238 const Signatures signatures = {Tables::SIGNATURES};
239 const CoseSignatures cose_signatures = {Tables::COSE_SIGNATURES};
241 Tables::SERIALISED_MERKLE_TREE};
242
243 inline auto get_all_signature_tables() const
244 {
245 return std::make_tuple(signatures, serialise_tree);
246 }
247
248 inline auto get_all_internal_tables() const
249 {
250 return std::tuple_cat(
251 std::make_tuple(
252 secrets,
254 shares,
258 }
259
261 };
262}
Definition map.h:30
Definition set.h:33
Definition value.h:32
Definition app_interface.h:14
std::shared_ptr< ccf::kv::Store > make_store()
Definition network_tables.h:40
Definition network_tables.h:46
const jsgov::ProposalInfoMap proposal_info
Definition network_tables.h:127
auto get_all_signature_tables() const
Definition network_tables.h:243
const SnpTcbVersionMap snp_tcb_versions
Definition network_tables.h:100
auto get_all_internal_tables() const
Definition network_tables.h:248
const endpoints::EndpointsMap js_endpoints
Definition network_tables.h:150
auto get_all_node_tables() const
Definition network_tables.h:102
const UserInfo user_info
Definition network_tables.h:76
const PreviousServiceIdentityEndorsement previous_service_identity_endorsement
Definition network_tables.h:199
std::shared_ptr< ccf::kv::Store > tables
Definition network_tables.h:47
const JwtIssuers jwt_issuers
Definition network_tables.h:167
const NodeEndorsedCertificates node_endorsed_certificates
Definition network_tables.h:88
const MemberPublicEncryptionKeys member_encryption_public_keys
Definition network_tables.h:61
const MemberInfo member_info
Definition network_tables.h:63
const UserCerts user_certs
Definition network_tables.h:75
const MemberAcks member_acks
Definition network_tables.h:64
const Tables::Legacy::JwtPublicSigningKeys legacy_jwt_public_signing_keys
Definition network_tables.h:173
auto get_all_member_tables() const
Definition network_tables.h:66
auto get_all_service_tables() const
Definition network_tables.h:204
const EncryptedSubmittedShares encrypted_submitted_shares
Definition network_tables.h:232
const Service service
Definition network_tables.h:193
auto get_all_jwt_tables() const
Definition network_tables.h:179
const SnpHostDataMap host_data
Definition network_tables.h:96
const VirtualHostDataMap virtual_host_data
Definition network_tables.h:92
const Configuration config
Definition network_tables.h:201
const CoseSignatures cose_signatures
Definition network_tables.h:239
const CACertBundlePEMs ca_cert_bundles
Definition network_tables.h:166
const JSEngine js_engine
Definition network_tables.h:149
const RecoveryShares shares
Definition network_tables.h:229
const ACMECertificates acme_certificates
Definition network_tables.h:90
auto get_all_user_tables() const
Definition network_tables.h:78
const InterpreterFlush interpreter_flush
Definition network_tables.h:148
const ModulesQuickJsBytecode modules_quickjs_bytecode
Definition network_tables.h:144
const SnpMeasurements snp_measurements
Definition network_tables.h:97
const COSEGovernanceHistory cose_governance_history
Definition network_tables.h:121
const EncryptedLedgerSecretsInfo encrypted_ledger_secrets
Definition network_tables.h:230
const VirtualMeasurements virtual_measurements
Definition network_tables.h:93
const PreviousServiceLastSignedRoot previous_service_last_signed_root
Definition network_tables.h:196
const COSERecentProposals cose_recent_proposals
Definition network_tables.h:123
const jsgov::ProposalMap proposals
Definition network_tables.h:126
const JwtPublicSigningKeysMetadata jwt_public_signing_keys_metadata
Definition network_tables.h:168
const SerialisedMerkleTree serialise_tree
Definition network_tables.h:240
NetworkTables()
Definition network_tables.h:260
const PreviousServiceIdentity previous_service_identity
Definition network_tables.h:194
const Secrets secrets
Definition network_tables.h:227
const SNPUVMEndorsements snp_uvm_endorsements
Definition network_tables.h:98
const CodeIDs node_code_ids
Definition network_tables.h:86
const SnapshotEvidence snapshot_evidence
Definition network_tables.h:228
const MemberCerts member_certs
Definition network_tables.h:60
const Signatures signatures
Definition network_tables.h:238
const GovernanceHistory governance_history
Definition network_tables.h:120
const ModulesQuickJsVersion modules_quickjs_version
Definition network_tables.h:146
const Tables::Legacy::JwtPublicSigningKeyIssuer legacy_jwt_public_signing_key_issuer
Definition network_tables.h:176
auto get_all_builtin_governance_tables() const
Definition network_tables.h:212
auto get_all_governance_history_tables() const
Definition network_tables.h:130
const Modules modules
Definition network_tables.h:143
const Nodes nodes
Definition network_tables.h:87
auto get_all_js_generic_tables() const
Definition network_tables.h:152
const Constitution constitution
Definition network_tables.h:202
const JwtPublicSigningKeysMetadataLegacy legacy_jwt_public_signing_keys_metadata
Definition network_tables.h:171