Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changes/public-header-dependencies.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Public C++ header components no longer form dependency cycles: `ccf/tx.h`, `ccf/endpoint.h`, `ccf/endpoint_context.h`, `ccf/common_auth_policies.h` and `ccf/crypto/base64.h` moved to `ccf/kv/`, `ccf/endpoints/` and `ccf/ds/`, the base64 functions moved from `ccf::crypto` to `ccf::ds`, and several headers no longer provide the typed KV maps transitively.
See the [migration guide](doc/releases/migration_7_x_to_8_x.rst#public-c-headers) for the full list of replacements.
2 changes: 1 addition & 1 deletion .github/skills/formatting-and-linting/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Each command below is under `scripts/`. This table is a routing guide; the scrip
| `cmake-format-checks.sh` | CMake files | gersemi | `-f` |
| `release-notes-checks.sh` | `CHANGELOG.md`, `.changes/*.md` (also run prettier) | extract-release-notes.py | `-f` (changelog links only) |
| `shellcheck-checks.sh` | Shell scripts outside `3rdparty/` | shellcheck | No |
| `includes-checks.sh` | Public C++ headers and their uses | Public/private include and exported-header checks | No |
| `includes-checks.sh` | C++ includes in `include/` and `src/` | Public/private include, exported-header, and component dependency checks | No |
| `copyright-checks.sh` | Source files | Copyright notices | No |
| `openapi-checks.sh` | JSON under `doc/schemas/` | openapi-spec-validator | No |
| `todo-checks.sh` | Tracked files | Disallowed comments | No |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- "src/consensus/aft/**"
- "src/kv/**"
- "include/ccf/kv/**"
- "include/ccf/tx.h"
- "include/ccf/kv/tx.h"
- "tests/kv_trace_validation*.py"
- "tests/consistency_trace_validation.py"
- "tests/tvc.py"
Expand Down
43 changes: 43 additions & 0 deletions doc/releases/migration_7_x_to_8_x.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,49 @@ Removal of the entire ``memory`` section is planned for 8.0. Migrate to the new
This increases the effective read budget by 2048 bytes compared with previous releases at the same configured size.
``ledger.max_transaction_size`` must not exceed this budget. The independent node-to-node limit includes message headers but excludes the 4-byte length prefix.

Public C++ Headers
------------------

Public header components, the directories under ``include/ccf/``, no longer include each other in cycles. Several headers and functions moved to the component that owns them, without forwarding headers or aliases, so C++ applications must update their includes:

.. list-table::
:header-rows: 1

* - 7.x
- 8.x
* - ``ccf/tx.h``
- ``ccf/kv/tx.h``
* - ``ccf/endpoint.h``
- ``ccf/endpoints/endpoint.h``
* - ``ccf/endpoint_context.h``
- ``ccf/endpoints/endpoint_context.h``
* - ``ccf/common_auth_policies.h``
- ``ccf/endpoints/common_auth_policies.h``
* - ``ccf/crypto/base64.h``
- ``ccf/ds/base64.h``
* - ``ccf::crypto::b64_from_raw``, ``ccf::crypto::b64url_from_raw``, ``ccf::crypto::raw_from_b64`` and ``ccf::crypto::raw_from_b64url``
- The same functions in ``ccf::ds``

Class and function names are otherwise unchanged. ``ccf/app_interface.h`` still provides the endpoint registry, authentication policies and transaction types.

Some headers no longer provide declarations that they did not use themselves. Include the header that declares them instead:

.. list-table::
:header-rows: 1

* - Declarations
- No longer provided by
- Include
* - ``ccf::kv::Map``, ``ccf::kv::Set``, ``ccf::kv::Value`` and their ``ccf::Service*`` aliases
- ``ccf/kv/tx.h`` and ``ccf/crypto/sha256_hash.h``, and headers which obtained them from these, such as ``ccf/claims_digest.h``
- ``ccf/service/map.h`` or the matching ``ccf/kv/`` header
* - ``ccf::AbstractNodeContext``
- ``ccf/indexing/strategies/seqnos_by_key_bucketed.h``
- ``ccf/node_context.h``
* - ``ccf::DID``, ``ccf::Feed`` and the UVM endorsements tables
- ``ccf/pal/uvm_endorsements.h``
- ``ccf/service/tables/uvm_endorsements.h``

ML-DSA Service Identity
-----------------------

Expand Down
20 changes: 0 additions & 20 deletions include/ccf/crypto/sha256_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#pragma once

#include "ccf/ds/json.h"
#include "ccf/service/map.h"

#include <array>
#include <span>
Expand Down Expand Up @@ -87,22 +86,3 @@ struct formatter<ccf::crypto::Sha256Hash>
};

