-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Create ABI for all native contracts #215
Comments
The wallet web ui guys are going to need this soon for create account (types::newaccount). Maybe you could do that part first or assign that part to me. |
Dan's branch: |
I added types::newaccount in branch wallet-ui-test-240 for the wallet ui guys to use to test. So now as long as this is done by test network release they should be good. |
I believe this is complete once the latest 'experience' branch is merged. |
@bytemaster You assigned this to me, but your last statement sounds like it is completed. I'm presuming that means I just need to track this to make sure it is wrapped up. |
@brianjohnson5972 Could add some tests for Dan's additions. |
A cpp test would be good.. Assuming my test is correct, if a type is does not have an ABI and you send in a json object in Message.data, the error message will be: A better error message is going to help someone in the future. This is a test from eosjs: api error => http://127.0.0.1:8888/v1/chain/push_transaction {"refBlockNum":52,"refBlockPrefix":609021817,"expiration":"2017-09-06T18:25:51","scope":["inita"],"readscope":[],"messages":[{"code":"eos","type":"newaccount","authorization":[{"account":"inita","permission":"active"}],"data":{"creator":"inita","name":"acct54","owner":{"threshold":1,"keys":[{"key":"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","weight":1}],"accounts":[]},"active":{"threshold":1,"keys":[{"key":"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","weight":1}],"accounts":[]},"recovery":{"threshold":1,"keys":[{"key":"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","weight":1}],"accounts":[]},"deposit":{"amount":"10","symbol":"0"}}}],"signatures":["1f51cb9ac98cb46c5b33b428ad051f7521640c5b8215fb501c39535bc42ead9a6b2daa3841ee8a8f61e0e7fdb4914cf99d831d6ab93cb5e8a2729d88b4c2be0e03"]} { Error: 7 bad_cast_exception: Bad Cast
Invalid cast from type 'object_type' to string
{"type":"object_type"}
thread-0 variant.cpp:565 get_string |
@heifner Can this be tested in unit tests, or can we only get to this interface using ./eosd? |
For native I think you should just be able to do a to/from json using fc::json and verify the types are decoded appropriately. |
In the unit tests, please consider this case: You know how |
Yes, this needs "tested" using ApiSerializer on all native messages. |
This is another test you might want to include or document. Always length prefix the binary (on-chain) representation message.data. This is the existing behavior. Reason: parsers without access an ABI require this prefix to parse the remaining transaction. |
I just found out, the serialization behavior is 100% correct. The only bug I see is that when calling post_transaction, message.data must be hex for the I did suspect a serialization bug, however, this is not the case.. |
I was working through adding tests for all the native message types. I should be able to complete it by tomorrow morning. |
@brianjohnson5972 I'm not sure what @jcalfee is referring to. The |
Created pull request for unit tests for all type definitions defined in native_contract_chain_initializer::prepare_database. |
all of the built-in contracts need to define a proper ABI so that the JSON-RPC interface works properly.
The text was updated successfully, but these errors were encountered: