Skip to content

Commit b073742

Browse files
authored
Merge pull request #8 from EOSIO/variant
ABI 1.1 support
2 parents 1b38fd6 + c7f86bb commit b073742

File tree

5 files changed

+1257
-289
lines changed

5 files changed

+1257
-289
lines changed

src/abieos.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ extern "C" abieos_bool abieos_set_abi(abieos_context* context, uint64_t contract
101101
abi_def def{};
102102
if (!json_to_native(def, abi))
103103
return false;
104+
check_abi_version(def.version);
104105
auto c = create_contract(def);
105106
context->contracts.insert({name{contract}, std::move(c)});
106107
return true;
@@ -112,6 +113,7 @@ extern "C" abieos_bool abieos_set_abi_bin(abieos_context* context, uint64_t cont
112113
context->last_error = "abi parse error";
113114
if (!data || !size)
114115
throw std::runtime_error("no data");
116+
check_abi_version(input_buffer{data, data + size});
115117
abi_def def{};
116118
if (!bin_to_native(def, {data, data + size}))
117119
return false;
@@ -183,8 +185,8 @@ extern "C" const char* abieos_bin_to_json(abieos_context* context, uint64_t cont
183185
const char* data, size_t size) {
184186
fix_null_str(type);
185187
return handle_exceptions(context, nullptr, [&]() -> const char* {
186-
if (!data || !size)
187-
throw std::runtime_error("no data");
188+
if (!data)
189+
size = 0;
188190
context->last_error = "binary decode error";
189191
auto contract_it = context->contracts.find(::abieos::name{contract});
190192
if (contract_it == context->contracts.end())

0 commit comments

Comments
 (0)