Skip to content

Commit

Permalink
Merge pull request EOSIO#3210 from EOSIO/gh#2099-get-block
Browse files Browse the repository at this point in the history
get block display of old structs
  • Loading branch information
heifner authored May 18, 2018
2 parents 817cd9d + afa002b commit cd97982
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 10 deletions.
53 changes: 52 additions & 1 deletion contracts/eosio.system/eosio.system.abi
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"new_type_name": "weight_type",
"type": "uint16"
}],
"____comment": "eosio.bios structs: set_account_limits, setpriv, set_global_limits, producer_key, set_producers, require_auth are provided so abi available for deserialization in future.",
"structs": [{
"name": "permission_level",
"base": "",
Expand Down Expand Up @@ -333,6 +334,40 @@
{"name":"account", "type":"account_name"},
{"name":"is_priv", "type":"int8"}
]
},{
"name": "set_account_limits",
"base": "",
"fields": [
{"name":"account", "type":"account_name"},
{"name":"ram_bytes", "type":"int64"},
{"name":"net_weight", "type":"int64"},
{"name":"cpu_weight", "type":"int64"}
]
},{
"name": "set_global_limits",
"base": "",
"fields": [
{"name":"cpu_usec_per_period", "type":"int64"}
]
},{
"name": "producer_key",
"base": "",
"fields": [
{"name":"producer_name", "type":"account_name"},
{"name":"block_signing_key", "type":"public_key"}
]
},{
"name": "set_producers",
"base": "",
"fields": [
{"name":"schedule", "type":"producer_key[]"}
]
},{
"name": "require_auth",
"base": "",
"fields": [
{"name":"from", "type":"account_name"}
]
}
],
"actions": [{
Expand Down Expand Up @@ -423,7 +458,23 @@
"name": "setpriv",
"type": "setpriv",
"ricardian_contract": ""
}],
},{
"name": "setalimits",
"type": "set_account_limits",
"ricardian_contract": ""
},{
"name": "setglimits",
"type": "set_global_limits",
"ricardian_contract": ""
},{
"name": "setprods",
"type": "set_producers",
"ricardian_contract": ""
},{
"name": "reqauth",
"type": "require_auth",
"ricardian_contract": ""
}],
"tables": [{
"name": "producers",
"type": "producer_info",
Expand Down
12 changes: 9 additions & 3 deletions libraries/chain/include/eosio/chain/abi_serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,12 @@ namespace impl {
auto abi = resolver(act.account);
if (abi.valid()) {
auto type = abi->get_action_type(act.name);
mvo("data", abi->binary_to_variant(type, act.data));
mvo("hex_data", act.data);
if (!type.empty()) {
mvo("data", abi->binary_to_variant(type, act.data));
mvo("hex_data", act.data);
} else {
mvo("data", act.data);
}
} else {
mvo("data", act.data);
}
Expand Down Expand Up @@ -394,7 +398,9 @@ namespace impl {
auto abi = resolver(act.account);
if (abi.valid()) {
auto type = abi->get_action_type(act.name);
act.data = std::move(abi->variant_to_binary(type, data));
if (!type.empty()) {
act.data = std::move( abi->variant_to_binary( type, data ));
}
}
}
}
Expand Down
9 changes: 3 additions & 6 deletions tests/nodeos_run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,13 +638,10 @@ def cmdError(name, cmdCode=0, exitNow=False):
Print("CurrentBlockNum: %d" % (currentBlockNum))
Print("Request blocks 1-%d" % (currentBlockNum))
for blockNum in range(1, currentBlockNum+1):
block=node.getBlock(str(blockNum), retry=False, silentErrors=True)
block=node.getBlock(str(blockNum), retry=False, silentErrors=False)
if block is None:
# TBD: Known issue (Issue 2099) that the block containing setprods isn't retrievable.
# Enable errorExit() once that is resolved.
Print("WARNING: Failed to get block %d (probably issue 2099). Report and keep going..." % (blockNum))
# cmdError("%s get block" % (ClientName))
# errorExit("get block by num %d" % blockNum)
cmdError("%s get block" % (ClientName))
errorExit("get block by num %d" % blockNum)

if enableMongo:
blockId=block["block_id"]
Expand Down

0 comments on commit cd97982

Please sign in to comment.