提交 ec58b685 编写于 作者: B Bart Wyatt

various fixes for gcc 5.4 (aka Ubuntu 16.04 default)

上级 9d26d14c
......@@ -377,7 +377,7 @@ void chain_controller::_apply_cycle_trace( const cycle_trace& res )
for (const auto&st: res.shard_traces) {
for (const auto &tr: st.transaction_traces) {
for (const auto &dt: tr.deferred_transactions) {
_db.create<generated_transaction_object>([&](auto &obj) {
_db.create<generated_transaction_object>([&](generated_transaction_object &obj) {
obj.trx_id = dt.id();
obj.sender = dt.sender;
obj.sender_id = dt.sender_id;
......@@ -630,7 +630,7 @@ void chain_controller::__apply_block(const signed_block& next_block)
flat_set<public_key_type> chain_controller::get_required_keys(const signed_transaction& trx,
const flat_set<public_key_type>& candidate_keys)const
{
auto checker = make_auth_checker( [&](auto p){ return get_permission(p).auth; },
auto checker = make_auth_checker( [&](const permission_level& p){ return get_permission(p).auth; },
get_global_properties().configuration.max_authority_depth,
candidate_keys);
......@@ -652,7 +652,7 @@ void chain_controller::check_authorization( const vector<action>& actions,
bool allow_unused_signatures,
flat_set<account_name> provided_accounts )const
{
auto checker = make_auth_checker( [&](auto p){ return get_permission(p).auth; },
auto checker = make_auth_checker( [&](const permission_level& p){ return get_permission(p).auth; },
get_global_properties().configuration.max_authority_depth,
provided_keys, provided_accounts );
......
......@@ -147,7 +147,7 @@ abi_def chain_initializer::eos_contract_abi()
{"account", "account_name"},
{"permission", "permission_name"},
{"parent", "permission_name"},
{"authority", "authority"},
{"data", "authority"},
}
});
......
......@@ -415,8 +415,8 @@ void apply_eosio_updateauth(apply_context& context) {
EOS_ASSERT(!update.permission.empty(), action_validate_exception, "Cannot create authority with empty name");
EOS_ASSERT(update.permission != update.parent, action_validate_exception,
"Cannot set an authority as its own parent");
EOS_ASSERT(validate(update.authority), action_validate_exception,
"Invalid authority: ${auth}", ("auth", update.authority));
EOS_ASSERT(validate(update.data), action_validate_exception,
"Invalid authority: ${auth}", ("auth", update.data));
if (update.permission == "active")
EOS_ASSERT(update.parent == "owner", action_validate_exception, "Cannot change active authority's parent from owner", ("update.parent", update.parent) );
if (update.permission == "owner")
......@@ -426,7 +426,7 @@ void apply_eosio_updateauth(apply_context& context) {
context.require_authorization(update.account);
db.get<account_object, by_name>(update.account);
validate_authority_precondition(context, update.authority);
validate_authority_precondition(context, update.data);
auto permission = db.find<permission_object, by_owner>(boost::make_tuple(update.account, update.permission));
......@@ -443,7 +443,7 @@ void apply_eosio_updateauth(apply_context& context) {
// TODO/QUESTION: If we are updating an existing permission, should we check if the message declared
// permission satisfies the permission we want to modify?
db.modify(*permission, [&update, &parent_id](permission_object& po) {
po.auth = update.authority;
po.auth = update.data;
po.parent = parent_id;
});
} else {
......@@ -452,7 +452,7 @@ void apply_eosio_updateauth(apply_context& context) {
db.create<permission_object>([&update, &parent_id](permission_object& po) {
po.name = update.permission;
po.owner = update.account;
po.auth = update.authority;
po.auth = update.data;
po.parent = parent_id;
});
}
......
......@@ -92,33 +92,48 @@ namespace impl {
* @tparam T - the type to check
*/
template<typename T>
constexpr bool single_type_requires_abi_v = std::is_base_of<transaction, T>::value ||
std::is_same<T, action>::value ||
std::is_same<T, transaction_trace>::value ||
std::is_same<T, action_trace>::value;
constexpr bool single_type_requires_abi_v() {
return std::is_base_of<transaction, T>::value ||
std::is_same<T, action>::value ||
std::is_same<T, transaction_trace>::value ||
std::is_same<T, action_trace>::value;
}
/**
* Basic constexpr for a type, aliases the basic check directly
* @tparam T - the type to check
*/
template<typename T>
constexpr bool type_requires_abi_v = single_type_requires_abi_v<T>;
struct type_requires_abi {
static constexpr bool value() {
return single_type_requires_abi_v<T>();
}
};
/**
* specialization that catches common container patterns and checks their contained-type
* @tparam Container - a templated container type whose first argument is the contained type
*/
template<template<typename ...> class Container, typename T, typename ...Args >
constexpr bool type_requires_abi_v<Container<T, Args...>> = single_type_requires_abi_v<T>;
struct type_requires_abi<Container<T, Args...>> {
static constexpr bool value() {
return single_type_requires_abi_v<T>();
}
};
template<typename T>
constexpr bool type_requires_abi_v() {
return type_requires_abi<T>::value();
}
/**
* convenience aliases for creating overload-guards based on whether the type contains ABI related info
*/
template<typename T>
using not_require_abi_t = std::enable_if_t<!type_requires_abi_v<T>, int>;
using not_require_abi_t = std::enable_if_t<!type_requires_abi_v<T>(), int>;
template<typename T>
using require_abi_t = std::enable_if_t<type_requires_abi_v<T>, int>;
using require_abi_t = std::enable_if_t<type_requires_abi_v<T>(), int>;
/**
* Reflection visitor that uses a resolver to resolve ABIs for nested types
......
......@@ -50,9 +50,11 @@ struct genesis_state_type {
.max_block_acts_per_scope = config::default_max_block_acts_per_scope,
.target_block_acts = config::default_target_block_acts,
.max_block_acts = config::default_max_block_acts,
.real_threads = 0, // TODO: unused?
.max_storage_size = config::default_max_storage_size,
.max_transaction_lifetime = config::default_max_trx_lifetime,
.max_authority_depth = config::default_max_auth_depth,
.max_transaction_exec_time = 0, // TODO: unused?
.max_inline_depth = config::default_max_inline_depth,
.max_inline_action_size = config::default_max_inline_action_size,
.max_generated_transaction_size = config::default_max_gen_trx_size
......
......@@ -299,7 +299,7 @@ struct updateauth {
account_name account;
permission_name permission;
permission_name parent;
authority authority;
authority data;
static scope_name get_scope() {
return config::system_account_name;
......@@ -410,7 +410,7 @@ FC_REFLECT( eosio::chain::contracts::setabi , (account
FC_REFLECT( eosio::chain::contracts::setproducer , (name)(key)(configuration) )
FC_REFLECT( eosio::chain::contracts::okproducer , (voter)(producer)(approve) )
FC_REFLECT( eosio::chain::contracts::setproxy , (stakeholder)(proxy) )
FC_REFLECT( eosio::chain::contracts::updateauth , (account)(permission)(parent)(authority) )
FC_REFLECT( eosio::chain::contracts::updateauth , (account)(permission)(parent)(data) )
FC_REFLECT( eosio::chain::contracts::deleteauth , (account)(permission) )
FC_REFLECT( eosio::chain::contracts::linkauth , (account)(code)(type)(requirement) )
FC_REFLECT( eosio::chain::contracts::unlinkauth , (account)(code)(type) )
......
......@@ -130,6 +130,10 @@ namespace eosio { namespace chain {
* the instance handed out to other threads
*/
struct code_info {
code_info( size_t mem_end, vector<char>&& mem_image )
:mem_end(mem_end),mem_image(std::forward<vector<char>>(mem_image))
{}
// a clean image of the memory used to sanitize things on checkin
size_t mem_start = 0;
size_t mem_end = 1<<16;
......@@ -249,10 +253,7 @@ namespace eosio { namespace chain {
// grab the lock and put this in the cache as unavailble
with_lock([&,this]() {
// find or create a new entry
auto iter = _cache.emplace(code_id, code_info {
.mem_end = mem_end,
.mem_image = std::move(mem_image)
}).first;
auto iter = _cache.emplace(code_id, std::move(code_info(mem_end, std::move(mem_image)))).first;
iter->second.instances.emplace_back(std::make_unique<wasm_cache::entry>(instance, module));
pending_result = optional_entry_ref(*iter->second.instances.back().get());
......
......@@ -82,7 +82,7 @@ namespace fc { namespace crypto {
template< typename KeyType >
std::string operator()( const KeyType& key ) const {
using data_type = typename KeyType::data_type;
constexpr int position = Storage::template position<KeyType>;
constexpr int position = Storage::template position<KeyType>();
constexpr bool is_default = position == DefaultPosition;
checksummed_data<data_type> wrapper;
......
......@@ -353,7 +353,7 @@ public:
bool contains() const { return which() == tag<X>::value; }
template<typename X>
static constexpr int position = impl::position<X, Types...>::pos;
static constexpr int position() { return impl::position<X, Types...>::pos; }
template<int Pos, std::enable_if_t<Pos < impl::type_info<Types...>::size,int> = 1>
using type_at = typename impl::type_at<Pos, Types...>::type;
......
......@@ -148,8 +148,8 @@ namespace eosio { namespace testing {
contracts::updateauth{
.account = account,
.permission = perm,
.authority = move(auth),
.parent = parent
.parent = parent,
.data = move(auth),
});
set_tapos( trx );
......
......@@ -333,10 +333,10 @@ void account_history_plugin_impl::applied_block(const signed_block& block)
{
const auto update = msg.as<types::updateauth>();
remove<public_key_history_multi_index, by_account_permission>(db, update.account, update.permission);
add(db, update.authority.keys, update.account, update.permission);
add(db, update.data.keys, update.account, update.permission);
remove<account_control_history_multi_index, by_controlled_authority>(db, update.account, update.permission);
add(db, update.authority.accounts, update.account, update.permission);
add(db, update.data.accounts, update.account, update.permission);
}
else if (msg.type == DELETE_AUTH)
{
......
......@@ -184,7 +184,7 @@ void producer_plugin_impl::schedule_production_loop() {
//_timer.expires_from_now(boost::posix_time::microseconds(time_to_next_block_time));
_timer.expires_from_now( boost::posix_time::microseconds(time_to_next_block_time) );
//_timer.async_wait(boost::bind(&producer_plugin_impl::block_production_loop, this));
_timer.async_wait( [&](auto){ block_production_loop(); } );
_timer.async_wait( [&](const boost::system::error_code&){ block_production_loop(); } );
}
block_production_condition::block_production_condition_enum producer_plugin_impl::block_production_loop() {
......
......@@ -144,7 +144,7 @@ struct txn_test_gen_plugin_impl {
void arm_timer(boost::asio::high_resolution_timer::time_point s) {
timer.expires_at(s + std::chrono::milliseconds(timer_timeout));
timer.async_wait([this](auto ec) {
timer.async_wait([this](const boost::system::error_code& ec) {
if(ec)
return;
try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册