Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ABI contains table of other namespace when compiling with 4.0.0 #204

Closed
jeisses opened this issue Jul 29, 2023 · 2 comments
Closed

ABI contains table of other namespace when compiling with 4.0.0 #204

jeisses opened this issue Jul 29, 2023 · 2 comments
Assignees
Labels
bug Something isn't working 👍 lgtm

Comments

@jeisses
Copy link

jeisses commented Jul 29, 2023

Some of my smart contracts that work fine with 3.1.0 generate an invalid ABI when compiling with 4.0.0

After some searching, I noticed that the ABIs generated with 4.0.0 contain a table definition from an other namespace.

Minimal example, test.cpp:

#include <eosio/eosio.hpp>
#include <eosio/singleton.hpp>

using namespace eosio;

namespace other {
  struct config { name standard = name("test"); };
  typedef singleton <name("config"), config> configt;
};


class [[eosio::contract("test")]] test : public eosio::contract {
public:
  using contract::contract;

  [[eosio::action]]
  void init() {
  }
};

When compiling this with 3.1.0 the following ABI is generated, which is what I expect:

{
    "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ",
    "version": "eosio::abi/1.2",
    "types": [],
    "structs": [
        {
            "name": "init",
            "base": "",
            "fields": []
        }
    ],
    "actions": [
        {
            "name": "init",
            "type": "init",
            "ricardian_contract": ""
        }
    ],
    "tables": [],
    "ricardian_clauses": [],
    "variants": [],
    "action_results": []
}

The ABI from 4.0.0:

{
    "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ",
    "version": "eosio::abi/1.2",
    "types": [],
    "structs": [
        {
            "name": "init",
            "base": "",
            "fields": []
        }
    ],
    "actions": [
        {
            "name": "init",
            "type": "init",
            "ricardian_contract": ""
        }
    ],
    "tables": [
        {
            "name": "config",
            "type": "config",
            "index_type": "i64",
            "key_names": [],
            "key_types": []
        }
    ],
    "ricardian_clauses": [],
    "variants": [],
    "action_results": []
}

It incorrectly contains the config table which refers to an undefined config struct. Also strange is that, if the other namespace contains multiple table definitions, only one seems to be added the the ABI.

Not sure how/why this happens, but wanted to check if this is an issue with cdt or my compilation

@heifner
Copy link
Member

heifner commented Jul 29, 2023

Possibly fixed by #201

@BenjaminGormanPMP BenjaminGormanPMP added 👍 lgtm bug Something isn't working and removed triage labels Aug 3, 2023
@dimas1185
Copy link
Contributor

@jeisses fixed by #201

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 👍 lgtm
Projects
Archived in project
Development

No branches or pull requests

5 participants