未验证 提交 4a307bd0 编写于 作者: D Daniel Larimer 提交者: GitHub

Merge branch 'master' into issue3352

......@@ -21,14 +21,11 @@ extern "C" {
typedef uint64_t account_name;
typedef uint64_t permission_name;
typedef uint64_t token_name;
typedef uint64_t table_name;
typedef uint32_t time;
typedef uint64_t scope_name;
typedef uint64_t action_name;
typedef uint64_t asset_symbol;
typedef int64_t share_type;
typedef uint16_t weight_type;
/* macro to align/overalign a type to ensure calls to intrinsics with pointers/references are properly aligned */
......
{
"____comment": "This file was generated by eosio-abigen. DO NOT EDIT - 2018-04-16T13:37:55",
"____comment": "This file was generated by eosio-abigen. DO NOT EDIT - 2018-05-23T20:27:36",
"version": "eosio::abi/1.0",
"types": [],
"structs": [{
"name": "hi",
"base": "",
"fields": [{
"name": "user",
"type": "account_name"
"type": "name"
}
]
}
......@@ -14,7 +15,7 @@
"actions": [{
"name": "hi",
"type": "hi",
"ricardian_contract": "# CONTRACT FOR hello::hi## ACTION NAME: hi\n### Parameters### Parameters\nInput paramters:Input paramters:\n\n* `user` (string to include in the output)* `user` (string to include in the output)\n\nImplied parameters: Implied parameters: \n\n* `account_name` (name of the party invoking and signing the contract)* `account_name` (name of the party invoking and signing the contract)\n\n### Intent### Intent\nINTENT. The intention of the author and the invoker of this contract is to print output. It shall have no other effect.INTENT. The intention of the author and the invoker of this contract is to print output. It shall have no other effect.\n\n### Term### Term\nTERM. This Contract expires at the conclusion of code execution.TERM. This Contract expires at the conclusion of code execution.\n"
"ricardian_contract": "# CONTRACT FOR hello::hi## ACTION NAME: hi\n### Parameters### Parameters\nInput parameters:Input parameters:\n\n* `user` (string to include in the output)* `user` (string to include in the output)\n\nImplied parameters: Implied parameters: \n\n* `account_name` (name of the party invoking and signing the contract)* `account_name` (name of the party invoking and signing the contract)\n\n### Intent### Intent\nINTENT. The intention of the author and the invoker of this contract is to print output. It shall have no other effect.INTENT. The intention of the author and the invoker of this contract is to print output. It shall have no other effect.\n\n### Term### Term\nTERM. This Contract expires at the conclusion of code execution.TERM. This Contract expires at the conclusion of code execution.\n"
}
],
"tables": [],
......@@ -58,5 +59,7 @@
"id": "Construction and Interpretation",
"body": "CONSTRUCTION AND INTERPRETATION. The rule requiring construction or interpretation against the drafter is waived. The document shall be deemed as if it were drafted by both parties in a mutual effort. \n \n"
}
]
}
],
"error_messages": [],
"abi_extensions": []
}
\ No newline at end of file
......@@ -17,7 +17,6 @@ void test_types::types_size() {
eosio_assert( sizeof(uint8_t) == 1, "uint8_t size != 1");
eosio_assert( sizeof(account_name) == 8, "account_name size != 8");
eosio_assert( sizeof(token_name) == 8, "token_name size != 8");
eosio_assert( sizeof(table_name) == 8, "table_name size != 8");
eosio_assert( sizeof(time) == 4, "time size != 4");
eosio_assert( sizeof(eosio::key256) == 32, "key256 size != 32" );
......
#include <eosio/abi_generator/abi_generator.hpp>
#include <eosio/chain/abi_def.hpp>
namespace eosio {
......@@ -82,6 +83,14 @@ string abi_generator::translate_type(const string& type_name) {
else if (type_name == "long" || type_name == "int32_t") built_in_type = "int32";
else if (type_name == "short" || type_name == "int16_t") built_in_type = "int16";
else if (type_name == "char" || type_name == "int8_t") built_in_type = "int8";
else {
static auto types = eosio::chain::common_type_defs();
auto itr = std::find_if( types.begin(), types.end(),
[&type_name]( const eosio::chain::type_def& t ) { return t.new_type_name == type_name; } );
if( itr != types.end()) {
built_in_type = itr->type;
}
}
return built_in_type;
}
......
#include <eosio/chain/abi_def.hpp>
#include <fc/utility.hpp>
namespace eosio { namespace chain {
vector<type_def> common_type_defs() {
vector<type_def> types;
types.push_back( type_def{"account_name", "name"} );
types.push_back( type_def{"permission_name", "name"} );
types.push_back( type_def{"action_name", "name"} );
types.push_back( type_def{"table_name", "name"} );
types.push_back( type_def{"transaction_id_type", "checksum256"} );
types.push_back( type_def{"block_id_type", "checksum256"} );
types.push_back( type_def{"weight_type", "uint16"} );
return types;
}
abi_def eosio_contract_abi(const abi_def& eosio_system_abi)
{
abi_def eos_abi(eosio_system_abi);
......@@ -10,13 +25,7 @@ abi_def eosio_contract_abi(const abi_def& eosio_system_abi)
eos_abi.version = "eosio::abi/1.0";
}
eos_abi.types.push_back( type_def{"account_name", "name"} );
eos_abi.types.push_back( type_def{"permission_name", "name"} );
eos_abi.types.push_back( type_def{"action_name", "name"} );
eos_abi.types.push_back( type_def{"table_name", "name"} );
eos_abi.types.push_back( type_def{"transaction_id_type", "checksum256"} );
eos_abi.types.push_back( type_def{"block_id_type", "checksum256"} );
eos_abi.types.push_back( type_def{"weight_type", "uint16"} );
fc::move_append(eos_abi.types, common_type_defs());
// transaction
eos_abi.structs.emplace_back( struct_def {
......
......@@ -106,7 +106,7 @@ struct abi_def {
,error_messages(error_msgs)
{}
string version;
string version = "eosio::abi/1.0";
vector<type_def> types;
vector<struct_def> structs;
vector<action_def> actions;
......@@ -117,6 +117,7 @@ struct abi_def {
};
abi_def eosio_contract_abi(const abi_def& eosio_system_abi);
vector<type_def> common_type_defs();
} } /// namespace eosio::chain
......
......@@ -340,45 +340,49 @@ void print_action_tree( const fc::variant& action ) {
}
void print_result( const fc::variant& result ) { try {
const auto& processed = result["processed"];
const auto& transaction_id = processed["id"].as_string();
string status = processed["receipt"].is_object() ? processed["receipt"]["status"].as_string() : "failed";
int64_t net = -1;
int64_t cpu = -1;
if (processed.get_object().contains("receipt")) {
const auto& receipt = processed["receipt"];
if (receipt.is_object()) {
net = receipt["net_usage_words"].as_int64() * 8;
cpu = receipt["cpu_usage_us"].as_int64();
if (result.is_object() && result.get_object().contains("processed")) {
const auto& processed = result["processed"];
const auto& transaction_id = processed["id"].as_string();
string status = processed["receipt"].is_object() ? processed["receipt"]["status"].as_string() : "failed";
int64_t net = -1;
int64_t cpu = -1;
if( processed.get_object().contains( "receipt" )) {
const auto& receipt = processed["receipt"];
if( receipt.is_object()) {
net = receipt["net_usage_words"].as_int64() * 8;
cpu = receipt["cpu_usage_us"].as_int64();
}
}
}
cerr << status << " transaction: " << transaction_id << " ";
if (net < 0) {
cerr << "<unknown>";
} else {
cerr << net;
}
cerr << " bytes ";
if (cpu < 0) {
cerr << "<unknown>";
} else {
cerr << cpu;
}
cerr << status << " transaction: " << transaction_id << " ";
if( net < 0 ) {
cerr << "<unknown>";
} else {
cerr << net;
}
cerr << " bytes ";
if( cpu < 0 ) {
cerr << "<unknown>";
} else {
cerr << cpu;
}
cerr << " us\n";
cerr << " us\n";
if( status == "failed" ) {
auto soft_except = processed["except"].as<optional<fc::exception>>();
if( soft_except ) {
edump((soft_except->to_detail_string()));
if( status == "failed" ) {
auto soft_except = processed["except"].as<optional<fc::exception>>();
if( soft_except ) {
edump((soft_except->to_detail_string()));
}
} else {
const auto& actions = processed["action_traces"].get_array();
for( const auto& a : actions ) {
print_action_tree( a );
}
wlog( "\rwarning: transaction executed locally, but may not be confirmed by the network yet" );
}
} else {
const auto& actions = processed["action_traces"].get_array();
for( const auto& a : actions ) {
print_action_tree( a );
}
wlog( "\rwarning: transaction executed locally, but may not be confirmed by the network yet" );
cerr << fc::json::to_pretty_string( result ) << endl;
}
} FC_CAPTURE_AND_RETHROW( (result) ) }
......@@ -387,7 +391,7 @@ void send_actions(std::vector<chain::action>&& actions, int32_t extra_kcpu = 100
auto result = push_actions( move(actions), extra_kcpu, compression);
if( tx_print_json ) {
cout << fc::json::to_pretty_string( result );
cout << fc::json::to_pretty_string( result ) << endl;
} else {
print_result( result );
}
......@@ -397,9 +401,8 @@ void send_transaction( signed_transaction& trx, int32_t extra_kcpu, packed_trans
auto result = push_transaction(trx, extra_kcpu, compression);
if( tx_print_json ) {
cout << fc::json::to_pretty_string( result );
cout << fc::json::to_pretty_string( result ) << endl;
} else {
auto trace = result["processed"].as<eosio::chain::transaction_trace>();
print_result( result );
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册