FMT_END_NAMESPACE

namespace ccf::kv::serialisers
{
template <>
struct BlitSerialiser<ccf::crypto::Sha256Hash>
{
static SerialisedEntry to_serialised(const ccf::crypto::Sha256Hash& h)
{
auto hex_str = h.hex_str();
return {hex_str.begin(), hex_str.end()};
}

static ccf::crypto::Sha256Hash from_serialised(const SerialisedEntry& data)
{
auto data_str = std::string{data.begin(), data.end()};
return ccf::crypto::Sha256Hash::from_hex_string(data_str);
}
};
}
3 changes: 2 additions & 1 deletion include/ccf/crypto/base64.h → include/ccf/ds/base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#include <cstdint>
#include <span>
#include <string>
#include <string_view>
#include <vector>

namespace ccf::crypto
namespace ccf::ds
{
std::vector<uint8_t> raw_from_b64(const std::string_view& b64_string);

Expand Down
6 changes: 3 additions & 3 deletions include/ccf/ds/json.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache 2.0 License.
#pragma once
#include "ccf/crypto/base64.h"
#include "ccf/ds/base64.h"
#include "ccf/ds/json_schema.h"

#define FMT_HEADER_ONLY
Expand Down Expand Up @@ -120,7 +120,7 @@ namespace std
{
if constexpr (std::is_same_v<T, uint8_t>)
{
j = ccf::crypto::b64_from_raw(t);
j = ccf::ds::b64_from_raw(t);
}
else
{
Expand All @@ -141,7 +141,7 @@ namespace std
{
try
{
t = ccf::crypto::raw_from_b64(j.get<std::string>());
t = ccf::ds::raw_from_b64(j.get<std::string>());
return;
}
catch (const std::exception& e)
Expand Down
6 changes: 3 additions & 3 deletions include/ccf/endpoint_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#pragma once

#include "ccf/ds/json_schema.h"
#include "ccf/endpoint.h"
#include "ccf/endpoint_context.h"
#include "ccf/endpoints/endpoint.h"
#include "ccf/endpoints/endpoint_context.h"
#include "ccf/kv/tx.h"
#include "ccf/receipt.h"
#include "ccf/rpc_context.h"
#include "ccf/tx.h"

#include <atomic>
#include <charconv>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache 2.0 License.
#pragma once

#include "ccf/tx.h"
#include "ccf/kv/tx.h"

#include <memory>
#include <nlohmann/json.hpp>
Expand Down
4 changes: 2 additions & 2 deletions include/ccf/endpoints/authentication/js.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#pragma once

#include "ccf/ccf_deprecated.h"
#include "ccf/common_auth_policies.h"
#include "ccf/endpoint.h"
#include "ccf/endpoints/authentication/all_of_auth.h"
#include "ccf/endpoints/common_auth_policies.h"
#include "ccf/endpoints/endpoint.h"

namespace ccf
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "ccf/ds/json.h"
#include "ccf/ds/openapi.h"
#include "ccf/endpoint_context.h"
#include "ccf/endpoints/endpoint_context.h"
#include "ccf/http_consts.h"
#include "ccf/rest_verb.h"
#include "ccf/service/map.h"
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/historical_queries_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache 2.0 License.
#pragma once

#include "ccf/endpoint_context.h"
#include "ccf/endpoints/endpoint_context.h"
#include "ccf/historical_queries_interface.h"
#include "ccf/node_context.h"
#include "ccf/tx_id.h"
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/historical_queries_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#pragma once

#include "ccf/historical_queries_interface.h"
#include "ccf/kv/tx.h"
#include "ccf/network_identity_interface.h"
#include "ccf/rpc_context.h"
#include "ccf/tx.h"

namespace ccf::historical
{
Expand Down
6 changes: 5 additions & 1 deletion include/ccf/indexing/strategies/seqnos_by_key_bucketed.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
#pragma once

#include "ccf/indexing/strategies/visit_each_entry_in_map.h"
#include "ccf/node_context.h"
#include "ccf/seq_no_collection.h"

namespace ccf
{
struct AbstractNodeContext;
}

namespace ccf::indexing::strategies
{
// Retains a trusted current bucket for every distinct key. Completed
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/js/bundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#pragma once

#include "ccf/ds/json.h"
#include "ccf/endpoint.h"
#include "ccf/endpoints/endpoint.h"

#include <map>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/js/extensions/ccf/gov_effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#pragma once

#include "ccf/js/extensions/extension_interface.h"
#include "ccf/tx.h"
#include "ccf/kv/tx.h"

namespace ccf::js::extensions
{
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/js/extensions/ccf/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#pragma once

#include "ccf/base_endpoint_registry.h"
#include "ccf/endpoint_context.h"
#include "ccf/endpoints/endpoint_context.h"
#include "ccf/js/core/wrapped_value.h"
#include "ccf/js/extensions/extension_interface.h"
#include "ccf/rpc_context.h"
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/js/interpreter_cache_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache 2.0 License.
#pragma once

#include "ccf/endpoint.h"
#include "ccf/endpoints/endpoint.h"
#include "ccf/js/tx_access.h"
#include "ccf/node_subsystem_interface.h"

Expand Down
4 changes: 2 additions & 2 deletions include/ccf/js/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

// CCF
#include "ccf/app_interface.h"
#include "ccf/endpoint.h"
#include "ccf/endpoints/endpoint.h"
#include "ccf/js/audit_format.h"
#include "ccf/js/bundle.h"
#include "ccf/js/core/context.h"
#include "ccf/js/interpreter_cache_interface.h"
#include "ccf/js/namespace_restrictions.h"
#include "ccf/tx.h"
#include "ccf/kv/tx.h"
#include "ccf/tx_id.h"

#include <charconv>
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/kv/read_only_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache 2.0 License.
#pragma once

#include "ccf/tx.h"
#include "ccf/kv/tx.h"
#include "ccf/tx_id.h"

#include <memory>
Expand Down
21 changes: 20 additions & 1 deletion include/ccf/kv/serialisers/blit_serialiser.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the Apache 2.0 License.
#pragma once

#include "ccf/crypto/sha256_hash.h"
#include "ccf/ds/nonstd.h"
#include "ccf/kv/serialisers/serialised_entry.h"

Expand Down Expand Up @@ -86,4 +87,22 @@ namespace ccf::kv::serialisers
// NOLINTEND(bugprone-branch-clone)
}
};
}

// Declared with the primary template, so that it is visible wherever
// BlitSerialiser<Sha256Hash> can be instantiated.
template <>
struct BlitSerialiser<ccf::crypto::Sha256Hash>
{
static SerialisedEntry to_serialised(const ccf::crypto::Sha256Hash& h)
{
auto hex_str = h.hex_str();
return {hex_str.begin(), hex_str.end()};
}

static ccf::crypto::Sha256Hash from_serialised(const SerialisedEntry& data)
{
auto data_str = std::string{data.begin(), data.end()};
return ccf::crypto::Sha256Hash::from_hex_string(data_str);
}
};
}
1 change: 1 addition & 0 deletions include/ccf/tx.h → include/ccf/kv/tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#pragma once

#include "ccf/crypto/sha256_hash.h"
#include "ccf/kv/abstract_handle.h"
#include "ccf/tx_id.h"

#include <list>
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/node/quote.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#pragma once

#include "ccf/ds/quote_info.h"
#include "ccf/kv/tx.h"
#include "ccf/network_identity_interface.h"
#include "ccf/pal/attestation_sev_snp.h"
#include "ccf/pal/measurement.h"
#include "ccf/service/tables/host_data.h"
#include "ccf/tx.h"

#include <memory>
#include <optional>
Expand Down
10 changes: 7 additions & 3 deletions include/ccf/pal/uvm_endorsements.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
// Licensed under the Apache 2.0 License.
#pragma once

#include "ccf/service/tables/uvm_endorsements.h"
#include "ccf/ds/json.h"
#include "ccf/pal/measurement.h"

#include <string>
#include <vector>

namespace ccf::pal
{
struct UVMEndorsements
{
DID did;
Feed feed;
std::string did;
std::string feed;
std::string svn;

bool operator==(const UVMEndorsements&) const = default;
Expand Down
4 changes: 3 additions & 1 deletion include/ccf/research/create_tx_claims_digest.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
// Licensed under the Apache 2.0 License.
#pragma once

#include <kv/kv_types.h>
#include "ccf/claims_digest.h"
#include "ccf/kv/tx.h"

#include <optional>

namespace ccf
Expand Down
4 changes: 2 additions & 2 deletions include/ccf/research/custom_protocol_subsystem_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Licensed under the Apache 2.0 License.
#pragma once

#include "ccf/endpoint_context.h"
#include "ccf/endpoints/endpoint_context.h"
#include "ccf/kv/tx.h"
#include "ccf/node/session.h"
#include "ccf/node_subsystem_interface.h"
#include "ccf/tx.h"

#include <functional>
#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/rpc_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "ccf/claims_digest.h"
#include "ccf/crypto/sha256_hash.h"
#include "ccf/endpoint_context.h"
#include "ccf/endpoints/endpoint_context.h"
#include "ccf/frame_format.h"
#include "ccf/http_consts.h"
#include "ccf/http_header_map.h"
Expand Down
Loading