Skip to content
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

Fix: state history plugin issues #164

Merged
merged 1 commit into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/chain_plugin/chain_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2087,7 +2087,7 @@ read_only::get_act_token_result read_only::get_act_token( const name& account_na
}
// REX
const auto& d = db.db();
const auto& code_account = db.db().get<account_object,by_name>( config::system_account_name );
const auto& code_account = db.db().get<account_object2,by_name>( config::system_account_name );
abi_def abi;
if( abi_serializer::to_abi(code_account.abi, abi) ) {
abi_serializer abis( abi, abi_serializer_max_time );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ datastream<ST>& operator<<(datastream<ST>& ds, const history_serial_wrapper<std:
}

template <typename ST>
datastream<ST>& operator<<(datastream<ST>& ds, const history_serial_wrapper<eosio::chain::account_object>& obj) {
datastream<ST>& operator<<(datastream<ST>& ds, const history_serial_wrapper<eosio::chain::account_object2>& obj) {
fc::raw::pack(ds, fc::unsigned_int(0));
fc::raw::pack(ds, as_type<uint64_t>(obj.obj.name.to_uint64_t()));
fc::raw::pack(ds, as_type<eosio::chain::block_timestamp_type>(obj.obj.creation_date));
Expand Down Expand Up @@ -576,6 +576,8 @@ datastream<ST>& operator<<(datastream<ST>& ds, const history_context_wrapper<boo
e = "Y";
}
fc::raw::pack(ds, as_type<fc::optional<std::string>>(e));
fc::raw::pack(ds, as_type<fc::optional<uint64_t>>(debug_mode ? obj.obj.error_code
: cap_error_code(obj.obj.error_code)));

return ds;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/state_history_plugin/state_history_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ struct state_history_plugin_impl : std::enable_shared_from_this<state_history_pl
}
};

process_table("account", db.get_index<account_index>(), pack_row);
process_table("account", db.get_index<account_index2>(), pack_row);
process_table("account_metadata", db.get_index<account_metadata_index>(), pack_row);
process_table("code", db.get_index<code_index>(), pack_row);

Expand Down
32 changes: 2 additions & 30 deletions plugins/state_history_plugin/state_history_plugin_abi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,24 +311,6 @@ extern const char* const state_history_plugin_abi = R"({
{ "type": "producer_key[]", "name": "producers" }
]
},
{
"name": "block_signing_authority_v0", "fields": [
{ "type": "uint32", "name": "threshold" },
{ "type": "key_weight[]", "name": "keys" }
]
},
{
"name": "producer_authority", "fields": [
{ "type": "name", "name": "producer_name" },
{ "type": "block_signing_authority", "name": "authority" }
]
},
{
"name": "producer_authority_schedule", "fields": [
{ "type": "uint32", "name": "version" },
{ "type": "producer_authority[]", "name": "producers" }
]
},
{
"name": "chain_config_v0", "fields": [
{ "type": "uint64", "name": "max_block_net_usage" },
Expand Down Expand Up @@ -357,14 +339,6 @@ extern const char* const state_history_plugin_abi = R"({
{ "type": "chain_config", "name": "configuration" }
]
},
{
"name": "global_property_v1", "fields": [
{ "type": "uint32?", "name": "proposed_schedule_block_num" },
{ "type": "producer_authority_schedule", "name": "proposed_schedule" },
{ "type": "chain_config", "name": "configuration" },
{ "type": "checksum256", "name": "chain_id" }
]
},
{
"name": "generated_transaction_v0", "fields": [
{ "type": "name", "name": "sender" },
Expand Down Expand Up @@ -507,7 +481,7 @@ extern const char* const state_history_plugin_abi = R"({
{ "name": "contract_index_double", "types": ["contract_index_double_v0"] },
{ "name": "contract_index_long_double", "types": ["contract_index_long_double_v0"] },
{ "name": "chain_config", "types": ["chain_config_v0"] },
{ "name": "global_property", "types": ["global_property_v0", "global_property_v1"] },
{ "name": "global_property", "types": ["global_property_v0"] },
{ "name": "generated_transaction", "types": ["generated_transaction_v0"] },
{ "name": "permission", "types": ["permission_v0"] },
{ "name": "permission_link", "types": ["permission_link_v0"] },
Expand All @@ -517,8 +491,7 @@ extern const char* const state_history_plugin_abi = R"({
{ "name": "resource_limits_state", "types": ["resource_limits_state_v0"] },
{ "name": "resource_limits_ratio", "types": ["resource_limits_ratio_v0"] },
{ "name": "elastic_limit_parameters", "types": ["elastic_limit_parameters_v0"] },
{ "name": "resource_limits_config", "types": ["resource_limits_config_v0"] },
{ "name": "block_signing_authority", "types": ["block_signing_authority_v0"] }
{ "name": "resource_limits_config", "types": ["resource_limits_config_v0"] }
],
"tables": [
{ "name": "account", "type": "account", "key_names": ["name"] },
Expand All @@ -533,7 +506,6 @@ extern const char* const state_history_plugin_abi = R"({
{ "name": "contract_index_long_double", "type": "contract_index_long_double", "key_names": ["code", "scope", "table", "primary_key"] },
{ "name": "global_property", "type": "global_property", "key_names": [] },
{ "name": "generated_transaction", "type": "generated_transaction", "key_names": ["sender", "sender_id"] },
{ "name": "protocol_state", "type": "protocol_state", "key_names": [] },
{ "name": "permission", "type": "permission", "key_names": ["owner", "name"] },
{ "name": "permission_link", "type": "permission_link", "key_names": ["account", "code", "message_type"] },
{ "name": "resource_limits", "type": "resource_limits", "key_names": ["owner"] },
Expand Down
2 changes: 1 addition & 1 deletion tests/chain_plugin_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ BOOST_FIXTURE_TEST_CASE( get_block_with_invalid_abi, TESTER ) try {

auto resolver = [&,this]( const account_name& name ) -> fc::optional<abi_serializer> {
try {
const auto& accnt = this->control->db().get<account_object,by_name>( name );
const auto& accnt = this->control->db().get<account_object2,by_name>( name );
abi_def abi;
if (abi_serializer::to_abi(accnt.abi, abi)) {
return abi_serializer(abi, abi_serializer_max_time);
Expand Down