Skip to content

Commit 904cb2d

Browse files
committed
abi_def: don't default version
1 parent a89d00e commit 904cb2d

File tree

6 files changed

+37
-3
lines changed

6 files changed

+37
-3
lines changed

contracts/identity/test/identity_test.abi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"version": "eosio::abi/1.0",
23
"types": [{
34
"new_type_name": "account_name",
45
"type": "name"

contracts/payloadless/payloadless.abi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"version": "eosio::abi/1.1",
23
"____comment": "This file was generated by eosio-abigen. DO NOT EDIT - 2018-04-19T09:07:16",
34
"types": [],
45
"structs": [{

contracts/test_ram_limit/test_ram_limit.abi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"____comment": "This file was generated by eosio-abigen. DO NOT EDIT - 2018-03-29T02:09:11",
3+
"version": "eosio::abi/1.1",
34
"types": [{
45
"new_type_name": "account_name",
56
"type": "name"

libraries/chain/include/eosio/chain/abi_def.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,15 @@ struct may_not_exist {
107107
struct abi_def {
108108
abi_def() = default;
109109
abi_def(const vector<type_def>& types, const vector<struct_def>& structs, const vector<action_def>& actions, const vector<table_def>& tables, const vector<clause_pair>& clauses, const vector<error_message>& error_msgs)
110-
:version("eosio::abi/1.1")
111-
,types(types)
110+
:types(types)
112111
,structs(structs)
113112
,actions(actions)
114113
,tables(tables)
115114
,ricardian_clauses(clauses)
116115
,error_messages(error_msgs)
117116
{}
118117

119-
string version = "eosio::abi/1.1";
118+
string version = "";
120119
vector<type_def> types;
121120
vector<struct_def> structs;
122121
vector<action_def> actions;

programs/eosio-abigen/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ int main(int argc, const char **argv) { abi_def output; try {
8686
vector<string> actions;
8787
int result = Tool.run(create_find_macro_factory(contract, actions, abi_context).get());
8888
if(!result) {
89+
output.version = "eosio::abi/1.1";
8990
result = Tool.run(create_factory(abi_verbose, abi_opt_sfs, abi_context, output, contract, actions).get());
9091
if(!result) {
9192
abi_serializer abis(output, fc::seconds(1)); // No risk to client side serialization taking a long time

unittests/abi_tests.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ BOOST_AUTO_TEST_CASE(uint_types)
494494

495495
const char* currency_abi = R"=====(
496496
{
497+
"version": "eosio::abi/1.1",
497498
"types": [],
498499
"structs": [{
499500
"name": "transfer",
@@ -555,6 +556,7 @@ struct abi_gen_helper {
555556
std::string stdc_include_param = std::string("-I") + eosiolib_path + "/musl/upstream/include";
556557

557558
abi_def output;
559+
output.version = "eosio::abi/1.1";
558560

559561
std::string contract;
560562
std::vector<std::string> actions;
@@ -661,6 +663,7 @@ BOOST_FIXTURE_TEST_CASE(abigen_all_types, abi_gen_helper)
661663

662664
const char* all_types_abi = R"=====(
663665
{
666+
"version": "eosio::abi/1.1",
664667
"types": [],
665668
"structs": [{
666669
"name": "test_struct",
@@ -808,6 +811,7 @@ BOOST_FIXTURE_TEST_CASE(abigen_double_action, abi_gen_helper)
808811

809812
const char* double_action_abi = R"=====(
810813
{
814+
"version": "eosio::abi/1.1",
811815
"types": [],
812816
"structs": [{
813817
"name" : "A",
@@ -1026,6 +1030,7 @@ BOOST_FIXTURE_TEST_CASE(abigen_full_table_decl, abi_gen_helper)
10261030

10271031
const char* full_table_decl_abi = R"=====(
10281032
{
1033+
"version": "eosio::abi/1.1",
10291034
"types": [],
10301035
"structs": [{
10311036
"name" : "table1",
@@ -1124,6 +1129,7 @@ BOOST_FIXTURE_TEST_CASE(abigen_template_base, abi_gen_helper)
11241129

11251130
const char* template_base_abi = R"=====(
11261131
{
1132+
"version": "eosio::abi/1.1",
11271133
"types": [],
11281134
"structs": [{
11291135
"name" : "base32",
@@ -1179,6 +1185,7 @@ BOOST_FIXTURE_TEST_CASE(abigen_action_and_table, abi_gen_helper)
11791185

11801186
const char* action_and_table_abi = R"=====(
11811187
{
1188+
"version": "eosio::abi/1.1",
11821189
"types": [],
11831190
"structs": [{
11841191
"name" : "table_action",
@@ -1238,6 +1245,7 @@ BOOST_FIXTURE_TEST_CASE(abigen_simple_typedef, abi_gen_helper)
12381245

12391246
const char* simple_typedef_abi = R"=====(
12401247
{
1248+
"version": "eosio::abi/1.1",
12411249
"types": [{
12421250
"new_type_name" : "my_base_alias",
12431251
"type" : "common_params"
@@ -1304,6 +1312,7 @@ BOOST_FIXTURE_TEST_CASE(abigen_field_typedef, abi_gen_helper)
13041312

13051313
const char* field_typedef_abi = R"=====(
13061314
{
1315+
"version": "eosio::abi/1.1",
13071316
"types": [{
13081317
"new_type_name" : "my_complex_field_alias",
13091318
"type" : "complex_field"
@@ -1379,6 +1388,7 @@ BOOST_FIXTURE_TEST_CASE(abigen_vector_of_POD, abi_gen_helper)
13791388

13801389
const char* abigen_vector_of_POD_abi = R"=====(
13811390
{
1391+
"version": "eosio::abi/1.1",
13821392
"types": [],
13831393
"structs": [{
13841394
"name": "table1",
@@ -1452,6 +1462,7 @@ BOOST_FIXTURE_TEST_CASE(abigen_vector_of_structs, abi_gen_helper)
14521462

14531463
const char* abigen_vector_of_structs_abi = R"=====(
14541464
{
1465+
"version": "eosio::abi/1.1",
14551466
"types": [],
14561467
"structs": [{
14571468
"name": "my_struct",
@@ -1557,6 +1568,7 @@ BOOST_FIXTURE_TEST_CASE(abigen_vector_alias, abi_gen_helper)
15571568

15581569
const char* abigen_vector_alias_abi = R"=====(
15591570
{
1571+
"version": "eosio::abi/1.1",
15601572
"types": [{
15611573
"new_type_name": "array_of_rows",
15621574
"type": "row[]"
@@ -1633,6 +1645,7 @@ BOOST_FIXTURE_TEST_CASE(abigen_eosioabi_macro, abi_gen_helper)
16331645

16341646
const char* abigen_eosioabi_macro_abi = R"=====(
16351647
{
1648+
"version": "eosio::abi/1.1",
16361649
"types": [],
16371650
"structs": [{
16381651
"name": "hi",
@@ -1695,6 +1708,7 @@ BOOST_FIXTURE_TEST_CASE(abigen_contract_inheritance, abi_gen_helper)
16951708

16961709
const char* abigen_contract_inheritance_abi = R"=====(
16971710
{
1711+
"version": "eosio::abi/1.1",
16981712
"types": [],
16991713
"structs": [{
17001714
"name": "hi",
@@ -2046,6 +2060,7 @@ BOOST_AUTO_TEST_CASE(abi_cycle)
20462060

20472061
const char* struct_cycle_abi = R"=====(
20482062
{
2063+
"version": "eosio::abi/1.1",
20492064
"types": [],
20502065
"structs": [{
20512066
"name": "A",
@@ -2782,6 +2797,7 @@ BOOST_AUTO_TEST_CASE(packed_transaction)
27822797

27832798
const char* packed_transaction_abi = R"=====(
27842799
{
2800+
"version": "eosio::abi/1.1",
27852801
"types": [{
27862802
"new_type_name": "compression_type",
27872803
"type": "int64"
@@ -2864,6 +2880,7 @@ BOOST_AUTO_TEST_CASE(abi_type_repeat)
28642880

28652881
const char* repeat_abi = R"=====(
28662882
{
2883+
"version": "eosio::abi/1.1",
28672884
"types": [{
28682885
"new_type_name": "actor_name",
28692886
"type": "name"
@@ -2924,6 +2941,7 @@ BOOST_AUTO_TEST_CASE(abi_struct_repeat)
29242941

29252942
const char* repeat_abi = R"=====(
29262943
{
2944+
"version": "eosio::abi/1.1",
29272945
"types": [{
29282946
"new_type_name": "actor_name",
29292947
"type": "name"
@@ -2980,6 +2998,7 @@ BOOST_AUTO_TEST_CASE(abi_action_repeat)
29802998

29812999
const char* repeat_abi = R"=====(
29823000
{
3001+
"version": "eosio::abi/1.1",
29833002
"types": [{
29843003
"new_type_name": "actor_name",
29853004
"type": "name"
@@ -3039,6 +3058,7 @@ BOOST_AUTO_TEST_CASE(abi_table_repeat)
30393058

30403059
const char* repeat_abi = R"=====(
30413060
{
3061+
"version": "eosio::abi/1.1",
30423062
"types": [{
30433063
"new_type_name": "actor_name",
30443064
"type": "name"
@@ -3101,6 +3121,7 @@ BOOST_AUTO_TEST_CASE(abi_type_def)
31013121
// inifinite loop in types
31023122
const char* repeat_abi = R"=====(
31033123
{
3124+
"version": "eosio::abi/1.1",
31043125
"types": [{
31053126
"new_type_name": "account_name",
31063127
"type": "name"
@@ -3153,6 +3174,7 @@ BOOST_AUTO_TEST_CASE(abi_type_loop)
31533174
// inifinite loop in types
31543175
const char* repeat_abi = R"=====(
31553176
{
3177+
"version": "eosio::abi/1.1",
31563178
"types": [{
31573179
"new_type_name": "account_name",
31583180
"type": "name"
@@ -3196,6 +3218,7 @@ BOOST_AUTO_TEST_CASE(abi_type_redefine)
31963218
// inifinite loop in types
31973219
const char* repeat_abi = R"=====(
31983220
{
3221+
"version": "eosio::abi/1.1",
31993222
"types": [{
32003223
"new_type_name": "account_name",
32013224
"type": "account_name"
@@ -3236,6 +3259,7 @@ BOOST_AUTO_TEST_CASE(abi_type_redefine_to_name)
32363259
// inifinite loop in types
32373260
const char* repeat_abi = R"=====(
32383261
{
3262+
"version": "eosio::abi/1.1",
32393263
"types": [{
32403264
"new_type_name": "name",
32413265
"type": "name"
@@ -3257,6 +3281,7 @@ BOOST_AUTO_TEST_CASE(abi_type_nested_in_vector)
32573281
// inifinite loop in types
32583282
const char* repeat_abi = R"=====(
32593283
{
3284+
"version": "eosio::abi/1.1",
32603285
"types": [],
32613286
"structs": [{
32623287
"name": "store_t",
@@ -3282,6 +3307,7 @@ BOOST_AUTO_TEST_CASE(abi_account_name_in_eosio_abi)
32823307
// inifinite loop in types
32833308
const char* repeat_abi = R"=====(
32843309
{
3310+
"version": "eosio::abi/1.1",
32853311
"types": [{
32863312
"new_type_name": "account_name",
32873313
"type": "name"
@@ -3324,6 +3350,7 @@ BOOST_AUTO_TEST_CASE(abi_large_array)
33243350
try {
33253351
const char* abi_str = R"=====(
33263352
{
3353+
"version": "eosio::abi/1.1",
33273354
"types": [],
33283355
"structs": [{
33293356
"name": "hi",
@@ -3361,6 +3388,7 @@ BOOST_AUTO_TEST_CASE(abi_is_type_recursion)
33613388
try {
33623389
const char* abi_str = R"=====(
33633390
{
3391+
"version": "eosio::abi/1.1",
33643392
"types": [
33653393
{
33663394
"new_type_name": "a[]",
@@ -3404,6 +3432,7 @@ BOOST_AUTO_TEST_CASE(abi_recursive_structs)
34043432
try {
34053433
const char* abi_str = R"=====(
34063434
{
3435+
"version": "eosio::abi/1.1",
34073436
"types": [],
34083437
"structs": [
34093438
{
@@ -3556,6 +3585,7 @@ BOOST_AUTO_TEST_CASE(variants)
35563585
BOOST_AUTO_TEST_CASE(extend)
35573586
{
35583587
auto abi = R"({
3588+
"version": "eosio::abi/1.1",
35593589
"structs": [
35603590
{"name": "s", "base": "", "fields": [
35613591
{"name": "i0", "type": "int8"},
@@ -3593,6 +3623,7 @@ BOOST_AUTO_TEST_CASE(extend)
35933623
BOOST_AUTO_TEST_CASE(version)
35943624
{
35953625
try {
3626+
BOOST_CHECK_THROW( abi_serializer(fc::json::from_string(R"({})").as<abi_def>(), max_serialization_time), unsupported_abi_version_exception );
35963627
BOOST_CHECK_THROW( abi_serializer(fc::json::from_string(R"({"version": ""})").as<abi_def>(), max_serialization_time), unsupported_abi_version_exception );
35973628
BOOST_CHECK_THROW( abi_serializer(fc::json::from_string(R"({"version": "eosio::abi/9.0"})").as<abi_def>(), max_serialization_time), unsupported_abi_version_exception );
35983629
abi_serializer(fc::json::from_string(R"({"version": "eosio::abi/1.0"})").as<abi_def>(), max_serialization_time);

0 commit comments

Comments
 (0)