Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Fix snapshot test_compatible_versions failure and reenable it - develop #9815

Merged
merged 1 commit into from
Dec 18, 2020
Merged
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
14 changes: 14 additions & 0 deletions libraries/chain/combined_database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ namespace eosio { namespace chain {
if (std::is_same<value_t, global_property_object>::value) {
using v2 = legacy::snapshot_global_property_object_v2;
using v3 = legacy::snapshot_global_property_object_v3;
using v4 = legacy::snapshot_global_property_object_v4;

if (std::clamp(header.version, v2::minimum_version, v2::maximum_version) == header.version) {
std::optional<genesis_state> genesis = extract_legacy_genesis_state(*snapshot, header.version);
Expand Down Expand Up @@ -473,6 +474,19 @@ namespace eosio { namespace chain {
});
return; // early out to avoid default processing
}

if (std::clamp(header.version, v4::minimum_version, v4::maximum_version) == header.version) {
snapshot->read_section<global_property_object>([&db = this->db](auto& section) {
v4 legacy_global_properties;
section.read_row(legacy_global_properties, db);

db.create<global_property_object>([&legacy_global_properties](auto& gpo) {
gpo.initalize_from(legacy_global_properties);
});
});
return; // early out to avoid default processing
}

}

snapshot->read_section<value_t>([this](auto& section) {
Expand Down
2 changes: 0 additions & 2 deletions unittests/snapshot_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ static auto get_extra_args() {
return std::make_tuple(save_snapshot, generate_log);
}

/*
BOOST_AUTO_TEST_CASE_TEMPLATE(test_compatible_versions, SNAPSHOT_SUITE, snapshot_suites)
{
const uint32_t legacy_default_max_inline_action_size = 4 * 1024;
Expand Down Expand Up @@ -465,7 +464,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_compatible_versions, SNAPSHOT_SUITE, snapshot
SNAPSHOT_SUITE::write_to_file("snap_" + current_version, latest);
}
}
*/

/*
When WTMSIG changes were introduced in 1.8.x, the snapshot had to be able
Expand Down