You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 2, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 2, 2022. It is now read-only.
I am writing a simple test contract which saves a struct with (Name,char[32]). Saving seems to work ok but when I try to read nothing is returned and eosc get table dbtest dbtest test fails with the following error. Attached is a simple test case, I think the length of 40 is correct so I am not sure why it has a negative over figure
1377035ms thread-0 main.cpp:906 main ] Failed with error: 10 assert_exception: Assert Exception
status_code == 200: Error
: 8 out_of_range_exception: Out of Range
read datastream of length 40 over by -30
{"method":"read","len":40,"over":-30}
thread-0 datastream.cpp:6 throw_datastream_range_error
{"msg":"8 out_of_range_exception: Out of Range\nread datastream of length 40 over by -30\n {\"method\":\"read\",\"len\":40,\"over\":-30}\n thread-0 datastream.cpp:6 throw_datastream_range_error"}
thread-0 httpc.cpp:113 call
{"server":"localhost","port":8888,"path":"/https/github.com/v1/chain/get_table_rows","postdata":{"json":true,"scope":"dbtest","code":"dbtest","table":"test"}}
thread-0 httpc.cpp:117 call
Yes, if you look at the build.sh script it sets the value but then I cannot read it back out (maybe just my lack of c++ skills), the eosc command still asserts so I cannot verify that anything was written
Can you modify your abi file as below and check again please? I changed the keyname in table section from "teststring" to "owner". I will continue debugging it tomorrow.
Note: This is a quick fix to make your contract work, in future versions the handling of types like FixedString32 inside the contract code will be easier.
thanks this post.
I get the same issue today. following this post's suggestion, I update my struct, then my contract works fine.
e.g., (schema1)(schema2) is missed in wrong version.
// @abi table
struct cont{
uint64_t key;
name issuer;
uint64_t schema1;
uint64_t schema2;
std::string link;
auto primary_key()const {return key;}
EOSLIB_SERIALIZE(cont, (key)(issuer)(link))
// should change to the following:
// EOSLIB_SERIALIZE(cont, (key)(issuer)(schema1)(schema2)(link))
Activity
liderako commentedon Sep 19, 2017
Can you change the value in the table?
michaeljyeates commentedon Sep 19, 2017
Yes, if you look at the build.sh script it sets the value but then I cannot read it back out (maybe just my lack of c++ skills), the eosc command still asserts so I cannot verify that anything was written
liderako commentedon Sep 19, 2017
maybe type char, doesn't work.
Do you know that error?
Output in eosd window
Maybe. At you too she will be.
michaeljyeates commentedon Sep 19, 2017
Yes I get that error every time a message is sent but it doesnt seem to break anything
heifner commentedon Sep 19, 2017
The get_recent_transaction is issue #429.
pavybez commentedon Sep 20, 2017
@michaeljyeates can you attach your implementation so that I can debug?
Edit: Just saw your attachment.
pavybez commentedon Sep 20, 2017
Can you modify your abi file as below and check again please? I changed the keyname in table section from "teststring" to "owner". I will continue debugging it tomorrow.
{ "types": [{ "newTypeName": "AccountName", "type": "Name" } ], "structs": [{ "name": "teststring", "base": "", "fields": { "owner": "Name", "name": "FixedString32" } } ], "actions": [{ "action": "store", "type": "teststring" },{ "action": "get", "type": "teststring" } ], "tables": [{ "table": "test", "type": "teststring", "indextype": "i64", "keynames" : ["owner"], "keytypes" : ["Name"] } ] }michaeljyeates commentedon Sep 20, 2017
I tried changing that, same problem
michaeljyeates commentedon Sep 20, 2017
Is there a way to delete the database or remove all entries?
elmato commentedon Sep 20, 2017
elmato commentedon Sep 21, 2017
After some debugging here is a quick fix for your contract.
In dbtest.abi
keynamesof the table should beThat change is needed to later query the tables using
eosc./eosc get table dbtest dbtest testIn dbtest.hpp
TestStringtype should besince the first byte of a serialized FixedString32 indicates its length.
Also in dbtest.hpp the call to
Tests::getshould beTests::get( owner, teststr );otherwise you will be calling
and a
tx_missing_scopewill arise since you were usingowneras the scope to read from.And finally in dbtest.cpp
Note: This is a quick fix to make your contract work, in future versions the handling of types like FixedString32 inside the contract code will be easier.
elmato commentedon Sep 21, 2017
Here is the output from
./eosc get table dbtest dbtest test{ "rows": [{ "owner": "dbtest", "name": "0123456789ABCDEF0123456789ABCDEF" },{ "owner": "iiii", "name": "0123456789ABCDEF0123456789ABCDEF" },{ "owner": "xx", "name": "0123456789ABCDEF0123456789ABCDEF" },{ "owner": "yy", "name": "0123456789ABCDEF0123456789ABCDEF" } ], "more": false }michaeljyeates commentedon Sep 22, 2017
I am getting this error now
./dbtest.hpp:15:5: error: static_assert failed "unexpected packing"Attached is my current version
dbtest.zip
elmato commentedon Sep 22, 2017
Are you using PACKED when declaring TestString?
michaeljyeates commentedon Sep 22, 2017
That worked, thanks!
gpmn commentedon May 30, 2018
thanks this post.
I get the same issue today. following this post's suggestion, I update my struct, then my contract works fine.
e.g., (schema1)(schema2) is missed in wrong version.
}
Update CLI11 to v1.9.1
Update CLI11 to v1.9.1