提交 94e2fe76 编写于 作者: K Kevin Heifner 提交者: Bart Wyatt

Committer's Note: this was pruned to changes in the programs and plugins sub-directories

CamelCase types and names converted to under_score names and types. #624
上级 5da0b6a3
......@@ -28,10 +28,10 @@ namespace fc { class variant; }
namespace eosio {
using chain::AccountName;
using chain::account_name;
using chain::block_id_type;
using chain::PermissionName;
using chain::ProcessedTransaction;
using chain::permission_name;
using chain::processed_transaction;
using chain::signed_block;
using boost::multi_index_container;
using chain::transaction_id_type;
......@@ -41,16 +41,16 @@ using get_transactions_results = account_history_apis::read_only::get_transactio
class account_history_plugin_impl {
public:
ProcessedTransaction get_transaction(const chain::transaction_id_type& transaction_id) const;
get_transactions_results get_transactions(const AccountName& account_name, const optional<uint32_t>& skip_seq, const optional<uint32_t>& num_seq) const;
vector<AccountName> get_key_accounts(const public_key_type& public_key) const;
vector<AccountName> get_controlled_accounts(const AccountName& controlling_account) const;
processed_transaction get_transaction(const chain::transaction_id_type& transaction_id) const;
get_transactions_results get_transactions(const account_name& account_name, const optional<uint32_t>& skip_seq, const optional<uint32_t>& num_seq) const;
vector<account_name> get_key_accounts(const public_key_type& public_key) const;
vector<account_name> get_controlled_accounts(const account_name& controlling_account) const;
void applied_block(const signed_block&);
chain_plugin* chain_plug;
static const int64_t DEFAULT_TRANSACTION_TIME_LIMIT;
int64_t transactions_time_limit = DEFAULT_TRANSACTION_TIME_LIMIT;
std::set<AccountName> filter_on;
std::set<account_name> filter_on;
private:
struct block_comp
......@@ -63,12 +63,12 @@ private:
typedef std::multimap<block_id_type, transaction_id_type, block_comp> block_transaction_id_map;
optional<block_id_type> find_block_id(const chainbase::database& db, const transaction_id_type& transaction_id) const;
ProcessedTransaction find_transaction(const chain::transaction_id_type& transaction_id, const signed_block& block) const;
bool is_scope_relevant(const eosio::types::Vector<AccountName>& scope);
processed_transaction find_transaction(const chain::transaction_id_type& transaction_id, const signed_block& block) const;
bool is_scope_relevant(const eosio::types::vector<account_name>& scope);
get_transactions_results ordered_transactions(const block_transaction_id_map& block_transaction_ids, const fc::time_point& start_time, const uint32_t begin, const uint32_t end) const;
static void add(chainbase::database& db, const vector<types::KeyPermissionWeight>& keys, const AccountName& account_name, const PermissionName& permission);
static void add(chainbase::database& db, const vector<types::key_permission_weight>& keys, const account_name& account_name, const permission_name& permission);
template<typename MultiIndex, typename LookupType>
static void remove(chainbase::database& db, const AccountName& account_name, const PermissionName& permission)
static void remove(chainbase::database& db, const account_name& account_name, const permission_name& permission)
{
const auto& idx = db.get_index<MultiIndex, LookupType>();
auto& mutatable_idx = db.get_mutable_index<MultiIndex>();
......@@ -80,22 +80,22 @@ private:
}
}
static void add(chainbase::database& db, const vector<types::AccountPermissionWeight>& controlling_accounts, const AccountName& account_name, const PermissionName& permission);
static void add(chainbase::database& db, const vector<types::account_permission_weight>& controlling_accounts, const account_name& account_name, const permission_name& permission);
bool time_exceeded(const fc::time_point& start_time) const;
static const AccountName NEW_ACCOUNT;
static const AccountName UPDATE_AUTH;
static const AccountName DELETE_AUTH;
static const PermissionName OWNER;
static const PermissionName ACTIVE;
static const PermissionName RECOVERY;
static const account_name NEW_ACCOUNT;
static const account_name UPDATE_AUTH;
static const account_name DELETE_AUTH;
static const permission_name OWNER;
static const permission_name ACTIVE;
static const permission_name RECOVERY;
};
const int64_t account_history_plugin_impl::DEFAULT_TRANSACTION_TIME_LIMIT = 3;
const AccountName account_history_plugin_impl::NEW_ACCOUNT = "newaccount";
const AccountName account_history_plugin_impl::UPDATE_AUTH = "updateauth";
const AccountName account_history_plugin_impl::DELETE_AUTH = "deleteauth";
const PermissionName account_history_plugin_impl::OWNER = "owner";
const PermissionName account_history_plugin_impl::ACTIVE = "active";
const PermissionName account_history_plugin_impl::RECOVERY = "recovery";
const account_name account_history_plugin_impl::NEW_ACCOUNT = "newaccount";
const account_name account_history_plugin_impl::UPDATE_AUTH = "updateauth";
const account_name account_history_plugin_impl::DELETE_AUTH = "deleteauth";
const permission_name account_history_plugin_impl::OWNER = "owner";
const permission_name account_history_plugin_impl::ACTIVE = "active";
const permission_name account_history_plugin_impl::RECOVERY = "recovery";
optional<block_id_type> account_history_plugin_impl::find_block_id(const chainbase::database& db, const transaction_id_type& transaction_id) const
{
......@@ -108,7 +108,7 @@ optional<block_id_type> account_history_plugin_impl::find_block_id(const chainba
return block_id;
}
ProcessedTransaction account_history_plugin_impl::find_transaction(const chain::transaction_id_type& transaction_id, const chain::signed_block& block) const
processed_transaction account_history_plugin_impl::find_transaction(const chain::transaction_id_type& transaction_id, const chain::signed_block& block) const
{
for (const auto& cycle : block.cycles)
for (const auto& thread : cycle)
......@@ -120,7 +120,7 @@ ProcessedTransaction account_history_plugin_impl::find_transaction(const chain::
FC_THROW("Transaction with ID ${tid} was indexed as being in block ID ${bid}, but was not found in that block", ("tid", transaction_id)("bid", block.id()));
}
ProcessedTransaction account_history_plugin_impl::get_transaction(const chain::transaction_id_type& transaction_id) const
processed_transaction account_history_plugin_impl::get_transaction(const chain::transaction_id_type& transaction_id) const
{
const auto& db = chain_plug->chain().get_database();
optional<block_id_type> block_id;
......@@ -139,7 +139,7 @@ ProcessedTransaction account_history_plugin_impl::get_transaction(const chain::t
"Could not find transaction for: ${id}", ("id", transaction_id.str()));
}
get_transactions_results account_history_plugin_impl::get_transactions(const AccountName& account_name, const optional<uint32_t>& skip_seq, const optional<uint32_t>& num_seq) const
get_transactions_results account_history_plugin_impl::get_transactions(const account_name& account_name, const optional<uint32_t>& skip_seq, const optional<uint32_t>& num_seq) const
{
fc::time_point start_time = fc::time_point::now();
const auto& db = chain_plug->chain().get_database();
......@@ -257,9 +257,9 @@ bool account_history_plugin_impl::time_exceeded(const fc::time_point& start_time
return (fc::time_point::now() - start_time).count() > transactions_time_limit;
}
vector<AccountName> account_history_plugin_impl::get_key_accounts(const public_key_type& public_key) const
vector<account_name> account_history_plugin_impl::get_key_accounts(const public_key_type& public_key) const
{
std::set<AccountName> accounts;
std::set<account_name> accounts;
const auto& db = chain_plug->chain().get_database();
db.with_read_lock( [&]() {
const auto& pub_key_idx = db.get_index<public_key_history_multi_index, by_pub_key>();
......@@ -269,12 +269,12 @@ vector<AccountName> account_history_plugin_impl::get_key_accounts(const public_k
accounts.insert(obj->account_name);
}
} );
return vector<AccountName>(accounts.begin(), accounts.end());
return vector<account_name>(accounts.begin(), accounts.end());
}
vector<AccountName> account_history_plugin_impl::get_controlled_accounts(const AccountName& controlling_account) const
vector<account_name> account_history_plugin_impl::get_controlled_accounts(const account_name& controlling_account) const
{
std::set<AccountName> accounts;
std::set<account_name> accounts;
const auto& db = chain_plug->chain().get_database();
db.with_read_lock( [&]() {
const auto& account_control_idx = db.get_index<account_control_history_multi_index, by_controlling>();
......@@ -284,7 +284,7 @@ vector<AccountName> account_history_plugin_impl::get_controlled_accounts(const A
accounts.insert(obj->controlled_account);
}
} );
return vector<AccountName>(accounts.begin(), accounts.end());
return vector<account_name>(accounts.begin(), accounts.end());
}
void account_history_plugin_impl::applied_block(const signed_block& block)
......@@ -314,9 +314,9 @@ void account_history_plugin_impl::applied_block(const signed_block& block)
});
}
for (const chain::Message& msg : trx.messages)
for (const chain::message& msg : trx.messages)
{
if (msg.code == config::EosContractName)
if (msg.code == config::eos_contract_name)
{
if (msg.type == NEW_ACCOUNT)
{
......@@ -352,7 +352,7 @@ void account_history_plugin_impl::applied_block(const signed_block& block)
}
}
void account_history_plugin_impl::add(chainbase::database& db, const vector<types::KeyPermissionWeight>& keys, const AccountName& account_name, const PermissionName& permission)
void account_history_plugin_impl::add(chainbase::database& db, const vector<types::key_permission_weight>& keys, const account_name& account_name, const permission_name& permission)
{
for (auto pub_key_weight : keys )
{
......@@ -364,7 +364,7 @@ void account_history_plugin_impl::add(chainbase::database& db, const vector<type
}
}
void account_history_plugin_impl::add(chainbase::database& db, const vector<types::AccountPermissionWeight>& controlling_accounts, const AccountName& account_name, const PermissionName& permission)
void account_history_plugin_impl::add(chainbase::database& db, const vector<types::account_permission_weight>& controlling_accounts, const account_name& account_name, const permission_name& permission)
{
for (auto controlling_account : controlling_accounts )
{
......@@ -376,9 +376,9 @@ void account_history_plugin_impl::add(chainbase::database& db, const vector<type
}
}
bool account_history_plugin_impl::is_scope_relevant(const eosio::types::Vector<AccountName>& scope)
bool account_history_plugin_impl::is_scope_relevant(const eosio::types::vector<account_name>& scope)
{
for (const AccountName& account_name : scope)
for (const account_name& account_name : scope)
if (filter_on.count(account_name))
return true;
......
......@@ -8,8 +8,8 @@
#include <eos/chain/types.hpp>
namespace eosio {
using chain::AccountName;
using chain::PermissionName;
using chain::account_name;
using chain::permission_name;
using chain::shared_vector;
using chain::transaction_id_type;
using namespace boost::multi_index;
......@@ -18,9 +18,9 @@ class account_control_history_object : public chainbase::object<chain::account_c
OBJECT_CTOR(account_control_history_object)
id_type id;
AccountName controlled_account;
PermissionName controlled_permission;
AccountName controlling_account;
account_name controlled_account;
permission_name controlled_permission;
account_name controlling_account;
};
struct by_id;
......@@ -30,13 +30,13 @@ using account_control_history_multi_index = chainbase::shared_multi_index_contai
account_control_history_object,
indexed_by<
ordered_unique<tag<by_id>, BOOST_MULTI_INDEX_MEMBER(account_control_history_object, account_control_history_object::id_type, id)>,
hashed_non_unique<tag<by_controlling>, BOOST_MULTI_INDEX_MEMBER(account_control_history_object, AccountName, controlling_account), std::hash<AccountName>>,
hashed_non_unique<tag<by_controlling>, BOOST_MULTI_INDEX_MEMBER(account_control_history_object, account_name, controlling_account), std::hash<account_name>>,
hashed_non_unique<tag<by_controlled_authority>,
composite_key< account_control_history_object,
member<account_control_history_object, AccountName, &account_control_history_object::controlled_account>,
member<account_control_history_object, PermissionName, &account_control_history_object::controlled_permission>
member<account_control_history_object, account_name, &account_control_history_object::controlled_account>,
member<account_control_history_object, permission_name, &account_control_history_object::controlled_permission>
>,
composite_key_hash< std::hash<AccountName>, std::hash<PermissionName> >
composite_key_hash< std::hash<account_name>, std::hash<permission_name> >
>
>
>;
......
......@@ -13,7 +13,7 @@ namespace eosio {
using chain::transaction_id_type;
using std::shared_ptr;
using namespace appbase;
using chain::Name;
using chain::name;
using fc::optional;
using chain::uint128_t;
......@@ -42,7 +42,7 @@ public:
struct get_transactions_params {
chain::AccountName account_name;
chain::account_name account_name;
optional<uint32_t> skip_seq;
optional<uint32_t> num_seq;
};
......@@ -63,16 +63,16 @@ public:
chain::public_key_type public_key;
};
struct get_key_accounts_results {
vector<chain::AccountName> account_names;
vector<chain::account_name> account_names;
};
get_key_accounts_results get_key_accounts(const get_key_accounts_params& params) const;
struct get_controlled_accounts_params {
chain::AccountName controlling_account;
chain::account_name controlling_account;
};
struct get_controlled_accounts_results {
vector<chain::AccountName> controlled_accounts;
vector<chain::account_name> controlled_accounts;
};
get_controlled_accounts_results get_controlled_accounts(const get_controlled_accounts_params& params) const;
};
......
......@@ -10,9 +10,9 @@
namespace std {
template<>
struct hash<eosio::chain::AccountName>
struct hash<eosio::chain::account_name>
{
size_t operator()( const eosio::chain::AccountName& name )const
size_t operator()( const eosio::chain::account_name& name )const
{
return (uint64_t)name;
}
......@@ -20,7 +20,7 @@ namespace std {
}
namespace eosio {
using chain::AccountName;
using chain::account_name;
using chain::shared_vector;
using chain::transaction_id_type;
using namespace boost::multi_index;
......@@ -29,7 +29,7 @@ class account_transaction_history_object : public chainbase::object<chain::accou
OBJECT_CTOR(account_transaction_history_object)
id_type id;
AccountName account_name;
account_name account_name;
transaction_id_type transaction_id;
};
......@@ -40,13 +40,13 @@ using account_transaction_history_multi_index = chainbase::shared_multi_index_co
account_transaction_history_object,
indexed_by<
ordered_unique<tag<by_id>, BOOST_MULTI_INDEX_MEMBER(account_transaction_history_object, account_transaction_history_object::id_type, id)>,
hashed_non_unique<tag<by_account_name>, BOOST_MULTI_INDEX_MEMBER(account_transaction_history_object, AccountName, account_name), std::hash<AccountName>>,
hashed_non_unique<tag<by_account_name>, BOOST_MULTI_INDEX_MEMBER(account_transaction_history_object, account_name, account_name), std::hash<account_name>>,
hashed_unique<tag<by_account_name_trx_id>,
composite_key< account_transaction_history_object,
member<account_transaction_history_object, AccountName, &account_transaction_history_object::account_name>,
member<account_transaction_history_object, account_name, &account_transaction_history_object::account_name>,
member<account_transaction_history_object, transaction_id_type, &account_transaction_history_object::transaction_id>
>,
composite_key_hash< std::hash<AccountName>, std::hash<transaction_id_type> >
composite_key_hash< std::hash<account_name>, std::hash<transaction_id_type> >
>
>
>;
......
......@@ -21,9 +21,9 @@ namespace std {
}
namespace eosio {
using chain::AccountName;
using chain::account_name;
using chain::public_key_type;
using chain::PermissionName;
using chain::permission_name;
using namespace boost::multi_index;
class public_key_history_object : public chainbase::object<chain::public_key_history_object_type, public_key_history_object> {
......@@ -31,8 +31,8 @@ class public_key_history_object : public chainbase::object<chain::public_key_his
id_type id;
public_key_type public_key;
AccountName account_name;
PermissionName permission;
account_name account_name;
permission_name permission;
};
struct by_id;
......@@ -45,12 +45,12 @@ using public_key_history_multi_index = chainbase::shared_multi_index_container<
hashed_non_unique<tag<by_pub_key>, BOOST_MULTI_INDEX_MEMBER(public_key_history_object, public_key_type, public_key), std::hash<public_key_type> >,
hashed_non_unique<tag<by_account_permission>,
composite_key< public_key_history_object,
member<public_key_history_object, AccountName, &public_key_history_object::account_name>,
member<public_key_history_object, PermissionName, &public_key_history_object::permission>
member<public_key_history_object, account_name, &public_key_history_object::account_name>,
member<public_key_history_object, permission_name, &public_key_history_object::permission>
>,
composite_key_hash<
std::hash<AccountName>,
std::hash<PermissionName>
std::hash<account_name>,
std::hash<permission_name>
>
>
>
......
......@@ -46,7 +46,7 @@ class chain_plugin_impl {
public:
bfs::path block_log_dir;
bfs::path genesis_file;
chain::Time genesis_timestamp;
chain::time genesis_timestamp;
uint32_t skip_flags = chain_controller::skip_nothing;
bool readonly = false;
flat_map<uint32_t,block_id_type> loaded_checkpoints;
......@@ -92,13 +92,13 @@ void chain_plugin::set_program_options(options_description& cli, options_descrip
"Limits the maximum time (in milliseconds) that is allowed a pushed transaction's code to execute.")
("create-block-trans-execution-time", bpo::value<uint32_t>()->default_value(default_create_block_transaction_execution_time),
"Limits the maximum time (in milliseconds) that is allowed a transaction's code to execute while creating a block.")
("per-authorized-account-transaction-msg-rate-limit-time-frame-sec", bpo::value<uint32_t>()->default_value(config::DefaultPerAuthAccountTimeFrameSeconds),
("per-authorized-account-transaction-msg-rate-limit-time-frame-sec", bpo::value<uint32_t>()->default_value(config::default_per_auth_account_time_frame_seconds),
"The time frame, in seconds, that the per-authorized-account-transaction-msg-rate-limit is imposed over.")
("per-authorized-account-transaction-msg-rate-limit", bpo::value<uint32_t>()->default_value(config::DefaultPerAuthAccount),
("per-authorized-account-transaction-msg-rate-limit", bpo::value<uint32_t>()->default_value(config::default_per_auth_account),
"Limits the maximum rate of transaction messages that an account is allowed each per-authorized-account-transaction-msg-rate-limit-time-frame-sec.")
("per-code-account-transaction-msg-rate-limit-time-frame-sec", bpo::value<uint32_t>()->default_value(config::DefaultPerCodeAccountTimeFrameSeconds),
("per-code-account-transaction-msg-rate-limit-time-frame-sec", bpo::value<uint32_t>()->default_value(config::default_per_code_account_time_frame_seconds),
"The time frame, in seconds, that the per-code-account-transaction-msg-rate-limit is imposed over.")
("per-code-account-transaction-msg-rate-limit", bpo::value<uint32_t>()->default_value(config::DefaultPerCodeAccount),
("per-code-account-transaction-msg-rate-limit", bpo::value<uint32_t>()->default_value(config::default_per_code_account),
"Limits the maximum rate of transaction messages that an account's code is allowed each per-code-account-transaction-msg-rate-limit-time-frame-sec.")
;
cli.add_options()
......@@ -107,7 +107,7 @@ void chain_plugin::set_program_options(options_description& cli, options_descrip
("resync-blockchain", bpo::bool_switch()->default_value(false),
"clear chain database and block log")
("skip-transaction-signatures", bpo::bool_switch()->default_value(false),
"Disable Transaction signature verification. ONLY for TESTING.")
"Disable transaction signature verification. ONLY for TESTING.")
;
}
......@@ -121,15 +121,15 @@ void chain_plugin::plugin_initialize(const variables_map& options) {
string tstr = options.at("genesis-timestamp").as<string>();
if (strcasecmp (tstr.c_str(), "now") == 0) {
my->genesis_timestamp = fc::time_point::now();
auto diff = my->genesis_timestamp.sec_since_epoch() % config::BlockIntervalSeconds;
auto diff = my->genesis_timestamp.sec_since_epoch() % config::block_interval_seconds;
if (diff > 0) {
auto delay = (config::BlockIntervalSeconds - diff);
auto delay = (config::block_interval_seconds - diff);
my->genesis_timestamp += delay;
dlog ("pausing ${s} seconds to the next interval",("s",delay));
}
}
else {
my->genesis_timestamp = chain::Time::from_iso_string (tstr);
my->genesis_timestamp = chain::time::from_iso_string (tstr);
}
}
if (options.count("block-log-dir")) {
......@@ -253,7 +253,7 @@ bool chain_plugin::accept_block(const chain::signed_block& block, bool currently
return chain().push_block(block, my->skip_flags);
}
void chain_plugin::accept_transaction(const chain::SignedTransaction& trx) {
void chain_plugin::accept_transaction(const chain::signed_transaction& trx) {
chain().push_transaction(trx, my->skip_flags);
}
......@@ -298,26 +298,26 @@ read_only::get_info_results read_only::get_info(const read_only::get_info_params
};
}
types::Abi getAbi( const chain_controller& db, const Name& account ) {
types::abi getAbi( const chain_controller& db, const name& account ) {
const auto& d = db.get_database();
const auto& code_accnt = d.get<account_object,by_name>( account );
eosio::types::Abi abi;
types::AbiSerializer::to_abi(code_accnt.abi, abi);
eosio::types::abi abi;
types::abi_serializer::to_abi(code_accnt.abi, abi);
return abi;
}
string getTableType( const types::Abi& abi, const Name& tablename ) {
string getTableType( const types::abi& abi, const name& tablename ) {
for( const auto& t : abi.tables ) {
if( t.table == tablename ){
return t.indextype;
if( t.table_name == tablename ){
return t.index_type;
}
}
FC_ASSERT( !"Abi does not define table", "Table ${table} not specified in ABI", ("table",tablename) );
FC_ASSERT( !"ABI does not define table", "Table ${table} not specified in ABI", ("table",tablename) );
}
read_only::get_table_rows_result read_only::get_table_rows( const read_only::get_table_rows_params& p )const {
const types::Abi abi = getAbi( db, p.code );
const types::abi abi = getAbi( db, p.code );
auto table_type = getTableType( abi, p.table );
auto table_key = PRIMARY;
......@@ -393,8 +393,8 @@ read_only::get_code_results read_only::get_code( const get_code_params& params )
result.wast = chain::wasm_to_wast( (const uint8_t*)accnt.code.data(), accnt.code.size() );
result.code_hash = fc::sha256::hash( accnt.code.data(), accnt.code.size() );
}
eosio::types::Abi abi;
if( types::AbiSerializer::to_abi(accnt.abi, abi) ) {
eosio::types::abi abi;
if( types::abi_serializer::to_abi(accnt.abi, abi) ) {
result.abi = std::move(abi);
}
return result;
......@@ -410,16 +410,16 @@ read_only::get_account_results read_only::get_account( const get_account_params&
const auto& balance = d.get<BalanceObject,byOwnerName>( params.name );
const auto& staked_balance = d.get<StakedBalanceObject,byOwnerName>( params.name );
result.eos_balance = Asset(balance.balance, EOS_SYMBOL);
result.staked_balance = Asset(staked_balance.stakedBalance);
result.unstaking_balance = Asset(staked_balance.unstakingBalance);
result.eos_balance = asset(balance.balance, EOS_SYMBOL);
result.staked_balance = asset(staked_balance.stakedBalance);
result.unstaking_balance = asset(staked_balance.unstakingBalance);
result.last_unstaking_time = staked_balance.lastUnstakingTime;
const auto& permissions = d.get_index<permission_index,by_owner>();
auto perm = permissions.lower_bound( boost::make_tuple( params.name ) );
while( perm != permissions.end() && perm->owner == params.name ) {
/// TODO: lookup perm->parent name
Name parent;
name parent;
// Don't lookup parent if null
if( perm->parent._id ) {
......
......@@ -7,7 +7,7 @@
#include <eos/chain/chain_controller.hpp>
#include <eos/chain/key_value_object.hpp>
#include <eos/chain/account_object.hpp>
#include <eos/types/AbiSerializer.hpp>
#include <eos/types/abi_serializer.hpp>
#include <eos/database_plugin/database_plugin.hpp>
......@@ -19,20 +19,20 @@ namespace eosio {
using eosio::chain::chain_controller;
using std::unique_ptr;
using namespace appbase;
using chain::Name;
using chain::name;
using chain::uint128_t;
using chain::public_key_type;
using fc::optional;
using boost::container::flat_set;
using chain::Asset;
using chain::asset;
namespace chain_apis {
struct empty{};
struct permission {
Name name;
Name parent;
types::Authority required_auth;
name perm_name;
name parent;
types::authority required_auth;
};
class read_only {
......@@ -57,69 +57,69 @@ public:
uint32_t last_irreversible_block_num = 0;
chain::block_id_type head_block_id;
fc::time_point_sec head_block_time;
types::AccountName head_block_producer;
types::account_name head_block_producer;
string recent_slots;
double participation_rate = 0;
};
get_info_results get_info(const get_info_params&) const;
struct producer_info {
Name name;
name name;
};
struct get_account_results {
Name name;
Asset eos_balance = Asset(0,EOS_SYMBOL);
Asset staked_balance;
Asset unstaking_balance;
name name;
asset eos_balance = asset(0,EOS_SYMBOL);
asset staked_balance;
asset unstaking_balance;
fc::time_point_sec last_unstaking_time;
vector<permission> permissions;
optional<producer_info> producer;
};
struct get_account_params {
Name name;
name name;
};
get_account_results get_account( const get_account_params& params )const;
struct get_code_results {
Name name;
name name;
string wast;
fc::sha256 code_hash;
optional<types::Abi> abi;
optional<types::abi> abi;
};
struct get_code_params {
Name name;
name name;
};
get_code_results get_code( const get_code_params& params )const;
struct abi_json_to_bin_params {
Name code;
Name action;
name code;
name action;
fc::variant args;
};
struct abi_json_to_bin_result {
vector<char> binargs;
vector<Name> required_scope;
vector<Name> required_auth;
vector<name> required_scope;
vector<name> required_auth;
};
abi_json_to_bin_result abi_json_to_bin( const abi_json_to_bin_params& params )const;
struct abi_bin_to_json_params {
Name code;
Name action;
name code;
name action;
vector<char> binargs;
};
struct abi_bin_to_json_result {
fc::variant args;
vector<Name> required_scope;
vector<Name> required_auth;
vector<name> required_scope;
vector<name> required_auth;
};
abi_bin_to_json_result abi_bin_to_json( const abi_bin_to_json_params& params )const;
......@@ -157,9 +157,9 @@ public:
struct get_table_rows_params {
bool json = false;
Name scope;
Name code;
Name table;
name scope;
name code;
name table;
// string table_type;
string table_key;
string lower_bound;
......@@ -204,16 +204,16 @@ public:
}
template <typename IndexType, typename Scope>
read_only::get_table_rows_result get_table_rows_ex( const read_only::get_table_rows_params& p, const types::Abi& abi )const {
read_only::get_table_rows_result get_table_rows_ex( const read_only::get_table_rows_params& p, const types::abi& abi )const {
read_only::get_table_rows_result result;
const auto& d = db.get_database();
types::AbiSerializer abis;
types::abi_serializer abis;
abis.setAbi(abi);
const auto& idx = d.get_index<IndexType, Scope>();
auto lower = idx.lower_bound( boost::make_tuple(p.scope, p.code, p.table ) );
auto upper = idx.upper_bound( boost::make_tuple(p.scope, p.code, Name(uint64_t(p.table)+1) ) );
auto upper = idx.upper_bound( boost::make_tuple(p.scope, p.code, name(uint64_t(p.table)+1) ) );
if( p.lower_bound.size() )
lower = idx.lower_bound( boost::make_tuple(p.scope, p.code, p.table, fc::variant(p.lower_bound).as<typename IndexType::value_type::key_type>() ) );
......@@ -230,7 +230,7 @@ public:
copy_row(*itr, data);
if( p.json )
result.rows.emplace_back( abis.binaryToVariant( abis.getTableType(p.table), data ) );
result.rows.emplace_back(abis.binary_to_variant(abis.get_table_type(p.table), data) );
else
result.rows.emplace_back( fc::variant(data) );
if( ++count == p.limit || fc::time_point::now() > end )
......@@ -284,7 +284,7 @@ public:
chain_apis::read_write get_read_write_api();
bool accept_block(const chain::signed_block& block, bool currently_syncing);
void accept_transaction(const chain::SignedTransaction& trx);
void accept_transaction(const chain::signed_transaction& trx);
bool block_is_on_preferred_chain(const chain::block_id_type& block_id);
......@@ -308,7 +308,7 @@ private:
}
FC_REFLECT( eosio::chain_apis::permission, (name)(parent)(required_auth) )
FC_REFLECT( eosio::chain_apis::permission, (perm_name)(parent)(required_auth) )
FC_REFLECT(eosio::chain_apis::empty, )
FC_REFLECT(eosio::chain_apis::read_only::get_info_results,
(head_block_num)(last_irreversible_block_num)(head_block_id)(head_block_time)(head_block_producer)
......
......@@ -32,11 +32,11 @@ namespace fc { class variant; }
namespace eosio {
using chain::AccountName;
using chain::FuncName;
using chain::account_name;
using chain::func_name;
using chain::block_id_type;
using chain::PermissionName;
using chain::ProcessedTransaction;
using chain::permission_name;
using chain::processed_transaction;
using chain::signed_block;
using chain::transaction_id_type;
......@@ -60,8 +60,8 @@ public:
void init();
void wipe_database();
std::set<AccountName> filter_on;
static types::Abi eos_abi; // cached for common use
std::set<account_name> filter_on;
static types::abi eos_abi; // cached for common use
bool configured{false};
bool wipe_database_on_startup{false};
......@@ -82,15 +82,15 @@ public:
void consum_blocks();
bool is_scope_relevant(const eosio::types::Vector<AccountName>& scope);
void update_account(const chain::Message& msg);
bool is_scope_relevant(const eosio::types::vector<account_name>& scope);
void update_account(const chain::message& msg);
static const FuncName newaccount;
static const FuncName transfer;
static const FuncName lock;
static const FuncName unlock;
static const FuncName claim;
static const FuncName setcode;
static const func_name newaccount;
static const func_name transfer;
static const func_name lock;
static const func_name unlock;
static const func_name claim;
static const func_name setcode;
static const std::string blocks_col;
static const std::string trans_col;
......@@ -98,14 +98,14 @@ public:
static const std::string accounts_col;
};
types::Abi db_plugin_impl::eos_abi;
types::abi db_plugin_impl::eos_abi;
const FuncName db_plugin_impl::newaccount = "newaccount";
const FuncName db_plugin_impl::transfer = "transfer";
const FuncName db_plugin_impl::lock = "lock";
const FuncName db_plugin_impl::unlock = "unlock";
const FuncName db_plugin_impl::claim = "claim";
const FuncName db_plugin_impl::setcode = "setcode";
const func_name db_plugin_impl::newaccount = "newaccount";
const func_name db_plugin_impl::transfer = "transfer";
const func_name db_plugin_impl::lock = "lock";
const func_name db_plugin_impl::unlock = "unlock";
const func_name db_plugin_impl::claim = "claim";
const func_name db_plugin_impl::setcode = "setcode";
const std::string db_plugin_impl::blocks_col = "Blocks";
const std::string db_plugin_impl::trans_col = "Transactions";
......@@ -171,10 +171,10 @@ void db_plugin_impl::consum_blocks() {
namespace {
auto find_account(mongocxx::collection& accounts, const AccountName& name) {
auto find_account(mongocxx::collection& accounts, const account_name& name) {
using bsoncxx::builder::stream::document;
document find_acc{};
find_acc << "name" << name.toString();
find_acc << "name" << name.to_string();
auto account = accounts.find_one(find_acc.view());
if (!account) {
FC_THROW("Unable to find account ${n}", ("n", name));
......@@ -184,19 +184,19 @@ namespace {
void add_data(bsoncxx::builder::basic::document& msg_doc,
mongocxx::collection& accounts,
const chain::Message& msg)
const chain::message& msg)
{
using bsoncxx::builder::basic::kvp;
try {
types::AbiSerializer abis;
if (msg.code == config::EosContractName) {
types::abi_serializer abis;
if (msg.code == config::eos_contract_name) {
abis.setAbi(db_plugin_impl::eos_abi);
} else {
auto from_account = find_account(accounts, msg.code);
auto abi = fc::json::from_string(bsoncxx::to_json(from_account.view()["abi"].get_document())).as<types::Abi>();
auto abi = fc::json::from_string(bsoncxx::to_json(from_account.view()["abi"].get_document())).as<types::abi>();
abis.setAbi(abi);
}
auto v = abis.binaryToVariant(abis.getActionType(msg.type), msg.data);
auto v = abis.binary_to_variant(abis.get_action_type(msg.type), msg.data);
auto json = fc::json::to_string(v);
try {
const auto& value = bsoncxx::from_json(json);
......@@ -207,7 +207,7 @@ namespace {
elog(" EOS JSON: ${j}", ("j", json));
}
} catch (fc::exception& e) {
elog("Unable to convert Message.data to ABI type: ${t}, what: ${e}", ("t", msg.type)("e", e.to_string()));
elog("Unable to convert message.data to ABI type: ${t}, what: ${e}", ("t", msg.type)("e", e.to_string()));
}
// if anything went wrong just store raw hex_data
msg_doc.append(kvp("hex_data", fc::variant(msg.data).as_string()));
......@@ -273,7 +273,7 @@ void db_plugin_impl::_process_irreversible_block(const signed_block& block)
FC_ASSERT(block_num < 2, "Expected start of block, instead received block_num: ${bn}", ("bn", block_num));
// Currently we are creating a 'fake' block in chain_controller::initialize_chain() since initial accounts
// and producers are not written to the block log. If this is the fake block, indicate it as block_num 0.
if (block_num == 1 && block.producer == config::EosContractName) {
if (block_num == 1 && block.producer == config::eos_contract_name) {
block_num = 0;
}
} else {
......@@ -291,7 +291,7 @@ void db_plugin_impl::_process_irreversible_block(const signed_block& block)
<< "prev_block_id" << prev_block_id_str
<< "timestamp" << b_date{std::chrono::milliseconds{std::chrono::seconds{block.timestamp.sec_since_epoch()}}}
<< "transaction_merkle_root" << block.transaction_merkle_root.str()
<< "producer_account_id" << block.producer.toString();
<< "producer_account_id" << block.producer.to_string();
auto blk_doc = block_doc << "transactions" << stream::open_array;
int32_t trx_num = -1;
......@@ -312,16 +312,16 @@ void db_plugin_impl::_process_irreversible_block(const signed_block& block)
<< "transaction_id" << trans_id_str
<< "sequence_num" << b_int32{trx_num}
<< "block_id" << block_id_str
<< "ref_block_num" << b_int32{static_cast<int32_t >(trx.refBlockNum)}
<< "ref_block_prefix" << trx.refBlockPrefix.str()
<< "ref_block_num" << b_int32{static_cast<int32_t >(trx.ref_block_num)}
<< "ref_block_prefix" << trx.ref_block_prefix.str()
<< "scope" << stream::open_array;
for (const auto& account_name : trx.scope)
trx_doc = trx_doc << account_name.toString();
trx_doc = trx_doc << account_name.to_string();
trx_doc = trx_doc
<< stream::close_array
<< "read_scope" << stream::open_array;
for (const auto& account_name : trx.readscope)
trx_doc = trx_doc << account_name.toString();
for (const auto& account_name : trx.read_scope)
trx_doc = trx_doc << account_name.to_string();
trx_doc = trx_doc
<< stream::close_array
<< "expiration" << b_date{std::chrono::milliseconds{std::chrono::seconds{trx.expiration.sec_since_epoch()}}}
......@@ -346,20 +346,20 @@ void db_plugin_impl::_process_irreversible_block(const signed_block& block)
msg_doc.append(kvp("authorization", [&msg](bsoncxx::builder::basic::sub_array subarr) {
for (const auto& auth : msg.authorization) {
subarr.append([&auth](bsoncxx::builder::basic::sub_document subdoc) {
subdoc.append(kvp("account", auth.account.toString()),
kvp("permission", auth.permission.toString()));
subdoc.append(kvp("account", auth.account.to_string()),
kvp("permission", auth.permission.to_string()));
});
}
}));
msg_doc.append(kvp("handler_account_name", msg.code.toString()));
msg_doc.append(kvp("type", msg.type.toString()));
msg_doc.append(kvp("handler_account_name", msg.code.to_string()));
msg_doc.append(kvp("type", msg.type.to_string()));
add_data(msg_doc, accounts, msg);
msg_doc.append(kvp("createdAt", b_date{now}));
mongocxx::model::insert_one insert_msg{msg_doc.view()};
bulk_msgs.append(insert_msg);
// eos account update
if (msg.code == config::EosContractName) {
if (msg.code == config::eos_contract_name) {
try {
update_account(msg);
} catch(fc::exception& e) {
......@@ -407,7 +407,7 @@ void db_plugin_impl::_process_irreversible_block(const signed_block& block)
}
// For now providing some simple account processing to maintain eos_balance
void db_plugin_impl::update_account(const chain::Message& msg) {
void db_plugin_impl::update_account(const chain::message& msg) {
using bsoncxx::builder::basic::kvp;
using bsoncxx::builder::stream::document;
using bsoncxx::builder::stream::open_document;
......@@ -415,29 +415,29 @@ void db_plugin_impl::update_account(const chain::Message& msg) {
using bsoncxx::builder::stream::finalize;
using namespace bsoncxx::types;
if (msg.code != config::EosContractName)
if (msg.code != config::eos_contract_name)
return;
if (msg.type == transfer) {
auto now = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::microseconds{fc::time_point::now().time_since_epoch().count()});
auto transfer = msg.as<types::transfer>();
auto from_name = transfer.from.toString();
auto to_name = transfer.to.toString();
auto from_name = transfer.from.to_string();
auto to_name = transfer.to.to_string();
auto from_account = find_account(accounts, transfer.from);
auto to_account = find_account(accounts, transfer.to);
Asset from_balance = Asset::fromString(from_account.view()["eos_balance"].get_utf8().value.to_string());
Asset to_balance = Asset::fromString(to_account.view()["eos_balance"].get_utf8().value.to_string());
from_balance -= eosio::types::ShareType(transfer.amount);
to_balance += eosio::types::ShareType(transfer.amount);
asset from_balance = asset::from_string(from_account.view()["eos_balance"].get_utf8().value.to_string());
asset to_balance = asset::from_string(to_account.view()["eos_balance"].get_utf8().value.to_string());
from_balance -= eosio::types::share_type(transfer.amount);
to_balance += eosio::types::share_type(transfer.amount);
document update_from{};
update_from << "$set" << open_document << "eos_balance" << from_balance.toString()
update_from << "$set" << open_document << "eos_balance" << from_balance.to_string()
<< "updatedAt" << b_date{now}
<< close_document;
document update_to{};
update_to << "$set" << open_document << "eos_balance" << to_balance.toString()
update_to << "$set" << open_document << "eos_balance" << to_balance.to_string()
<< "updatedAt" << b_date{now}
<< close_document;
......@@ -450,7 +450,7 @@ void db_plugin_impl::update_account(const chain::Message& msg) {
auto newaccount = msg.as<types::newaccount>();
// find creator to update its balance
auto from_name = newaccount.creator.toString();
auto from_name = newaccount.creator.to_string();
document find_from{};
find_from << "name" << from_name;
auto from_account = accounts.find_one(find_from.view());
......@@ -460,18 +460,18 @@ void db_plugin_impl::update_account(const chain::Message& msg) {
}
// decrease creator by deposit amount
auto from_view = from_account->view();
Asset from_balance = Asset::fromString(from_view["eos_balance"].get_utf8().value.to_string());
asset from_balance = asset::from_string(from_view["eos_balance"].get_utf8().value.to_string());
from_balance -= newaccount.deposit;
document update_from{};
update_from << "$set" << open_document << "eos_balance" << from_balance.toString() << close_document;
update_from << "$set" << open_document << "eos_balance" << from_balance.to_string() << close_document;
accounts.update_one(find_from.view(), update_from.view());
// create new account with staked deposit amount
bsoncxx::builder::stream::document doc{};
doc << "name" << newaccount.name.toString()
<< "eos_balance" << Asset().toString()
<< "staked_balance" << newaccount.deposit.toString()
<< "unstaking_balance" << Asset().toString()
doc << "name" << newaccount.name.to_string()
<< "eos_balance" << asset().to_string()
<< "staked_balance" << newaccount.deposit.to_string()
<< "unstaking_balance" << asset().to_string()
<< "createdAt" << b_date{now}
<< "updatedAt" << b_date{now};
if (!accounts.insert_one(doc.view())) {
......@@ -485,17 +485,17 @@ void db_plugin_impl::update_account(const chain::Message& msg) {
auto from_account = find_account(accounts, lock.from);
auto to_account = find_account(accounts, lock.to);
Asset from_balance = Asset::fromString(from_account.view()["eos_balance"].get_utf8().value.to_string());
Asset to_balance = Asset::fromString(to_account.view()["stacked_balance"].get_utf8().value.to_string());
asset from_balance = asset::from_string(from_account.view()["eos_balance"].get_utf8().value.to_string());
asset to_balance = asset::from_string(to_account.view()["stacked_balance"].get_utf8().value.to_string());
from_balance -= lock.amount;
to_balance += lock.amount;
document update_from{};
update_from << "$set" << open_document << "eos_balance" << from_balance.toString()
update_from << "$set" << open_document << "eos_balance" << from_balance.to_string()
<< "updatedAt" << b_date{now}
<< close_document;
document update_to{};
update_to << "$set" << open_document << "stacked_balance" << to_balance.toString()
update_to << "$set" << open_document << "stacked_balance" << to_balance.to_string()
<< "updatedAt" << b_date{now}
<< close_document;
......@@ -508,8 +508,8 @@ void db_plugin_impl::update_account(const chain::Message& msg) {
auto unlock = msg.as<types::unlock>();
auto from_account = find_account(accounts, unlock.account);
Asset unstack_balance = Asset::fromString(from_account.view()["unstacking_balance"].get_utf8().value.to_string());
Asset stack_balance = Asset::fromString(from_account.view()["stacked_balance"].get_utf8().value.to_string());
asset unstack_balance = asset::from_string(from_account.view()["unstacking_balance"].get_utf8().value.to_string());
asset stack_balance = asset::from_string(from_account.view()["stacked_balance"].get_utf8().value.to_string());
auto deltaStake = unstack_balance - unlock.amount;
stack_balance += deltaStake;
unstack_balance = unlock.amount;
......@@ -517,8 +517,8 @@ void db_plugin_impl::update_account(const chain::Message& msg) {
document update_from{};
update_from << "$set" << open_document
<< "staked_balance" << stack_balance.toString()
<< "unstacking_balance" << unstack_balance.toString()
<< "staked_balance" << stack_balance.to_string()
<< "unstacking_balance" << unstack_balance.to_string()
<< "updatedAt" << b_date{now}
<< close_document;
......@@ -530,15 +530,15 @@ void db_plugin_impl::update_account(const chain::Message& msg) {
auto claim = msg.as<types::claim>();
auto from_account = find_account(accounts, claim.account);
Asset balance = Asset::fromString(from_account.view()["eos_balance"].get_utf8().value.to_string());
Asset unstack_balance = Asset::fromString(from_account.view()["unstacking_balance"].get_utf8().value.to_string());
asset balance = asset::from_string(from_account.view()["eos_balance"].get_utf8().value.to_string());
asset unstack_balance = asset::from_string(from_account.view()["unstacking_balance"].get_utf8().value.to_string());
unstack_balance -= claim.amount;
balance += claim.amount;
document update_from{};
update_from << "$set" << open_document
<< "eos_balance" << balance.toString()
<< "unstacking_balance" << unstack_balance.toString()
<< "eos_balance" << balance.to_string()
<< "unstacking_balance" << unstack_balance.to_string()
<< "updatedAt" << b_date{now}
<< close_document;
......@@ -560,9 +560,9 @@ void db_plugin_impl::update_account(const chain::Message& msg) {
}
}
bool db_plugin_impl::is_scope_relevant(const eosio::types::Vector<AccountName>& scope)
bool db_plugin_impl::is_scope_relevant(const eosio::types::vector<account_name>& scope)
{
for (const AccountName& account_name : scope)
for (const account_name& account_name : scope)
if (filter_on.count(account_name))
return true;
......@@ -612,16 +612,16 @@ void db_plugin_impl::init() {
if (accounts.count(doc.view()) == 0) {
auto now = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::microseconds{fc::time_point::now().time_since_epoch().count()});
doc << "name" << config::EosContractName.toString()
<< "eos_balance" << Asset(config::InitialTokenSupply).toString()
<< "staked_balance" << Asset().toString()
<< "unstaking_balance" << Asset().toString()
doc << "name" << config::eos_contract_name.to_string()
<< "eos_balance" << asset(config::initial_token_supply).to_string()
<< "staked_balance" << asset().to_string()
<< "unstaking_balance" << asset().to_string()
<< "abi" << bsoncxx::from_json(fc::json::to_string(eos_abi))
<< "createdAt" << b_date{now}
<< "updatedAt" << b_date{now};
if (!accounts.insert_one(doc.view())) {
elog("Failed to insert account ${n}", ("n", config::EosContractName.toString()));
elog("Failed to insert account ${n}", ("n", config::eos_contract_name.to_string()));
}
// Accounts indexes
......
......@@ -18,7 +18,7 @@ namespace eosio {
block_id_type head_id;
string os;
string agent;
int16_t generation;
int16_t generation;
};
enum go_away_reason {
......@@ -102,7 +102,7 @@ namespace eosio {
struct processed_trans_summary {
transaction_id_type id;
vector<MessageOutput> outmsgs;
vector<message_output> outmsgs;
};
struct thread_ids {
......@@ -128,10 +128,10 @@ namespace eosio {
request_message,
sync_request_message,
block_summary_message,
SignedTransaction,
signed_transaction,
signed_block>;
} // namespace eos
} // namespace eosio
FC_REFLECT( eosio::select_ids<fc::sha256>, (mode)(pending)(ids) )
FC_REFLECT( eosio::handshake_message,
......
......@@ -57,16 +57,16 @@ namespace eosio {
};
struct update_block_num {
UInt16 new_bnum;
update_block_num (UInt16 bnum) : new_bnum(bnum) {}
uint16 new_bnum;
update_block_num (uint16 bnum) : new_bnum(bnum) {}
void operator() (node_transaction_state& nts) {
nts.block_num = static_cast<uint32_t>(new_bnum);
}
};
struct update_entry {
const SignedTransaction &txn;
update_entry (const SignedTransaction &msg) : txn(msg) {}
const signed_transaction &txn;
update_entry (const signed_transaction &msg) : txn(msg) {}
void operator() (node_transaction_state& nts) {
nts.received = fc::time_point::now();
......@@ -153,11 +153,11 @@ namespace eosio {
void send_all (const net_message &msg, VerifierFunc verify);
// template<typename VerifierFunc>
// void send_all (net_message_ptr msg, VerifierFunc verify);
void send_all_txn (const SignedTransaction& txn);
static void transaction_ready( const SignedTransaction& txn);
void send_all_txn (const signed_transaction& txn);
static void transaction_ready( const signed_transaction& txn);
void broadcast_block_impl( const signed_block &sb);
size_t cache_txn ( const transaction_id_type, const SignedTransaction &txn);
size_t cache_txn ( const transaction_id_type, const signed_transaction &txn);
void handle_message( connection_ptr c, const handshake_message &msg);
void handle_message( connection_ptr c, const go_away_message &msg );
......@@ -180,7 +180,7 @@ namespace eosio {
void handle_message( connection_ptr c, const request_message &msg);
void handle_message( connection_ptr c, const sync_request_message &msg);
void handle_message( connection_ptr c, const block_summary_message &msg);
void handle_message( connection_ptr c, const SignedTransaction &msg);
void handle_message( connection_ptr c, const signed_transaction &msg);
void handle_message( connection_ptr c, const signed_block &msg);
void start_conn_timer( );
......@@ -1584,7 +1584,7 @@ namespace eosio {
for( auto &gt : cyc_thr_id.gen_trx ) {
try {
auto gen = cc.get_generated_transaction( gt );
cyc_thr.generated_input.push_back( ProcessedGeneratedTransaction( gen ) );
cyc_thr.generated_input.push_back( processed_generated_transaction( gen ) );
} catch ( const exception &ex) {
fetch_error = true;
elog( "unable to retieve generated transaction, caught {ex}", ("ex",ex) );
......@@ -1600,7 +1600,7 @@ namespace eosio {
// auto ltxn = local_txns.get<by_id>().find(ut);
try {
ProcessedTransaction pt(cc.get_recent_transaction(ut.id));
processed_transaction pt(cc.get_recent_transaction(ut.id));
pt.output = ut.outmsgs;
cyc_thr.user_input.emplace_back(pt);
......@@ -1641,7 +1641,7 @@ namespace eosio {
}
}
void net_plugin_impl::handle_message( connection_ptr c, const SignedTransaction &msg) {
void net_plugin_impl::handle_message( connection_ptr c, const signed_transaction &msg) {
fc_dlog(logger, "got a signed transaction from ${p}", ("p",c->peer_name()));
transaction_id_type txnid = msg.id();
auto entry = local_txns.get<by_id>().find( txnid );
......@@ -1670,18 +1670,18 @@ namespace eosio {
auto tx = c->trx_state.find(txnid);
if( tx == c->trx_state.end()) {
c->trx_state.insert((transaction_state){txnid,true,true,(uint32_t)msg.refBlockNum,
c->trx_state.insert((transaction_state){txnid,true,true,(uint32_t)msg.ref_block_num,
fc::time_point(),fc::time_point()});
} else {
struct trx_mod {
UInt16 block;
trx_mod( UInt16 bn) : block(bn) {}
uint16 block;
trx_mod( uint16 bn) : block(bn) {}
void operator( )( transaction_state &t) {
t.is_known_by_peer = true;
t.block_num = static_cast<uint32_t>(block);
}
};
c->trx_state.modify(tx,trx_mod(msg.refBlockNum));
c->trx_state.modify(tx,trx_mod(msg.ref_block_num));
}
try {
......@@ -1884,7 +1884,7 @@ namespace eosio {
size_t net_plugin_impl::cache_txn (const transaction_id_type txnid,
const SignedTransaction& txn ) {
const signed_transaction& txn ) {
size_t packsiz = fc::raw::pack_size(txn);
size_t bufsiz = packsiz + sizeof(packsiz);
vector<char> buff(bufsiz);
......@@ -1893,7 +1893,7 @@ namespace eosio {
fc::raw::pack( ds, txn );
uint16_t bn = static_cast<uint16_t>(txn.refBlockNum);
uint16_t bn = static_cast<uint16_t>(txn.ref_block_num);
node_transaction_state nts = {txnid,time_point::now(),
txn.expiration,
buff,
......@@ -1902,7 +1902,7 @@ namespace eosio {
return bufsiz;
}
void net_plugin_impl::send_all_txn( const SignedTransaction& txn) {
void net_plugin_impl::send_all_txn( const signed_transaction& txn) {
transaction_id_type txnid = txn.id();
if( local_txns.get<by_id>().find( txnid ) != local_txns.end( ) ) { //found
fc_dlog(logger, "found txnid in local_txns" );
......@@ -1945,7 +1945,7 @@ namespace eosio {
/**
* This one is necessary to hook into the boost notifier api
**/
void net_plugin_impl::transaction_ready( const SignedTransaction& txn) {
void net_plugin_impl::transaction_ready( const signed_transaction& txn) {
my_impl->send_all_txn( txn );
}
......
......@@ -33,12 +33,12 @@ public:
boost::program_options::variables_map _options;
bool _production_enabled = false;
uint32_t _required_producer_participation = 33 * config::Percent1;
uint32_t _required_producer_participation = 33 * config::percent1;
uint32_t _production_skip_flags = eosio::chain::chain_controller::skip_nothing;
eosio::chain::block_schedule::factory _production_scheduler = eosio::chain::block_schedule::in_single_thread;
std::map<chain::public_key_type, fc::ecc::private_key> _private_keys;
std::set<types::AccountName> _producers;
std::set<types::account_name> _producers;
boost::asio::deadline_timer _timer;
};
......@@ -81,12 +81,12 @@ void producer_plugin::set_program_options(
producer_options.add_options()
("enable-stale-production", boost::program_options::bool_switch()->notifier([this](bool e){my->_production_enabled = e;}), "Enable block production, even if the chain is stale.")
("required-participation", boost::program_options::bool_switch()->notifier([this](int e){my->_required_producer_participation = uint32_t(e*config::Percent1);}), "Percent of producers (0-99) that must be participating in order to produce blocks")
("required-participation", boost::program_options::bool_switch()->notifier([this](int e){my->_required_producer_participation = uint32_t(e*config::percent1);}), "Percent of producers (0-99) that must be participating in order to produce blocks")
("producer-name,p", boost::program_options::value<vector<string>>()->composing()->multitoken(),
("ID of producer controlled by this node (e.g. inita; may specify multiple times)"))
("private-key", boost::program_options::value<vector<string>>()->composing()->multitoken()->default_value({fc::json::to_string(private_key_default)},
fc::json::to_string(private_key_default)),
"Tuple of [PublicKey, WIF private key] (may specify multiple times)")
"Tuple of [public_key, WIF private key] (may specify multiple times)")
;
command_line_options.add(producer_options);
config_file_options.add(producer_options);
......@@ -129,7 +129,7 @@ if( options.count(name) ) { \
void producer_plugin::plugin_initialize(const boost::program_options::variables_map& options)
{ try {
my->_options = &options;
LOAD_VALUE_SET(options, "producer-name", my->_producers, types::AccountName)
LOAD_VALUE_SET(options, "producer-name", my->_producers, types::account_name)
if( options.count("private-key") )
{
......@@ -279,7 +279,7 @@ block_production_condition::block_production_condition_enum producer_plugin_impl
//
assert( now > chain.head_block_time() );
eosio::types::AccountName scheduled_producer = chain.get_scheduled_producer( slot );
eosio::types::account_name scheduled_producer = chain.get_scheduled_producer( slot );
// we must control the producer scheduled to produce the next block.
if( _producers.find( scheduled_producer ) == _producers.end() )
{
......@@ -300,7 +300,7 @@ block_production_condition::block_production_condition_enum producer_plugin_impl
uint32_t prate = chain.producer_participation_rate();
if( prate < _required_producer_participation )
{
capture("pct", uint32_t(100*uint64_t(prate) / config::Percent1));
capture("pct", uint32_t(100*uint64_t(prate) / config::percent1));
return block_production_condition::low_participation;
}
......
......@@ -74,7 +74,7 @@ void wallet_api_plugin::plugin_startup() {
CALL(wallet, wallet_mgr, set_timeout,
INVOKE_V_R(wallet_mgr, set_timeout, int64_t), 200),
CALL(wallet, wallet_mgr, sign_transaction,
INVOKE_R_R_R_R(wallet_mgr, sign_transaction, chain::SignedTransaction, flat_set<public_key_type>, chain::chain_id_type), 201),
INVOKE_R_R_R_R(wallet_mgr, sign_transaction, chain::signed_transaction, flat_set<public_key_type>, chain::chain_id_type), 201),
CALL(wallet, wallet_mgr, create,
INVOKE_R_R(wallet_mgr, create, std::string), 201),
CALL(wallet, wallet_mgr, open,
......
......@@ -46,7 +46,7 @@ public:
/// @param id the chain_id to sign transaction with.
/// @return txn signed
/// @throws fc::exception if corresponding private keys not found in unlocked wallets
chain::SignedTransaction sign_transaction(const chain::SignedTransaction& txn, const flat_set<public_key_type>& keys,
chain::signed_transaction sign_transaction(const chain::signed_transaction& txn, const flat_set<public_key_type>& keys,
const chain::chain_id_type& id);
/// Create a new wallet.
......
......@@ -168,10 +168,10 @@ void wallet_manager::import_key(const std::string& name, const std::string& wif_
w->import_key(wif_key);
}
chain::SignedTransaction
wallet_manager::sign_transaction(const chain::SignedTransaction& txn, const flat_set<public_key_type>& keys, const chain::chain_id_type& id) {
chain::signed_transaction
wallet_manager::sign_transaction(const chain::signed_transaction& txn, const flat_set<public_key_type>& keys, const chain::chain_id_type& id) {
check_timeout();
chain::SignedTransaction stxn(txn);
chain::signed_transaction stxn(txn);
for (const auto& pk : keys) {
bool found = false;
......
......@@ -18,24 +18,24 @@ using namespace eosio;
const string tab = " ";
void generateValueToBytes(ostringstream& output, const types::Table& table) {
output << "Bytes valueToBytes(const " << table.type << "& kv) {" << endl;
void generateValueToBytes(ostringstream& output, const types::table& table) {
output << "bytes valueToBytes(const " << table.type << "& kv) {" << endl;
output << tab << "uint32_t maxsize = estimatePackedSize(kv.value);" << endl;
output << tab << "char* buffer = (char *)eosio::malloc(maxsize);" << endl;
output << tab << "datastream<char *> ds(buffer, maxsize);" << endl;
output << tab << "raw::pack(ds, kv.value);" << endl;
output << tab << "Bytes bytes;" << endl;
output << tab << "bytes bytes;" << endl;
output << tab << "bytes.len = ds.tellp();" << endl;
output << tab << "bytes.data = (uint8_t*)buffer;" << endl;
output << tab << "return bytes;" << endl;
output << "}" << endl;
}
void generateBytesToValue(ostringstream& output, const types::Table& table) {
void generateBytesToValue(ostringstream& output, const types::table& table) {
}
void generateCurrentMessage(ostringstream& output, const types::Action& action) {
void generateCurrentMessage(ostringstream& output, const types::action& action) {
output << tab << "template<>" << endl;
output << tab << action.type << " current_message<" << action.type << ">() {" << endl;
output << tab << tab << "uint32_t msgsize = message_size();" << endl;
......@@ -49,40 +49,40 @@ void generateCurrentMessage(ostringstream& output, const types::Action& action)
output << tab << "}" << endl;
}
void generatePack(ostringstream& output, const types::Struct& type) {
void generatePack(ostringstream& output, const types::struct_t& type) {
output << tab << "template<typename Stream> inline void pack( Stream& s, const " << type.name << "& value ) {" << endl;
for(const auto& field : type.fields ) {
output << tab << tab << "raw::pack(s, value." << field.name << ");" << endl;
}
if( type.base != types::TypeName() )
if( type.base != types::type_name() )
output << tab << tab << "raw::pack(s, static_cast<const " << type.base << "&>(value));" << endl;
output << tab << "}" << endl;
}
void generateUnpack(ostringstream& output, const types::Struct& type) {
void generateUnpack(ostringstream& output, const types::struct_t& type) {
output << tab << "template<typename Stream> inline void unpack( Stream& s, " << type.name << "& value ) {" << endl;
for(const auto& field : type.fields ) {
output << tab << tab << "raw::unpack(s, value." << field.name << ");" << endl;
}
if( type.base != types::TypeName() )
if( type.base != types::type_name() )
output << tab << tab << "raw::unpack(s, static_cast<" << type.base << "&>(value));" << endl;
output << tab << "}" << endl;
}
void generateEstimatePackedSize(ostringstream& output, const types::Struct& type) {
void generateEstimatePackedSize(ostringstream& output, const types::struct_t& type) {
output << "uint32_t estimatePackedSize(const " << type.name << "& c) {" << endl;
output << tab << "uint32_t size = 0;" << endl;
for(const auto& field : type.fields ) {
output << tab;
if( field.type == "String" )
if( field.type == "string" )
output << "size += c."<<field.name<<".get_size() + 4;" << endl;
else if( field.type == "Bytes" ) {
else if( field.type == "bytes" ) {
output << "size += c."<<field.name<<".len + 4;" << endl;
} else {
output << "size += sizeof(c."<<field.name<<");" << endl;
}
}
if( type.base != types::TypeName() )
if( type.base != types::type_name() )
output << tab << "size += estimatePackedSize(static_cast<" << type.base << "&>(c));" << endl;
output << tab << "return size;" << endl;
output << "}" << endl;
......@@ -95,7 +95,7 @@ int main (int argc, char *argv[]) {
if( argc < 2 )
return 1;
auto abi = fc::json::from_file<types::Abi>(argv[1]);
auto abi = fc::json::from_file<types::abi>(argv[1]);
ostringstream output;
output << "#include <eoslib/datastream.hpp>" << endl;
......@@ -108,7 +108,7 @@ int main (int argc, char *argv[]) {
//Generate valueToBytes/bytesToValue functions for every str index table type
for(const auto& table : abi.tables) {
if(table.indextype != "str") continue;
if(table.index_type != "str") continue;
generateValueToBytes(output, table);
}
......@@ -122,7 +122,7 @@ int main (int argc, char *argv[]) {
//Generate current_message specialization for every action
output << "namespace eosio {" << endl;
vector<types::TypeName> types_seen;
vector<types::type_name> types_seen;
for(const auto& action : abi.actions) {
if(find(types_seen.begin(), types_seen.end(), action.type) != types_seen.end()) continue;
generateCurrentMessage(output, action);
......
......@@ -274,7 +274,7 @@ msgstr ""
msgid "Retrieve all transactions with specific account name referenced in their scope"
msgstr ""
msgid "Name of account to query on"
msgid "name of account to query on"
msgstr ""
msgid "Number of most recent transactions to skip (0 would start at most recent transaction)"
......
......@@ -79,7 +79,7 @@ const std::vector<std::pair<const char*, std::vector<const char *>>> error_help_
{"AES error[^\\x00]*wallet/unlock.*postdata\":\\[\"([^\"]*)\"", {bad_wallet_password_help_text}},
{"Wallet is locked: ([\\S]*)", {locked_wallet_help_text}},
{"Key already in wallet[^\\x00]*wallet/import_key.*postdata\":\\[\"([^\"]*)\"", {duplicate_key_import_help_text}},
{"Abi does not define table[^\\x00]*get_table_rows.*code\":\"([^\"]*)\",\"table\":\"([^\"]*)\"", {unknown_abi_table_help_text}}
{"ABI does not define table[^\\x00]*get_table_rows.*code\":\"([^\"]*)\",\"table\":\"([^\"]*)\"", {unknown_abi_table_help_text}}
};
auto smatch_to_variant(const std::smatch& smatch) {
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册