Skip to content

Commit

Permalink
Remove the /constitution endpoint. (#65)
Browse files Browse the repository at this point in the history
As of CCF 3.0.2, there is a built-in endpoint for governance tables,
including getting the current constitution. This can be used in place of
our existing /constitution endpoint.

Fixes #46
  • Loading branch information
plietar authored Jan 9, 2023
1 parent b465f5f commit e34ec6f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
19 changes: 0 additions & 19 deletions app/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include <ccf/node/host_processes_interface.h>
#include <ccf/node/quote.h>
#include <ccf/service/tables/cert_bundles.h>
#include <ccf/service/tables/constitution.h>
#include <ccf/service/tables/members.h>
#include <ccf/service/tables/nodes.h>
#include <ccf/service/tables/service.h>
Expand Down Expand Up @@ -783,24 +782,6 @@ namespace scitt
.set_auto_schema<void, Configuration>()
.install();

static constexpr auto get_constitution_path = "/constitution";
auto get_constitution = [&](EndpointContext& ctx) {
auto constitution =
ctx.tx.template ro<ccf::Constitution>(ccf::Tables::CONSTITUTION)
->get()
.value();

ctx.rpc_ctx->set_response_body(std::move(constitution));
ctx.rpc_ctx->set_response_header(
http::headers::CONTENT_TYPE, "application/javascript");
};
make_endpoint(
get_constitution_path,
HTTP_GET,
error_adapter(get_constitution),
no_authn_policy)
.install();

static constexpr auto get_version_path = "/version";
auto get_version = [this](EndpointContext& ctx, nlohmann::json&& params) {
GetVersion::Out out;
Expand Down
4 changes: 3 additions & 1 deletion pyscitt/pyscitt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ def get_trust_store(self) -> dict:
return {service_id: params}

def get_constitution(self) -> str:
return self.get("/constitution").text
# The endpoint returns the value as a JSON-encoded string, ie. wrapped
# in double quotes and with all special characters escaped.
return self.get("/gov/kv/constitution").json()

def get_version(self) -> dict:
return self.get("/version").json()
Expand Down

0 comments on commit e34ec6f

Please sign in to comment.