Closed jcalfee closed 7 years ago
Transaction no longer has a field "authorizations" -- this got moved down to Message::authorization. It might be dying trying to parse Message::authorization, which you don't have in your json.
nope
1781497ms thread-1 http_plugin.cpp:134 operator() ] {"refBlockNum":795,"refBlockPrefix":59287120,"expiration":"2017-08-08T21:30:39","scope":["eos","inita"],"messages":[{"code":"eos","type":"transfer","data":{"from":"eos","to":"inita","amount":1}}],"signatures":["1f0563bfec4653f815b992a3f115910c472e70df018f2d783ddfe60aeffe2cf54441f69d06102260c09fe5d90b422f263f89c0cc234b933e994b8d11229f5b31a0"]}
1781497ms thread-1 chain_api_plugin.cpp:59 operator() ] Exception encountered while processing chain.push_transaction: {"code":7,"name":"bad_cast_exception","message":"Bad Cast","stack":[{"context":{"level":"error","file":"variant.cpp","line":565,"method":"get_string","hostname":"","thread_name":"thread-1","timestamp":"2017-08-08T21:29:41"},"format":"Invalid cast from type '${type}' to Object","data":{"type":"uint64_type"}}]}
It might be the dreaded Message.type ..
It might be. I'm not sure how that gets serialized to json...
Here is my test command .. The api seems to be an issue if we assume the eosc output transaction is formatted correctly:
echo '{"refBlockNum":"18885","refBlockPrefix":"1955828998","expiration":"2017-08-09T13:05:25","scope":["eos","inita"],"signatures":[],"authorizations":[{"account":"eos","permission":"active"}],"messages":[{"code":"eos","type":"transfer","data":{"from":"eos","to":"inita","amount":"1"},"hex_data":"000000000000e62b000000008040934b0100000000000000"}]}' | curl http://127.0.0.1:8888/v1/chain/push_transaction -d @-
That transaction still has an authorizations
field and the message lacks its authorization
field.
nope
{"refBlockNum":1428,"refBlockPrefix":376491140,"expiration":"2017-08-15T18:29:09","scope":["inita","initb"],"messages":[{"code":"eos","type":"transfer","authorization":[{"account":"inita","permission":"active"}],"data":{"from":"inita","to":"initb","amount":"13"}}],"signatures":["1f095cf2fabaedd81f42e33dda85c3327bcb078f126d4993e014067f465cbad79577281a350c563ccee874546a385585885f224e1c46c1841413d28ce03fdcba8a"]}
Exception encountered while processing chain.push_transaction: {"code":7,"name":"bad_cast_exception","message":"Bad Cast","stack":[{"context":{"level":"error","file":"variant.cpp","line":565,"method":"get_string","hostname":"","thread_name":"thread-1","timestamp":"2017-08-15T18:28:11"},"format":"Invalid cast from type '${type}' to Object","data":{"type":"uint64_type"}}]}
@jcalfee just rename the hex_data
field to data
{
"refBlockNum": "111",
"refBlockPrefix": "2018069090",
"expiration": "2017-08-16T15:50:49",
"scope": ["inita", "initb"],
"messages": [
{
"code": "eos",
"type": "transfer",
"authorization": [
{
"account": "inita",
"permission": "active"
}],
"data": "000000008040934b000000000041934b0a00000000000000"
}],
"signatures": []
}
Since the eos contract has the ABI defined, the output from push_transaction
is prettyfied (decoded) before sending it back.
...
if( code_account.abi.size() > 4 ) { /// 4 == packsize of empty Abi
try {
msg_mvo( "data", message_from_binary( msg.code, msg.type, msg.data ) );
msg_mvo( "hex_data", msg.data );
} catch ( ... ) {
SET_FIELD( msg_mvo, msg, data );
}
}
...
@elmato Why is the transaction in JSON decoded but the data is not? Is it like this transaction is 1/2 decoded.
Dan explained to me that if it has an ABI the data could be JSON. Otherwise the "data" would be hex.
I think I see what is going on.. The EOS contract does not have an ABI.
moved to: https://github.com/EOSIO/eos/issues/215
Copy the "processed" block output from this command (except for output):
And send the json to the push_transaction API call. I'm getting the following error:
This is the error in
eosd
: