This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from eosnetworkfoundation/backport-params
Backport BLOCKCHAIN_PARAMETERS from 2.1
- Loading branch information
Showing
21 changed files
with
1,016 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
libraries/chain/include/eosio/chain/chain_config_helper.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#pragma once | ||
|
||
#include <eosio/chain/types.hpp> /* vector */ | ||
|
||
namespace eosio { namespace chain { | ||
|
||
/** | ||
* helper class to serialize only selected ids of the class | ||
*/ | ||
template<typename T, typename Validator> | ||
struct data_range { | ||
|
||
T& config; | ||
vector<fc::unsigned_int> ids; | ||
Validator validator; | ||
|
||
data_range(T& c, Validator val) : config(c), validator(val){} | ||
data_range(T& c, vector<fc::unsigned_int>&& id_list, const Validator& val) | ||
: data_range(c, val){ | ||
ids = std::move(id_list); | ||
} | ||
}; | ||
|
||
/** | ||
* helper class to serialize specific class entry | ||
*/ | ||
template<typename T, typename Validator> | ||
struct data_entry { | ||
private: | ||
struct _dummy{}; | ||
public: | ||
|
||
T& config; | ||
uint32_t id; | ||
Validator validator; | ||
data_entry(T& c, uint32_t entry_id, Validator validate) | ||
: config(c), | ||
id(entry_id), | ||
validator(validate) {} | ||
template <typename Y> | ||
explicit data_entry(const data_entry<Y, Validator>& another, | ||
typename std::enable_if_t<std::is_base_of_v<T, Y>, _dummy> = _dummy{}) | ||
: data_entry(another.config, another.id, another.validator) | ||
{} | ||
|
||
bool is_allowed() const{ | ||
return validator(id); | ||
} | ||
}; | ||
|
||
}} // namespace eosio::chain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.