-
Notifications
You must be signed in to change notification settings - Fork 5
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
Changes from 4 commits
ddfbbf5
5951888
573b4c6
9a6e000
ee429ce
bd3a45e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
static constexpr uint64_t magic = 0x5AFE11115AFE1112ull; | ||
|
||
static finalizer_safety_information unset_fsi() { return {}; } | ||
|
||
|
@@ -69,6 +70,9 @@ namespace eosio::chain { | |
|
||
// ---------------------------------------------------------------------------------------- | ||
struct my_finalizers_t { | ||
public: | ||
static constexpr uint64_t current_safety_file_version = 1; | ||
|
||
using fsi_t = finalizer_safety_information; | ||
using fsi_map = std::map<bls_public_key, fsi_t>; | ||
|
||
|
@@ -155,6 +159,7 @@ namespace eosio::chain { | |
// for testing purposes only, not thread safe | ||
const fsi_t& get_fsi(const bls_public_key& k) { return finalizers[k].fsi; } | ||
void set_fsi(const bls_public_key& k, const fsi_t& fsi) { finalizers[k].fsi = fsi; } | ||
static bool are_equivalent(uint32_t version, const fsi_map& old, const fsi_map& current); | ||
}; | ||
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#define UNITTEST_TEST_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/test-data" |
There was a problem hiding this comment.
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 to0
anyway?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is it hardcoded to zero? It can take all values less than
current_safety_file_version
There was a problem hiding this comment.
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, currentlycurrent_safety_file_version
is 1.