uuosio / ascdk

MIT License
12 stars 9 forks source link

invalid ABI generated if project includes two classes with the same name #87

Open boid-com opened 9 months ago

boid-com commented 9 months ago

In my example I have two contracts that need to communicate and read config data from each other. Each contract has a unique config table called Config. I import their config tables and the project builds correctly, but the ABI includes two definitions of Config which are different. When interacting with this contract the rpc node returns an error about the ABI . I was able to work around the issue by renaming the structs so they have unique names. Ideally there should be some technique to namespace classes when they are imported to prevent this issue from happening.

telegram-cloud-photo-size-1-5073641942348311469-x

[14:54:17] eosio ERROR: safeDo Error: https://test.telos.eosusa.io/ duplicate_abi_table_def_exception: Duplicate table definition in the ABI at /v1/chain/get_table_rows duplicate_abi_table_def_exception: Duplicate table definition in the ABI at /v1/chain/get_table_rows
    at APIClient.<anonymous> (/root/boid-worker/node_modules/@wharfkit/antelope/lib/antelope.js:5542:23)
    at Generator.next (<anonymous>)
    at fulfilled (/root/boid-worker/node_modules/tslib/tslib.js:166:62)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  path: '/v1/chain/get_table_rows',
  response: {
    headers: {
      'access-control-allow-headers': 'Origin, Accept, X-Requested-With, Content-Type',
      'access-control-allow-methods': 'GET, HEAD, OPTIONS, POST',
      'access-control-allow-origin': '*',
      connection: 'close',
      'content-length': '289',
      'content-type': 'application/json',
      server: 'nodeos/v5.0.0',
      'x-forwarded-proto': 'https',
      'x-frame-options': 'always'
    },
    status: 500,
    json: { code: 500, message: 'Internal Service Error', error: [Object] },
    text: '{"code":500,"message":"Internal Service Error","error":{"code":3015008,"name":"duplicate_abi_table_def_exception","what":"Duplicate table definition in the ABI","details":[{"message":"duplicate table definition detected","file":"abi_serializer.cpp","line_number":184,"method":"set_abi"}]}}'
  }
}