Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for changing the content of the finalizer safety info (fsi) file and loading older versions #492

Merged
merged 6 commits into from
Aug 7, 2024

Conversation

greg7mdp
Copy link
Contributor

@greg7mdp greg7mdp commented Aug 7, 2024

Resolves #463.

This adds a version number to the fsi file, while still allowing to load the old file format.
It also adds a testing infrastructure which verifies that all older file versions (currently there is only one) can successfuly be loaded.

@@ -36,7 +36,8 @@ namespace eosio::chain {
block_ref last_vote;
block_ref lock;

static constexpr uint64_t magic = 0x5AFE11115AFE1111ull;
static constexpr uint64_t magic_unversioned = 0x5AFE11115AFE1111ull;
Copy link
Member

Choose a reason for hiding this comment

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

I don't see any need to have the extra complexity of supporting the un-versioned file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not since people already have unversioned files? And it just a couple lines.

@@ -305,4 +323,16 @@ void my_finalizers_t::set_default_safety_information(const fsi_t& fsi) {
default_fsi = fsi;
}

bool my_finalizers_t::are_equivalent(uint32_t version, const fsi_map& old, const fsi_map& current) {
assert(version < current_safety_file_version); // this function compares an older version with the current one
switch(version) {
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need version, as it is hardcoded to 0 anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do we need version, as it is hardcoded to 0 anyway?

Where is it hardcoded to zero? It can take all values less than current_safety_file_version

Copy link
Member

Choose a reason for hiding this comment

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

I meant the case 0:. OK, currently current_safety_file_version is 1.

@greg7mdp greg7mdp merged commit 8915d7d into main Aug 7, 2024
36 checks passed
@greg7mdp greg7mdp deleted the gh_463 branch August 7, 2024 19:38
@ericpassmore
Copy link
Contributor

Note:start
group: STABILITY
category: INTERNALS
summary: Versioning for Finalizer Safety Information file.
Note:end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for changing the content of the finalizer safety info file (fsi) and loading older version
4 participants