зеркало из https://github.com/microsoft/CCF.git
Minor fixes (#1914)
This commit is contained in:
Родитель
18e3e03483
Коммит
81f53cedc5
|
@ -666,28 +666,6 @@ if(BUILD_TESTS)
|
|||
ADDITIONAL_ARGS --js-app-bundle ${CMAKE_SOURCE_DIR}/tests/js-content-types
|
||||
)
|
||||
|
||||
if(QUOTES_ENABLED)
|
||||
add_e2e_test(
|
||||
NAME reconfiguration_test
|
||||
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/reconfiguration.py
|
||||
CONSENSUS cft
|
||||
ADDITIONAL_ARGS --raft-election-timeout 4000
|
||||
)
|
||||
|
||||
add_e2e_test(
|
||||
NAME reconfiguration_snapshot_test
|
||||
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/reconfiguration.py
|
||||
CONSENSUS cft
|
||||
ADDITIONAL_ARGS --snapshot-tx-interval 10 --raft-election-timeout 4000
|
||||
)
|
||||
|
||||
add_e2e_test(
|
||||
NAME code_update_test
|
||||
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/code_update.py
|
||||
CONSENSUS cft
|
||||
ADDITIONAL_ARGS --oe-binary ${OE_BINDIR} --raft-election-timeout 4000
|
||||
)
|
||||
|
||||
add_e2e_test(
|
||||
NAME governance_test
|
||||
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/governance.py
|
||||
|
@ -715,6 +693,28 @@ if(BUILD_TESTS)
|
|||
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/jwt_test.py
|
||||
CONSENSUS cft
|
||||
)
|
||||
|
||||
if(QUOTES_ENABLED)
|
||||
add_e2e_test(
|
||||
NAME reconfiguration_test
|
||||
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/reconfiguration.py
|
||||
CONSENSUS cft
|
||||
ADDITIONAL_ARGS --raft-election-timeout 4000
|
||||
)
|
||||
|
||||
add_e2e_test(
|
||||
NAME reconfiguration_snapshot_test
|
||||
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/reconfiguration.py
|
||||
CONSENSUS cft
|
||||
ADDITIONAL_ARGS --snapshot-tx-interval 10 --raft-election-timeout 4000
|
||||
)
|
||||
|
||||
add_e2e_test(
|
||||
NAME code_update_test
|
||||
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/code_update.py
|
||||
CONSENSUS cft
|
||||
ADDITIONAL_ARGS --oe-binary ${OE_BINDIR} --raft-election-timeout 4000
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BUILD_SMALLBANK)
|
||||
|
|
|
@ -97,6 +97,11 @@ namespace oversized
|
|||
~FragmentReconstructor()
|
||||
{
|
||||
dispatcher.remove_message_handler(OversizedMessage::fragment);
|
||||
|
||||
for (const auto& [_, partial] : partial_messages)
|
||||
{
|
||||
delete[] partial.data;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace ccf
|
|||
}
|
||||
case nlohmann::json::value_t::object:
|
||||
{
|
||||
lua_newtable(l);
|
||||
lua_createtable(l, 0, j.size());
|
||||
for (auto it = j.begin(); it != j.end(); ++it)
|
||||
{
|
||||
push_raw(l, it.value());
|
||||
|
@ -44,7 +44,7 @@ namespace ccf
|
|||
// Set custom __was_object metatable property
|
||||
if (lua_getmetatable(l, -1) == 0)
|
||||
{
|
||||
lua_newtable(l);
|
||||
lua_createtable(l, 0, 1);
|
||||
}
|
||||
lua_pushboolean(l, true);
|
||||
lua_setfield(l, -2, "__was_object");
|
||||
|
@ -53,7 +53,7 @@ namespace ccf
|
|||
}
|
||||
case nlohmann::json::value_t::array:
|
||||
{
|
||||
lua_newtable(l);
|
||||
lua_createtable(l, j.size(), 0);
|
||||
size_t i = 0;
|
||||
for (const auto& v : j)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ namespace ccf
|
|||
// Set custom __was_object metatable property
|
||||
if (lua_getmetatable(l, -1) == 0)
|
||||
{
|
||||
lua_newtable(l);
|
||||
lua_createtable(l, 0, 1);
|
||||
}
|
||||
lua_pushboolean(l, false);
|
||||
lua_setfield(l, -2, "__was_object");
|
||||
|
|
|
@ -116,11 +116,18 @@ namespace ccf
|
|||
template <typename F0, typename F1>
|
||||
auto check_and_convert(lua_State* l, int arg, F0 check, F1 convert)
|
||||
{
|
||||
sanitize_stack_idx(l, arg);
|
||||
if (!check(l, arg)) // e.g., lua_isnumber()
|
||||
arg = sanitize_stack_idx(l, arg);
|
||||
const auto stack_before = lua_gettop(l);
|
||||
|
||||
const auto check_ok = check(l, arg); // e.g., lua_isnumber()
|
||||
expect_top(l, stack_before);
|
||||
if (!check_ok)
|
||||
throw ex("Lua stack object has wrong type.");
|
||||
|
||||
return convert(l, arg, nullptr); // e.g., lua_tonumberx()
|
||||
const auto convert_result =
|
||||
convert(l, arg, nullptr); // e.g., lua_tonumberx()
|
||||
expect_top(l, stack_before);
|
||||
return convert_result;
|
||||
}
|
||||
|
||||
template <typename F0, typename F1>
|
||||
|
|
|
@ -71,7 +71,6 @@ namespace ccf
|
|||
|
||||
static int lua_verify_cert_and_get_claims(lua_State* l)
|
||||
{
|
||||
LOG_INFO_FMT("lua_verify_cert_and_get_claims");
|
||||
nlohmann::json json = lua::check_get<nlohmann::json>(l, -1);
|
||||
std::vector<uint8_t> cert_der = json;
|
||||
|
||||
|
|
|
@ -59,6 +59,6 @@ namespace ccf
|
|||
};
|
||||
DECLARE_JSON_TYPE_WITH_BASE(PrimarySignature, NodeSignature)
|
||||
DECLARE_JSON_REQUIRED_FIELDS(
|
||||
PrimarySignature, seqno, view, commit_seqno, commit_view, root)
|
||||
PrimarySignature, seqno, view, commit_seqno, commit_view, root, tree)
|
||||
using Signatures = kv::Map<ObjectId, PrimarySignature>;
|
||||
}
|
|
@ -19,7 +19,7 @@ namespace tls
|
|||
|
||||
// Obtain the size of the output buffer
|
||||
auto rc = mbedtls_base64_decode(nullptr, 0, &len_written, data, size);
|
||||
if (rc != MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL)
|
||||
if (rc < 0 && rc != MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL)
|
||||
{
|
||||
throw std::logic_error(fmt::format(
|
||||
"Could not obtain length of decoded base64 buffer: {}",
|
||||
|
@ -45,7 +45,7 @@ namespace tls
|
|||
|
||||
// Obtain required size for output buffer
|
||||
auto rc = mbedtls_base64_encode(nullptr, 0, &len_written, data, size);
|
||||
if (rc != MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL)
|
||||
if (rc < 0 && rc != MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL)
|
||||
{
|
||||
throw std::logic_error(fmt::format(
|
||||
"Could not obtain length required for encoded base64 buffer: {}",
|
||||
|
@ -63,9 +63,12 @@ namespace tls
|
|||
fmt::format("Could not encode base64 string: {}", error_string(rc)));
|
||||
}
|
||||
|
||||
if (b64_string.size() > 0)
|
||||
{
|
||||
// mbedtls includes the terminating null, but std-string provides this
|
||||
// already
|
||||
b64_string.pop_back();
|
||||
}
|
||||
|
||||
return b64_string;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,12 @@ namespace tls
|
|||
constexpr size_t len = 256;
|
||||
char buf[len];
|
||||
mbedtls_strerror(err, buf, len);
|
||||
|
||||
if (strlen(buf) == 0)
|
||||
{
|
||||
return std::to_string(err);
|
||||
}
|
||||
|
||||
return std::string(buf);
|
||||
}
|
||||
}
|
|
@ -148,7 +148,7 @@ class Member:
|
|||
with remote_node.client(f"member{self.member_id}") as mc:
|
||||
r = mc.post(
|
||||
"/gov/ack",
|
||||
body={"state_digest": state_digest["state_digest"]},
|
||||
body=state_digest,
|
||||
signed=True,
|
||||
)
|
||||
assert r.status_code == 200, f"Error ACK: {r}"
|
||||
|
|
Загрузка…
Ссылка в новой задаче