From 08b62d77c53257669a45316c713e337f8ff7a19f Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Wed, 10 Jan 2024 08:01:06 -0600 Subject: [PATCH] GH-2060 Update signature provider parsing for base64 encoded BLS public keys --- .../signature_provider_plugin/signature_provider_plugin.cpp | 3 +++ tests/TestHarness/launcher.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/signature_provider_plugin/signature_provider_plugin.cpp b/plugins/signature_provider_plugin/signature_provider_plugin.cpp index 7cd9eec57d..fba48def38 100644 --- a/plugins/signature_provider_plugin/signature_provider_plugin.cpp +++ b/plugins/signature_provider_plugin/signature_provider_plugin.cpp @@ -42,6 +42,9 @@ class signature_provider_plugin_impl { std::tuple parse_spec(const std::string& spec) const { auto delim = spec.find("="); EOS_ASSERT(delim != std::string::npos, chain::plugin_config_exception, "Missing \"=\" in the key spec pair"); + // public_key can be base64 encoded with trailing `=` + while( spec.size() > delim+1 && spec[delim+1] == '=' ) + ++delim; auto pub_key_str = spec.substr(0, delim); auto spec_str = spec.substr(delim + 1); diff --git a/tests/TestHarness/launcher.py b/tests/TestHarness/launcher.py index 1301a5385a..ff331401fb 100644 --- a/tests/TestHarness/launcher.py +++ b/tests/TestHarness/launcher.py @@ -514,7 +514,7 @@ def construct_command_line(self, instance: nodeDefinition): a(a(eosdcmd, '--plugin'), 'eosio::producer_plugin') producer_keys = list(sum([('--signature-provider', f'{key.pubkey}=KEY:{key.privkey}') for key in instance.keys], ())) eosdcmd.extend(producer_keys) - finalizer_keys = list(sum([('--signature-provider', f'{key.blspubkey}=KEY:{key.blsprivkey}') for key in instance.keys], ())) + finalizer_keys = list(sum([('--signature-provider', f'{key.blspubkey}=KEY:{key.blsprivkey}') for key in instance.keys if key.blspubkey is not None], ())) eosdcmd.extend(finalizer_keys) producer_names = list(sum([('--producer-name', p) for p in instance.producers], ())) eosdcmd.extend(producer_names)