Skip to content

Commit

Permalink
GH-2141 More descriptive error on block signed by unexpected key
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Mar 6, 2024
1 parent 574ac4c commit ac673af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libraries/chain/block_header_state_legacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ namespace eosio::chain {
std::tie(is_satisfied, relevant_sig_count) = producer_authority::keys_satisfy_and_relevant(keys, valid_block_signing_authority);

EOS_ASSERT(relevant_sig_count == keys.size(), wrong_signing_key,
"block signed by unexpected key",
"block signed by unexpected key: ${signing_keys}, expected: ${authority}. ${c} != ${s}",
("signing_keys", keys)("authority", valid_block_signing_authority));

EOS_ASSERT(is_satisfied, wrong_signing_key,
Expand Down
4 changes: 2 additions & 2 deletions unittests/protocol_feature_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,7 @@ BOOST_AUTO_TEST_CASE( producer_schedule_change_extension_test ) { try {
// ensure it is accepted (but rejected because it doesn't match expected state)
BOOST_REQUIRE_EXCEPTION(
remote.push_block(bad_block), wrong_signing_key,
fc_exception_message_is( "block signed by unexpected key" )
fc_exception_message_starts_with( "block signed by unexpected key" )
);
}

Expand All @@ -1752,7 +1752,7 @@ BOOST_AUTO_TEST_CASE( producer_schedule_change_extension_test ) { try {
// ensure it is rejected because it doesn't match expected state (but the extention was accepted)
BOOST_REQUIRE_EXCEPTION(
remote.push_block(bad_block), wrong_signing_key,
fc_exception_message_is( "block signed by unexpected key" )
fc_exception_message_starts_with( "block signed by unexpected key" )
);
}

Expand Down

0 comments on commit ac673af

Please sign in to comment.