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: 1 addition & 1 deletion plugins/producer_plugin/src/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ void producer_plugin_impl::plugin_initialize(const boost::program_options::varia

for (auto& candidate : finalizer_candidate_sig_providers) {
SYS_ASSERT(candidate->private_key.has_value(), plugin_config_exception, "ALL BLS keys must be provided via command line arguments or config file.");
wlog("setting fin key ${c}:${p}", ("c", candidate->public_key.to_native_string({}))("p", candidate->private_key->to_native_string({})));
ilog("Configured finalizer key: ${c}", ("c", candidate->public_key.to_native_string({})));
_finalizer_keys.insert({candidate->public_key.to_native_string({}), candidate});
}
chain.set_node_finalizer_keys(_finalizer_keys);
Expand Down
17 changes: 11 additions & 6 deletions programs/nodeop/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <fc/log/appender.hpp>
#include <fc/exception/exception.hpp>
#include <fc/scoped_exit.hpp>
#include <fc/string.hpp>

#include <boost/dll/runtime_symbol_info.hpp>
#include <boost/exception/diagnostic_information.hpp>
Expand All @@ -21,21 +22,25 @@
#include <string>
#include <vector>
#include <iterator>
#include <numeric>

#include "config.hpp"

using namespace appbase;
using namespace sysio;

namespace detail {
using namespace std;

void log_non_default_options(const std::vector<bpo::basic_option<char>>& options) {
using namespace std::string_literals;
// TODO: @jglanz reimplement
// auto mask_private = [](const string& v) {
// auto [pub_key_str, spec_type_str, spec_data] = signature_provider_manager_plugin::parse_signature_provider_spec(v);
// return pub_key_str + "=" + spec_type_str + ":***";
// };
auto mask_private = [](const string& v) -> std::string {
if (auto parts = fc::split(v, ','); parts.size() > 1) {
return std::accumulate(std::next(parts.begin()), std::prev(parts.end()), parts[0],
[](const string& acc, const string& part) { return acc + "," + part; }) + ",***";
}
return "***"s;
};
Comment on lines +37 to +43
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we move all of this to fc::log for reusability? Also, as we have the key prefixes available, should this be 1 large or several small regex patterns. Potentially part of a storage shim could be a std::regex exp_key_string_pattern?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could move it to fc::log. To do so would require a key pattern, as you suggest, to make it generic. Since this is currently only used here I don't see the point.


string result;
for (const auto& op : options) {
Expand All @@ -49,7 +54,7 @@ void log_non_default_options(const std::vector<bpo::basic_option<char>>& options
if (i != b)
v += ", ";
if (op.string_key == "signature-provider"s)
v += *i;// TODO @jglanz mask_private(*i);
v += mask_private(*i);
else if (mask)
v += "***";
else
Expand Down
Loading